Search in sources :

Example 16 with NoInline

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

the class PostThreadSwitch method postProcess.

/* This method must be inlined to keep the correctness
   * This method is called at the end of threadSwitch, the caller
   * is threadSwitchFrom<...>
   */
@NoInline
public static void postProcess(RVMThread myThread) {
    /* We need to generate thread specific code and install new code.
    * We have to make sure that no GC happens from here and before
    * the new code get executed.
    */
    // add branch instruction from CTR.
    CodeArray bridge = myThread.bridgeInstructions;
    Address bridgeaddr = Magic.objectAsAddress(bridge);
    Offset offset = myThread.fooFPOffset.plus(STACKFRAME_RETURN_ADDRESS_OFFSET);
    Magic.objectAsAddress(myThread.getStack()).store(bridgeaddr, offset);
    myThread.fooFPOffset = Offset.zero();
    myThread.isWaitingForOsr = false;
    myThread.bridgeInstructions = null;
}
Also used : CodeArray(org.jikesrvm.compilers.common.CodeArray) Address(org.vmmagic.unboxed.Address) Offset(org.vmmagic.unboxed.Offset) NoInline(org.vmmagic.pragma.NoInline)

Example 17 with NoInline

use of org.vmmagic.pragma.NoInline 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)

Example 18 with NoInline

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

the class RVMThread method yieldpointFromBackedge.

/**
 * Yieldpoint taken on backedge.
 */
@BaselineSaveLSRegisters
// Save all non-volatile registers in prologue
@NoOptCompile
@NoInline
// TODO fix this -- related to SaveVolatile
@Entrypoint
@Unpreemptible("Becoming another thread interrupts the current thread, avoid preemption in the process")
public static void yieldpointFromBackedge() {
    Address fp = Magic.getFramePointer();
    yieldpoint(BACKEDGE, fp);
}
Also used : Address(org.vmmagic.unboxed.Address) Unpreemptible(org.vmmagic.pragma.Unpreemptible) Entrypoint(org.vmmagic.pragma.Entrypoint) BaselineSaveLSRegisters(org.vmmagic.pragma.BaselineSaveLSRegisters) NoInline(org.vmmagic.pragma.NoInline) NoOptCompile(org.vmmagic.pragma.NoOptCompile)

Example 19 with NoInline

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

the class DynamicLinkerHelper method getReceiverObject.

/**
 * Reach up two stack frames into a frame that is compiled
 * with the DynamicBridge register protocol and grap
 * the receiver object of the invoke (ie the first param).
 * NOTE: assumes that caller has disabled GC.
 */
@NoInline
public static Object getReceiverObject() {
    // reach into register save area and fetch "this" parameter
    Address callingFrame = Magic.getCallerFramePointer(Magic.getFramePointer());
    callingFrame = Magic.getCallerFramePointer(callingFrame);
    callingFrame = Magic.getCallerFramePointer(callingFrame);
    Address location = callingFrame.minus((LAST_NONVOLATILE_FPR.value() - FIRST_VOLATILE_FPR.value() + 1) * BYTES_IN_DOUBLE + (LAST_NONVOLATILE_GPR.value() - FIRST_VOLATILE_GPR.value() + 1) * BYTES_IN_ADDRESS);
    return Magic.addressAsObject(location.loadAddress());
}
Also used : Address(org.vmmagic.unboxed.Address) NoInline(org.vmmagic.pragma.NoInline)

Example 20 with NoInline

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

the class RVMThread method yieldpointFromEpilogue.

/**
 * Yieldpoint taken in epilogue.
 */
@BaselineSaveLSRegisters
// Save all non-volatile registers in prologue
@NoOptCompile
@NoInline
// TODO fix this -- related to SaveVolatile
@Entrypoint
@Unpreemptible("Becoming another thread interrupts the current thread, avoid preemption in the process")
public static void yieldpointFromEpilogue() {
    Address fp = Magic.getFramePointer();
    yieldpoint(EPILOGUE, fp);
}
Also used : Address(org.vmmagic.unboxed.Address) Unpreemptible(org.vmmagic.pragma.Unpreemptible) Entrypoint(org.vmmagic.pragma.Entrypoint) BaselineSaveLSRegisters(org.vmmagic.pragma.BaselineSaveLSRegisters) NoInline(org.vmmagic.pragma.NoInline) NoOptCompile(org.vmmagic.pragma.NoOptCompile)

Aggregations

NoInline (org.vmmagic.pragma.NoInline)46 Entrypoint (org.vmmagic.pragma.Entrypoint)23 Address (org.vmmagic.unboxed.Address)22 Unpreemptible (org.vmmagic.pragma.Unpreemptible)10 TIB (org.jikesrvm.objectmodel.TIB)9 Interruptible (org.vmmagic.pragma.Interruptible)9 RVMArray (org.jikesrvm.classloader.RVMArray)8 Word (org.vmmagic.unboxed.Word)6 NoOptCompile (org.vmmagic.pragma.NoOptCompile)5 Offset (org.vmmagic.unboxed.Offset)5 MethodReference (org.jikesrvm.classloader.MethodReference)4 CodeArray (org.jikesrvm.compilers.common.CodeArray)4 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)4 AbstractRegisters (org.jikesrvm.architecture.AbstractRegisters)3 RVMMethod (org.jikesrvm.classloader.RVMMethod)3 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)3 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)3 BaselineSaveLSRegisters (org.vmmagic.pragma.BaselineSaveLSRegisters)3 RVMType (org.jikesrvm.classloader.RVMType)2 RVMThread (org.jikesrvm.scheduler.RVMThread)2