Search in sources :

Example 26 with Uninterruptible

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

the class JNIExceptionDeliverer method unwindStackFrame.

/**
 * Unwind registers/stack through JNI method
 * @see org.jikesrvm.runtime.ExceptionDeliverer#unwindStackFrame(CompiledMethod, AbstractRegisters)
 */
@Uninterruptible
@Override
public void unwindStackFrame(CompiledMethod compiledMethod, AbstractRegisters registers) {
    Address fp = registers.getInnermostFramePointer();
    // Restore nonvolatile registers used by the JNI compiler
    registers.getGPRs().set(GPR.EDI.value(), fp.plus(JNICompiler.EDI_SAVE_OFFSET).loadWord());
    registers.getGPRs().set(GPR.EBX.value(), fp.plus(JNICompiler.EBX_SAVE_OFFSET).loadWord());
    registers.getGPRs().set(GPR.EBP.value(), fp.plus(JNICompiler.EBP_SAVE_OFFSET).loadWord());
    registers.unwindStackFrame();
}
Also used : Address(org.vmmagic.unboxed.Address) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 27 with Uninterruptible

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

the class Registers method adjustESP.

/**
 * A thread's stack has been moved or resized.
 * Adjust the ESP register to reflect new position.
 *
 * @param delta The displacement to be applied
 * @param traceAdjustments Log all adjustments to stderr if true
 */
@Uninterruptible
@Override
public void adjustESP(Offset delta, boolean traceAdjustments) {
    Word old = getGPRs().get(ESP.value());
    getGPRs().set(ESP.value(), old.plus(delta));
    if (traceAdjustments) {
        VM.sysWrite(" esp =");
        VM.sysWrite(getGPRs().get(ESP.value()));
    }
}
Also used : Word(org.vmmagic.unboxed.Word) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 28 with Uninterruptible

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

the class DebugUtil method validRef.

@Uninterruptible
public static boolean validRef(ObjectReference ref) {
    if (ref.isNull())
        return true;
    if (!Space.isMappedObject(ref)) {
        VM.sysWrite("validRef: REF outside heap, ref = ");
        VM.sysWrite(ref);
        VM.sysWriteln();
        Space.printVMMap();
        return false;
    }
    if (MOVES_OBJECTS) {
    /*
      TODO: Work out how to check if forwarded
      if (Plan.isForwardedOrBeingForwarded(ref)) {
        // TODO: actually follow forwarding pointer
        // (need to bound recursion when things are broken!!)
        return true;
      }
      */
    }
    TIB tib = ObjectModel.getTIB(ref);
    Address tibAddr = Magic.objectAsAddress(tib);
    if (!Space.isMappedObject(ObjectReference.fromObject(tib))) {
        VM.sysWrite("validRef: TIB outside heap, ref = ");
        VM.sysWrite(ref);
        VM.sysWrite(" tib = ");
        VM.sysWrite(tibAddr);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    if (tibAddr.isZero()) {
        VM.sysWrite("validRef: TIB is Zero! ");
        VM.sysWrite(ref);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    if (tib.length() == 0) {
        VM.sysWrite("validRef: TIB length zero, ref = ");
        VM.sysWrite(ref);
        VM.sysWrite(" tib = ");
        VM.sysWrite(tibAddr);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    ObjectReference type = ObjectReference.fromObject(tib.getType());
    if (!validType(type)) {
        VM.sysWrite("validRef: invalid TYPE, ref = ");
        VM.sysWrite(ref);
        VM.sysWrite(" tib = ");
        VM.sysWrite(Magic.objectAsAddress(tib));
        VM.sysWrite(" type = ");
        VM.sysWrite(type);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    return true;
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) TIB(org.jikesrvm.objectmodel.TIB) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Example 29 with Uninterruptible

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

the class JNIEnvironment method dumpJniRefsStack.

/**
 * Dump the JNIRefs stack to the sysWrite stream
 */
@Uninterruptible
public void dumpJniRefsStack() {
    int jniRefOffset = JNIRefsTop;
    VM.sysWriteln();
    VM.sysWriteln("* * dump of JNIEnvironment JniRefs Stack * *");
    VM.sysWrite("* JNIRefs = ");
    VM.sysWrite(Magic.objectAsAddress(JNIRefs));
    VM.sysWrite(" * JNIRefsTop = ");
    VM.sysWrite(JNIRefsTop);
    VM.sysWrite(" * JNIRefsSavedFP = ");
    VM.sysWrite(JNIRefsSavedFP);
    VM.sysWriteln(".");
    VM.sysWriteln("*");
    while (jniRefOffset >= 0) {
        VM.sysWrite(jniRefOffset);
        VM.sysWrite(" ");
        VM.sysWrite(Magic.objectAsAddress(JNIRefs).plus(jniRefOffset));
        VM.sysWrite(" ");
        MemoryManager.dumpRef(JNIRefs.get(jniRefOffset >> LOG_BYTES_IN_ADDRESS).toObjectReference());
        jniRefOffset -= BYTES_IN_ADDRESS;
    }
    VM.sysWriteln();
    VM.sysWriteln("* * end of dump * *");
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) 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