Search in sources :

Example 66 with CompiledMethod

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);
}
Also used : Address(org.vmmagic.unboxed.Address) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod)

Example 67 with CompiledMethod

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);
    }
}
Also used : CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) RVMClass(org.jikesrvm.classloader.RVMClass)

Example 68 with CompiledMethod

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);
    }
}
Also used : CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)

Example 69 with CompiledMethod

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;
}
Also used : CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod)

Example 70 with CompiledMethod

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);
}
Also used : Address(org.vmmagic.unboxed.Address) RVMThread(org.jikesrvm.scheduler.RVMThread) RVMType(org.jikesrvm.classloader.RVMType) Entrypoint(org.vmmagic.pragma.Entrypoint) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Offset(org.vmmagic.unboxed.Offset) Unpreemptible(org.vmmagic.pragma.Unpreemptible)

Aggregations

CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)97 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)56 NormalMethod (org.jikesrvm.classloader.NormalMethod)41 Test (org.junit.Test)33 OptOptions (org.jikesrvm.compilers.opt.OptOptions)32 Address (org.vmmagic.unboxed.Address)30 DefaultInlineOracle (org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle)28 InlineOracle (org.jikesrvm.compilers.opt.inlining.InlineOracle)28 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)20 Offset (org.vmmagic.unboxed.Offset)20 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)19 InlineSequence (org.jikesrvm.compilers.opt.inlining.InlineSequence)17 RVMMethod (org.jikesrvm.classloader.RVMMethod)14 ExceptionHandlerBasicBlockBag (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag)14 TypeReference (org.jikesrvm.classloader.TypeReference)13 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)13 ExceptionHandlerBasicBlock (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)13 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)13 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)10 RVMClass (org.jikesrvm.classloader.RVMClass)7