Search in sources :

Example 1 with BaselineNoRegisters

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

the class RVMThread method transferExecutionToNewStack.

@NoInline
@BaselineNoRegisters
private static // --> non-volatiles not restored!
void transferExecutionToNewStack(byte[] newStack, AbstractRegisters exceptionRegisters) {
    // prevent opt compiler from inlining a method that contains a magic
    // (returnToNewStack) that it does not implement.
    RVMThread myThread = getCurrentThread();
    byte[] myStack = myThread.stack;
    // initialize new stack with live portion of stack we're
    // currently running on
    // 
    // lo-mem hi-mem
    // |<---myDepth----|
    // +----------+---------------+
    // | empty | live |
    // +----------+---------------+
    // ^myStack ^myFP ^myTop
    // 
    // +-------------------+---------------+
    // | empty | live |
    // +-------------------+---------------+
    // ^newStack ^newFP ^newTop
    // 
    Address myTop = Magic.objectAsAddress(myStack).plus(myStack.length);
    Address newTop = Magic.objectAsAddress(newStack).plus(newStack.length);
    Address myFP = Magic.getFramePointer();
    Offset myDepth = myTop.diff(myFP);
    Address newFP = newTop.minus(myDepth);
    // The frame pointer addresses the top of the frame on powerpc and
    // the bottom
    // on intel. if we copy the stack up to the current
    // frame pointer in here, the
    // copy will miss the header of the intel frame. Thus we make another
    // call
    // to force the copy. A more explicit way would be to up to the
    // frame pointer
    // and the header for intel.
    Offset delta = copyStack(newStack);
    // 
    if (exceptionRegisters != null) {
        adjustRegisters(exceptionRegisters, delta);
    }
    adjustStack(newStack, newFP, delta);
    // install new stack
    // 
    myThread.stack = newStack;
    myThread.stackLimit = Magic.objectAsAddress(newStack).plus(StackFrameLayout.getStackSizeGuard());
    // 
    if (VM.BuildForPowerPC) {
        Magic.returnToNewStack(Magic.getCallerFramePointer(newFP));
    } else if (VM.BuildForIA32) {
        Magic.returnToNewStack(newFP);
    }
    if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : Address(org.vmmagic.unboxed.Address) Offset(org.vmmagic.unboxed.Offset) BaselineNoRegisters(org.vmmagic.pragma.BaselineNoRegisters) NoInline(org.vmmagic.pragma.NoInline)

Aggregations

BaselineNoRegisters (org.vmmagic.pragma.BaselineNoRegisters)1 NoInline (org.vmmagic.pragma.NoInline)1 Address (org.vmmagic.unboxed.Address)1 Offset (org.vmmagic.unboxed.Offset)1