use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.
the class OptTestHarness method compiledMethodMessage.
static String compiledMethodMessage(NormalMethod method) {
CompiledMethod cm = method.getCurrentCompiledMethod();
Address addr = Magic.objectAsAddress(cm.getEntryCodeArray());
return "Method: " + method + " compiled code: " + addrToString(addr);
}
use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.
the class ClassLoadingDependencyManager method handleSubclassing.
private void handleSubclassing(RVMClass c) {
// nothing to do
if (c.isJavaLangObjectType() || c.isInterface())
return;
RVMClass sc = c.getSuperClass();
Iterator<Integer> invalidatedMethods = db.invalidatedBySubclass(sc);
if (invalidatedMethods != null) {
while (invalidatedMethods.hasNext()) {
int cmid = invalidatedMethods.next();
CompiledMethod im = CompiledMethods.getCompiledMethod(cmid);
if (im != null) {
// im == null implies that the code has been GCed already
invalidate(im);
}
}
db.removeNoSubclassDependency(sc);
}
}
use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.
the class ClassLoadingDependencyManager method processOverride.
private void processOverride(RVMMethod overridden) {
Iterator<Integer> invalidatedMethods = db.invalidatedByOverriddenMethod(overridden);
if (invalidatedMethods != null) {
while (invalidatedMethods.hasNext()) {
int cmid = invalidatedMethods.next();
CompiledMethod im = CompiledMethods.getCompiledMethod(cmid);
if (im != null) {
// im == null implies that the code has been GCed already
invalidate(im);
}
}
db.removeNotOverriddenDependency(overridden);
}
}
use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.
the class OptimizingBootImageCompiler method baselineCompile.
private CompiledMethod baselineCompile(NormalMethod method) {
Callbacks.notifyMethodCompile(method, CompiledMethod.BASELINE);
CompiledMethod cm = BaselineCompiler.compile(method);
/* We can't accurately measure compilation time on Host JVM, so just approximate with DNA */
cm.setCompilationTime((float) CompilerDNA.estimateCompileTime(CompilerDNA.BASELINE, method));
return cm;
}
use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.
the class RuntimeEntrypoints method deliverException.
/**
* Deliver an exception to current java thread.
* <STRONG> Precondition: </STRONG> VM.disableGC has already been called.
* <ol>
* <li> exceptionRegisters may not match any reasonable stack
* frame at this point.
* <li> we're going to be playing with raw addresses (fp, ip).
* </ol>
* <p>
* Does not return:
* <ul>
* <li> stack is unwound and execution resumes in a catch block
* <li> <em> or </em> current thread is terminated if no catch block is found
* </ul>
*
* @param exceptionObject exception object to deliver
* @param exceptionRegisters register state corresponding to exception site
*/
@Unpreemptible("Deliver exception trying to avoid preemption")
private static void deliverException(Throwable exceptionObject, AbstractRegisters exceptionRegisters) {
if (VM.TraceExceptionDelivery) {
VM.sysWriteln("RuntimeEntrypoints.deliverException() entered; just got an exception object.");
}
//
if (VM.TraceExceptionDelivery) {
VM.sysWrite("Hunting for a catch block...");
}
RVMType exceptionType = Magic.getObjectType(exceptionObject);
Address fp = exceptionRegisters.getInnermostFramePointer();
Address hijackedCalleeFp = RVMThread.getCurrentThread().getHijackedReturnCalleeFp();
boolean leapfroggedReturnBarrier = false;
if (VM.VerifyAssertions)
VM._assert(hijackedCalleeFp.isZero() || hijackedCalleeFp.GE(fp));
while (Magic.getCallerFramePointer(fp).NE(StackFrameLayout.getStackFrameSentinelFP())) {
if (!hijackedCalleeFp.isZero() && hijackedCalleeFp.LE(fp)) {
leapfroggedReturnBarrier = true;
}
int compiledMethodId = Magic.getCompiledMethodID(fp);
if (compiledMethodId != StackFrameLayout.getInvisibleMethodID()) {
CompiledMethod compiledMethod = CompiledMethods.getCompiledMethod(compiledMethodId);
ExceptionDeliverer exceptionDeliverer = compiledMethod.getExceptionDeliverer();
Address ip = exceptionRegisters.getInnermostInstructionAddress();
Offset ipOffset = compiledMethod.getInstructionOffset(ip);
int catchBlockOffset = compiledMethod.findCatchBlockForInstruction(ipOffset, exceptionType);
if (catchBlockOffset >= 0) {
// found an appropriate catch block
if (VM.TraceExceptionDelivery) {
VM.sysWriteln("found one; delivering.");
}
if (leapfroggedReturnBarrier) {
RVMThread t = RVMThread.getCurrentThread();
if (RVMThread.DEBUG_STACK_TRAMPOLINE)
VM.sysWriteln("leapfrogged...");
t.deInstallStackTrampoline();
}
Address catchBlockStart = compiledMethod.getInstructionAddress(Offset.fromIntSignExtend(catchBlockOffset));
exceptionDeliverer.deliverException(compiledMethod, catchBlockStart, exceptionObject, exceptionRegisters);
if (VM.VerifyAssertions)
VM._assert(NOT_REACHED);
}
exceptionDeliverer.unwindStackFrame(compiledMethod, exceptionRegisters);
} else {
unwindInvisibleStackFrame(exceptionRegisters);
}
fp = exceptionRegisters.getInnermostFramePointer();
}
if (VM.TraceExceptionDelivery) {
VM.sysWriteln("Nope.");
VM.sysWriteln("RuntimeEntrypoints.deliverException() found no catch block.");
}
/* No appropriate catch block found. */
if (RVMThread.DEBUG_STACK_TRAMPOLINE && leapfroggedReturnBarrier)
VM.sysWriteln("Leapfrogged, and unhandled!");
handleUncaughtException(exceptionObject);
}
Aggregations