Search in sources :

Example 11 with Uninterruptible

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

the class RCHeader method makeLogged.

/**
 * Signify completion of logging <code>object</code>.
 *
 * <code>object</code> is left in the <code>LOGGED</code> state.
 *
 * @see #attemptToLog(ObjectReference)
 * @param object The object whose state is to be changed.
 */
@Inline
@Uninterruptible
public static void makeLogged(ObjectReference object) {
    Word value = VM.objectModel.readAvailableBitsWord(object);
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(value.and(LOGGING_MASK).NE(LOGGED));
    VM.objectModel.writeAvailableBitsWord(object, value.and(LOGGING_MASK.not()));
}
Also used : Word(org.vmmagic.unboxed.Word) Uninterruptible(org.vmmagic.pragma.Uninterruptible) Inline(org.vmmagic.pragma.Inline)

Example 12 with Uninterruptible

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

the class RCHeader method decRC.

/**
 * Decrement the reference count of an object.  Return either
 * <code>DEC_KILL</code> if the count went to zero,
 * <code>DEC_ALIVE</code> if the count did not go to zero.
 *
 * @param object The object whose RC is to be decremented.
 * @return <code>DEC_KILL</code> if the count went to zero,
 * <code>DEC_ALIVE</code> if the count did not go to zero.
 */
@Inline
@Uninterruptible
public static int decRC(ObjectReference object) {
    Word oldValue, newValue;
    int rtn;
    if (VM.VERIFY_ASSERTIONS) {
        VM.assertions._assert(RCBase.isRCObject(object));
        VM.assertions._assert(isLiveRC(object));
    }
    do {
        oldValue = VM.objectModel.prepareAvailableBits(object);
        if (isStuck(oldValue))
            return DEC_ALIVE;
        newValue = oldValue.minus(INCREMENT);
        if (newValue.and(READ_MASK).LT(LIVE_THRESHOLD)) {
            rtn = DEC_KILL;
        } else {
            rtn = DEC_ALIVE;
        }
    } while (!VM.objectModel.attemptAvailableBits(object, oldValue, newValue));
    return rtn;
}
Also used : Word(org.vmmagic.unboxed.Word) Uninterruptible(org.vmmagic.pragma.Uninterruptible) Inline(org.vmmagic.pragma.Inline)

Example 13 with Uninterruptible

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

the class RuntimeEntrypoints method aastoreUninterruptible.

@Entrypoint
@Uninterruptible
static void aastoreUninterruptible(Object[] arrayRef, int index, Object value) {
    if (VM.VerifyAssertions) {
        int nelts = ObjectModel.getArrayLength(arrayRef);
        VM._assert(index >= 0 && index < nelts);
    }
    Services.setArrayUninterruptible(arrayRef, index, value);
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Uninterruptible(org.vmmagic.pragma.Uninterruptible) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 14 with Uninterruptible

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

the class StackTrace method countFramesUninterruptible.

/**
 * Walk the stack counting the number of stack frames encountered.
 * The stack being walked is our stack, so code is Uninterruptible to stop the
 * stack moving.
 *
 * @param stackTraceThread the thread whose stack is walked
 * @return number of stack frames encountered
 */
@Uninterruptible
@NoInline
private int countFramesUninterruptible(RVMThread stackTraceThread) {
    int stackFrameCount = 0;
    Address fp;
    /* Stack trace for the thread */
    if (stackTraceThread == RVMThread.getCurrentThread()) {
        fp = Magic.getFramePointer();
    } else {
        AbstractRegisters contextRegisters = stackTraceThread.getContextRegisters();
        fp = contextRegisters.getInnermostFramePointer();
    }
    fp = Magic.getCallerFramePointer(fp);
    while (Magic.getCallerFramePointer(fp).NE(StackFrameLayout.getStackFrameSentinelFP())) {
        int compiledMethodId = Magic.getCompiledMethodID(fp);
        if (compiledMethodId != StackFrameLayout.getInvisibleMethodID()) {
            CompiledMethod compiledMethod = CompiledMethods.getCompiledMethod(compiledMethodId);
            if ((compiledMethod.getCompilerType() != CompiledMethod.TRAP) && compiledMethod.hasBridgeFromNativeAnnotation()) {
                // skip native frames, stopping at last native frame preceeding the
                // Java To C transition frame
                fp = RuntimeEntrypoints.unwindNativeStackFrame(fp);
            }
        }
        stackFrameCount++;
        fp = Magic.getCallerFramePointer(fp);
    }
    // VM.sysWriteln("stack frame count = ",stackFrameCount);
    return stackFrameCount;
}
Also used : Address(org.vmmagic.unboxed.Address) AbstractRegisters(org.jikesrvm.architecture.AbstractRegisters) BaselineCompiledMethod(org.jikesrvm.compilers.baseline.BaselineCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) Uninterruptible(org.vmmagic.pragma.Uninterruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 15 with Uninterruptible

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

the class ThinLock method biasBitsToThinBits.

@Inline
@Uninterruptible
private static Word biasBitsToThinBits(Word bits) {
    int lockOwner = getLockOwner(bits);
    Word changed = bits.and(TL_UNLOCK_MASK).or(TL_STAT_THIN);
    if (lockOwner != 0) {
        int recCount = getRecCount(bits);
        changed = changed.or(Word.fromIntZeroExtend(lockOwner)).or(Word.fromIntZeroExtend(recCount - 1).lsh(TL_LOCK_COUNT_SHIFT));
    }
    return changed;
}
Also used : Word(org.vmmagic.unboxed.Word) Entrypoint(org.vmmagic.pragma.Entrypoint) Uninterruptible(org.vmmagic.pragma.Uninterruptible) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

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