use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.
the class ThinLock method getLockIndex.
/**
* Return the lock index for a given lock word. Assert valid index
* ranges, that the fat lock bit is set, and that the lock entry
* exists.
*
* @param lockWord The lock word whose lock index is being established
* @return the lock index corresponding to the lock workd.
*/
@Inline
@Uninterruptible
public static int getLockIndex(Word lockWord) {
int index = lockWord.and(TL_LOCK_ID_MASK).rshl(TL_LOCK_ID_SHIFT).toInt();
if (VM.VerifyAssertions) {
if (!(index > 0 && index < Lock.numLocks())) {
VM.sysWriteln("Lock index out of range! Word: ", lockWord);
VM.sysWrite(" index: ", index);
VM.sysWrite(" locks: ", Lock.numLocks());
VM.sysWriteln();
}
// index is in range
VM._assert(index > 0 && index < Lock.numLocks());
// fat lock bit is set
VM._assert(lockWord.and(TL_STAT_MASK).EQ(TL_STAT_FAT));
}
return index;
}
use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.
the class RuntimeEntrypoints method unwindNativeStackFrame.
/**
* Skip over all frames below currfp with saved code pointers outside of heap
* (C frames), stopping at the native frame immediately preceding the glue
* frame which contains the method ID of the native method (this is necessary
* to allow retrieving the return address of the glue frame).
*
* @param currfp The current frame is expected to be one of the JNI functions
* called from C, below which is one or more native stack frames
* @return the frame pointer for the appropriate frame
*/
@Uninterruptible
public static Address unwindNativeStackFrame(Address currfp) {
if (VM.BuildForIA32) {
return currfp;
}
// Remembered address of previous FP
Address callee_fp;
// Address of native frame
Address fp = Magic.getCallerFramePointer(currfp);
// Instruction pointer for current native frame
Address ip;
// in one of our heaps
do {
callee_fp = fp;
ip = Magic.getReturnAddressUnchecked(fp);
fp = Magic.getCallerFramePointer(fp);
} while (!MemoryManager.addressInVM(ip) && fp.NE(StackFrameLayout.getStackFrameSentinelFP()));
if (VM.BuildForPowerPC) {
// pointed to by callee_fp which is where the saved ip was actually stored.
return fp;
} else {
return callee_fp;
}
}
use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.
the class StackTrace method recordFramesUninterruptible.
/**
* Walk the stack recording the stack frames encountered
* The stack being walked is our stack, so code is Uninterrupible to stop the
* stack moving.
*
* @param stackTraceThread the thread whose stack is walked
*/
@Uninterruptible
@NoInline
private void recordFramesUninterruptible(RVMThread stackTraceThread) {
int stackFrameCount = 0;
Address fp;
Address ip;
/* Stack trace for the thread */
if (stackTraceThread == RVMThread.getCurrentThread()) {
fp = Magic.getFramePointer();
} else {
AbstractRegisters contextRegisters = stackTraceThread.getContextRegisters();
fp = contextRegisters.getInnermostFramePointer();
}
ip = Magic.getReturnAddress(fp);
fp = Magic.getCallerFramePointer(fp);
while (Magic.getCallerFramePointer(fp).NE(StackFrameLayout.getStackFrameSentinelFP())) {
// VM.sysWriteln("at stackFrameCount = ",stackFrameCount);
int compiledMethodId = Magic.getCompiledMethodID(fp);
compiledMethods[stackFrameCount] = compiledMethodId;
if (compiledMethodId != StackFrameLayout.getInvisibleMethodID()) {
CompiledMethod compiledMethod = CompiledMethods.getCompiledMethod(compiledMethodId);
if (compiledMethod.getCompilerType() != CompiledMethod.TRAP) {
instructionOffsets[stackFrameCount] = compiledMethod.getInstructionOffset(ip).toInt();
if (compiledMethod.hasBridgeFromNativeAnnotation()) {
// VM.sysWriteln("native!");
// skip native frames, stopping at last native frame preceeding the
// Java To C transition frame
fp = RuntimeEntrypoints.unwindNativeStackFrame(fp);
}
} else {
// VM.sysWriteln("trap!");
}
} else {
// VM.sysWriteln("invisible method!");
}
stackFrameCount++;
ip = Magic.getReturnAddress(fp, stackTraceThread);
fp = Magic.getCallerFramePointer(fp);
}
}
use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.
the class Registers method adjustESP.
@Uninterruptible
@Override
public void adjustESP(Offset delta, boolean traceAdjustments) {
Word old = getGPRs().get(FRAME_POINTER.value());
getGPRs().set(FRAME_POINTER.value(), old.plus(delta));
if (traceAdjustments) {
VM.sysWrite(" esp =");
VM.sysWrite(getGPRs().get(FRAME_POINTER.value()));
}
}
use of org.vmmagic.pragma.Uninterruptible in project JikesRVM by JikesRVM.
the class Registers method initializeStack.
/**
* The following method initializes a thread stack as if
* "startoff" method had been called by an empty baseline-compiled
* "sentinel" frame with one local variable
*
* @param ip The instruction pointer for the "startoff" method
* @param sp The base of the stack
*/
@Override
@Uninterruptible
public void initializeStack(Address ip, Address sp) {
Address fp;
// align stack frame
int INITIAL_FRAME_SIZE = STACKFRAME_HEADER_SIZE;
fp = Memory.alignDown(sp.minus(INITIAL_FRAME_SIZE), STACKFRAME_ALIGNMENT);
fp.plus(STACKFRAME_FRAME_POINTER_OFFSET).store(STACKFRAME_SENTINEL_FP);
// need to fix
fp.plus(STACKFRAME_RETURN_ADDRESS_OFFSET).store(ip);
fp.plus(STACKFRAME_METHOD_ID_OFFSET).store(INVISIBLE_METHOD_ID);
getGPRs().set(FRAME_POINTER.value(), fp.toWord());
this.ip = ip;
}
Aggregations