use of org.vmmagic.pragma.Entrypoint in project JikesRVM by JikesRVM.
the class MemoryManager method modifyCheck.
/**
*********************************************************************
*
* Write barriers
*/
/**
* Checks that if a garbage collection is in progress then the given
* object is not movable. If it is movable error messages are
* logged and the system exits.
*
* @param object the object to check
*/
@Entrypoint
public static void modifyCheck(Object object) {
/* Make sure that during GC, we don't update on a possibly moving object.
Such updates are dangerous because they can be lost.
*/
if (Plan.gcInProgressProper()) {
ObjectReference ref = ObjectReference.fromObject(object);
if (Space.isMovable(ref)) {
VM.sysWriteln("GC modifying a potentially moving object via Java (i.e. not magic)");
VM.sysWriteln(" obj = ", ref);
RVMType t = Magic.getObjectType(object);
VM.sysWrite(" type = ");
VM.sysWriteln(t.getDescriptor());
VM.sysFail("GC modifying a potentially moving object via Java (i.e. not magic)");
}
}
}
use of org.vmmagic.pragma.Entrypoint in project JikesRVM by JikesRVM.
the class JNIEnvironment method entryToJNI.
/**
* Save data and perform necessary conversions for entry into JNI.
* NB only used for Intel.
*
* @param encodedReferenceOffsets
* bit mask marking which elements on the stack hold objects that need
* encoding as JNI ref identifiers
*/
@Uninterruptible("Objects on the stack won't be recognized by GC, therefore don't allow GC")
@Entrypoint
public void entryToJNI(int encodedReferenceOffsets) {
// Save processor
savedTRreg = Magic.getThreadRegister();
// Save frame pointer of calling routine, once so that native stack frames
// are skipped and once for use by GC
Address callersFP = Magic.getCallerFramePointer(Magic.getFramePointer());
// NB old value saved on call stack
basePointerOnEntryToNative = callersFP;
JNITopJavaFP = callersFP;
if (VM.traceJNI) {
RVMMethod m = CompiledMethods.getCompiledMethod(Magic.getCompiledMethodID(callersFP)).getMethod();
VM.sysWrite("calling JNI from ");
VM.sysWrite(m.getDeclaringClass().getDescriptor());
VM.sysWrite(" ");
VM.sysWrite(m.getName());
VM.sysWrite(m.getDescriptor());
VM.sysWriteln();
}
// Save current JNI ref stack pointer
if (JNIRefsTop > 0) {
uninterruptiblePushJNIRef(Address.fromIntSignExtend(JNIRefsSavedFP), false);
JNIRefsSavedFP = JNIRefsTop;
}
// Convert arguments on stack from objects to JNI references
Address fp = Magic.getFramePointer();
Offset argOffset = Offset.fromIntSignExtend(5 * BYTES_IN_ADDRESS);
fp.store(uninterruptiblePushJNIRef(fp.loadAddress(argOffset), true), argOffset);
while (encodedReferenceOffsets != 0) {
argOffset = argOffset.plus(BYTES_IN_ADDRESS);
if ((encodedReferenceOffsets & 1) != 0) {
fp.store(uninterruptiblePushJNIRef(fp.loadAddress(argOffset), true), argOffset);
}
encodedReferenceOffsets >>>= 1;
}
// Transition processor from IN_JAVA to IN_JNI
RVMThread.enterJNIFromCallIntoNative();
}
use of org.vmmagic.pragma.Entrypoint in project JikesRVM by JikesRVM.
the class OptSaveVolatile method resolve.
/**
* Wrapper to save/restore volatile registers when a class needs to be
* dynamically loaded/resolved/etc.
*/
@Entrypoint
@Interruptible
public static void resolve() throws NoClassDefFoundError {
VM.disableGC();
// (1) Get the compiled method & compilerInfo for the (opt)
// compiled method that called resolve
Address fp = Magic.getCallerFramePointer(Magic.getFramePointer());
int cmid = Magic.getCompiledMethodID(fp);
OptCompiledMethod cm = (OptCompiledMethod) CompiledMethods.getCompiledMethod(cmid);
// (2) Get the return address
Address ip = Magic.getReturnAddressUnchecked(Magic.getFramePointer());
Offset offset = cm.getInstructionOffset(ip);
VM.enableGC();
// (3) Call the routine in OptLinker that does all the real work.
OptLinker.resolveDynamicLink(cm, offset);
}
use of org.vmmagic.pragma.Entrypoint in project JikesRVM by JikesRVM.
the class OptSaveVolatile method yieldpointFromEpilogue.
/**
* Handle timer interrupt taken in method epilogue.
* This method is identical to the yieldpointFromEpilogue()
* method used by the baseline compiler, except in the OPT compiler world,
* we also save the volatile registers.
*/
@Entrypoint
public static void yieldpointFromEpilogue() {
Address fp = Magic.getFramePointer();
RVMThread.yieldpoint(RVMThread.EPILOGUE, fp);
}
use of org.vmmagic.pragma.Entrypoint in project JikesRVM by JikesRVM.
the class OptSaveVolatile method yieldpointFromPrologue.
/**
* Handle timer interrupt taken in method prologue.
* This method is identical to the yieldpointFromPrologue()
* method used by the baseline compiler, except in the OPT compiler world,
* we also save the volatile registers.
*/
@Entrypoint
public static void yieldpointFromPrologue() {
Address fp = Magic.getFramePointer();
RVMThread.yieldpoint(RVMThread.PROLOGUE, fp);
}
Aggregations