Search in sources :

Example 1 with Uninterruptible

use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.

the class CompiledMethod method containsReturnAddress.

/**
 * Does the code for the compiled method contain the given return address?
 * @param ip a return address
 * @return {@code true} if it belongs to this method's code, {@code false} otherwise.
 */
@Uninterruptible
public final boolean containsReturnAddress(Address ip) {
    Address beg = Magic.objectAsAddress(instructions);
    Address end = beg.plus(instructions.length() << ArchConstants.getLogInstructionWidth());
    // 
    return !(ip.LE(beg) || ip.GT(end));
}
Also used : Address(org.vmmagic.unboxed.Address) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 2 with Uninterruptible

use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.

the class CompiledMethods method snipObsoleteCompiledMethods.

/**
 * Snip reference to CompiledMethod so that we can reclaim code space. If
 * the code is currently being executed, stack scanning is responsible for
 * marking it NOT obsolete. Keep such reference until a future GC.
 * <p>
 * NOTE: It's expected that this is processed during GC, after scanning
 *    stacks to determine which methods are currently executing.
 */
@Uninterruptible
public static void snipObsoleteCompiledMethods() {
    Magic.combinedLoadBarrier();
    if (!scanForObsoleteMethods)
        return;
    scanForObsoleteMethods = false;
    Magic.fence();
    int max = numCompiledMethods();
    for (int i = 0; i < max; i++) {
        CompiledMethod cm = getCompiledMethodUnchecked(i);
        if (cm != null) {
            if (cm.isActiveOnStack()) {
                if (cm.isObsolete()) {
                    // can't get it this time; force us to look again next GC
                    scanForObsoleteMethods = true;
                    Magic.fence();
                }
                cm.clearActiveOnStack();
            } else {
                if (cm.isObsolete()) {
                    // obsolete and not active on a thread stack: it's garbage!
                    setCompiledMethod(i, null);
                }
            }
        }
    }
}
Also used : JNICompiledMethod(org.jikesrvm.jni.JNICompiledMethod) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 3 with Uninterruptible

use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.

the class BaselineCompiledMethod method findBytecodeIndexForInstruction.

/**
 * Find bytecode index corresponding to one of this method's
 * machine instructions.
 *
 * @param instructionOffset instruction offset to map to a bytecode index.<br>
 * Note: This method expects the offset to refer to the machine
 * instruction immediately FOLLOWING the bytecode in question.  just
 * like findLineNumberForInstruction. See CompiledMethod for
 * rationale.<br>
 * NOTE: instructionIndex is in units of instructions, not bytes
 * (different from all the other methods in this interface!!)
 * @return the bytecode index for the machine instruction, -1 if not
 *         available or not found.
 */
@Uninterruptible
public int findBytecodeIndexForInstruction(Offset instructionOffset) {
    Offset instructionIndex = instructionOffset.toWord().rsha(ArchConstants.getLogInstructionWidth()).toOffset();
    int candidateIndex = -1;
    int bcIndex = 0;
    Offset instrIndex = Offset.zero();
    for (int i = 0; i < bytecodeMap.length; ) {
        // unsign-extend
        int b0 = (bytecodeMap[i++]) & 255;
        int deltaBC, deltaIns;
        if (b0 != 255) {
            deltaBC = b0 >> 5;
            deltaIns = b0 & 31;
        } else {
            // unsign-extend
            int b1 = (bytecodeMap[i++]) & 255;
            // unsign-extend
            int b2 = (bytecodeMap[i++]) & 255;
            // unsign-extend
            int b3 = (bytecodeMap[i++]) & 255;
            // unsign-extend
            int b4 = (bytecodeMap[i++]) & 255;
            deltaBC = (b1 << 8) | b2;
            deltaIns = (b3 << 8) | b4;
        }
        bcIndex += deltaBC;
        instrIndex = instrIndex.plus(deltaIns);
        if (instrIndex.sGE(instructionIndex)) {
            break;
        }
        candidateIndex = bcIndex;
    }
    return candidateIndex;
}
Also used : Offset(org.vmmagic.unboxed.Offset) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 4 with Uninterruptible

use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.

the class DebugUtil method dumpRef.

@Uninterruptible
public static void dumpRef(ObjectReference ref) {
    VM.sysWrite("REF=");
    if (ref.isNull()) {
        VM.sysWriteln("NULL");
        VM.sysWriteln();
        return;
    }
    VM.sysWrite(ref);
    if (!mappedVMRef(ref)) {
        VM.sysWriteln(" (REF OUTSIDE OF HEAP OR NOT MAPPED)");
        return;
    }
    ObjectModel.dumpHeader(ref);
    ObjectReference tib = ObjectReference.fromObject(ObjectModel.getTIB(ref));
    if (!MemoryManager.mightBeTIB(tib)) {
        VM.sysWriteln(" (INVALID TIB: CLASS NOT ACCESSIBLE)");
        return;
    }
    RVMType type = Magic.getObjectType(ref.toObject());
    ObjectReference itype = ObjectReference.fromObject(type);
    VM.sysWrite(" TYPE=");
    VM.sysWrite(itype);
    if (!validType(itype)) {
        VM.sysWriteln(" (INVALID TYPE: CLASS NOT ACCESSIBLE)");
        return;
    }
    VM.sysWrite(" CLASS=");
    VM.sysWrite(type.getDescriptor());
    VM.sysWriteln();
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) RVMType(org.jikesrvm.classloader.RVMType) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 5 with Uninterruptible

use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.

the class MiscHeader method initializeHeader.

/**
 * Perform any required initialization of the MISC portion of the header.
 * @param obj the object ref to the storage to be initialized
 * @param tib the TIB of the instance being created
 * @param size the number of bytes allocated by the GC system for this object.
 * @param isScalar are we initializing a scalar (true) or array (false) object?
 */
@Uninterruptible
public static void initializeHeader(Object obj, TIB tib, int size, boolean isScalar) {
    /* Only perform initialization when it is required */
    if (GENERATE_GC_TRACE) {
        Address ref = Magic.objectAsAddress(obj);
        ref.store(oid, OBJECT_OID_OFFSET);
        ref.store(time, OBJECT_DEATH_OFFSET);
        oid = oid.plus(Word.fromIntSignExtend((size - GC_TRACING_HEADER_BYTES) >> LOG_BYTES_IN_ADDRESS));
    }
}
Also used : Address(org.vmmagic.unboxed.Address) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Aggregations

Uninterruptible (org.vmmagic.pragma.Uninterruptible)29 Address (org.vmmagic.unboxed.Address)14 Word (org.vmmagic.unboxed.Word)8 Entrypoint (org.vmmagic.pragma.Entrypoint)7 Inline (org.vmmagic.pragma.Inline)6 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)5 NoInline (org.vmmagic.pragma.NoInline)4 Offset (org.vmmagic.unboxed.Offset)4 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)3 ContextListener (org.jikesrvm.adaptive.measurements.listeners.ContextListener)2 MethodListener (org.jikesrvm.adaptive.measurements.listeners.MethodListener)2 AbstractRegisters (org.jikesrvm.architecture.AbstractRegisters)2 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)2 ObjectReference (org.vmmagic.unboxed.ObjectReference)2 NullListener (org.jikesrvm.adaptive.measurements.listeners.NullListener)1 RVMMethod (org.jikesrvm.classloader.RVMMethod)1 RVMType (org.jikesrvm.classloader.RVMType)1 JNICompiledMethod (org.jikesrvm.jni.JNICompiledMethod)1 TIB (org.jikesrvm.objectmodel.TIB)1 NoNullCheck (org.vmmagic.pragma.NoNullCheck)1