use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class OptExecutionStateExtractor method walkOnStack.
/* walk on stack frame, print out methods
*/
private static void walkOnStack(byte[] stack, Offset fpOffset) {
int cmid = STACKFRAME_SENTINEL_FP.toInt();
do {
cmid = Magic.getIntAtOffset(stack, fpOffset.plus(STACKFRAME_METHOD_ID_OFFSET));
if (cmid == INVISIBLE_METHOD_ID) {
VM.sysWriteln(" invisible method ");
} else {
CompiledMethod cm = CompiledMethods.getCompiledMethod(cmid);
VM.sysWriteln(cm.getMethod().toString());
}
VM.disableGC();
Address callerfp = Magic.objectAsAddress(stack).loadAddress(fpOffset.plus(STACKFRAME_FRAME_POINTER_OFFSET));
fpOffset = callerfp.diff(Magic.objectAsAddress(stack));
VM.enableGC();
} while (cmid != STACKFRAME_SENTINEL_FP.toInt());
}
use of org.vmmagic.unboxed.Address 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;
}
use of org.vmmagic.unboxed.Address 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);
}
use of org.vmmagic.unboxed.Address 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);
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class RVMThread method copyStack.
/**
* Initialize a new stack with the live portion of the stack we're currently
* running on.
*
* <pre>
* lo-mem hi-mem
* |<---myDepth----|
* +----------+---------------+
* | empty | live |
* +----------+---------------+
* ˆmyStack ˆmyFP ˆmyTop
* +-------------------+---------------+
* | empty | live |
* +-------------------+---------------+
* ˆnewStack ˆnewFP ˆnewTop
* </pre>
*
* @param newStack space for the new stack
* @return offset that needs to be applied to all interior references of
* the new stack
*/
private static Offset copyStack(byte[] newStack) {
RVMThread myThread = getCurrentThread();
byte[] myStack = myThread.stack;
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);
//
if (VM.VerifyAssertions) {
VM._assert(newFP.GE(Magic.objectAsAddress(newStack).plus(StackFrameLayout.getStackSizeGuard())));
}
Memory.memcopy(newFP, myFP, myDepth.toWord().toExtent());
return newFP.diff(myFP);
}
Aggregations