Search in sources :

Example 41 with CompiledMethod

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

Example 42 with CompiledMethod

use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.

the class OnStackReplacementTrigger method trigger.

@NoInline
@Unpreemptible
public static void trigger(int ypTakenInCMID, Offset tsFromFPoff, Offset ypTakenFPoff, int whereFrom) {
    RVMThread thread = RVMThread.getCurrentThread();
    CompiledMethod ypTakenInCM = CompiledMethods.getCompiledMethod(ypTakenInCMID);
    RVMMethod ypTakenInMethod = ypTakenInCM.getMethod();
    boolean isInBootImage = ypTakenInMethod.getDeclaringClass().isInBootImage();
    if (isInBootImage)
        return;
    OnStackReplacementEvent event = (OnStackReplacementEvent) thread.onStackReplacementEvent;
    event.suspendedThread = thread;
    event.whereFrom = whereFrom;
    event.CMID = ypTakenInCMID;
    event.tsFromFPoff = tsFromFPoff;
    event.ypTakenFPoff = ypTakenFPoff;
    thread.monitor().lockNoHandshake();
    thread.requesting_osr = true;
    thread.monitor().unlock();
    Controller.osrOrganizer.activate();
    // PNT: Assumes that OSR doesn't need access to our context regs
    thread.monitor().lockNoHandshake();
    while (!thread.osr_done) {
        thread.monitor().waitWithHandshake();
    }
    thread.osr_done = false;
    thread.monitor().unlock();
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) RVMThread(org.jikesrvm.scheduler.RVMThread) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Unpreemptible(org.vmmagic.pragma.Unpreemptible) NoInline(org.vmmagic.pragma.NoInline)

Example 43 with CompiledMethod

use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.

the class AINewHotEdgeEvent method process.

/**
 * Called when the controller is ready to process this event.
 * Simply passes itself to the recompilation strategy.
 */
@Override
public void process() {
    CompiledMethod cmpMethod = getCompiledMethod();
    Controller.recompilationStrategy.considerHotCallEdge(cmpMethod, this);
}
Also used : CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod)

Example 44 with CompiledMethod

use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.

the class ControllerMemory method requestedOSR.

/**
 * @return {@code true} iff there is a plan to transition from Base to Opt for a
 * given CMID
 *
 * @param cmid the compiled method's ID
 */
public static synchronized boolean requestedOSR(int cmid) {
    CompiledMethod cm = CompiledMethods.getCompiledMethod(cmid);
    // make sure that the cm in question is baseline-compiled
    if (cm.getCompilerType() != CompiledMethod.BASELINE)
        return false;
    // OK; now check for an OSR plan
    RVMMethod m = cm.getMethod();
    if (m == null)
        return false;
    return planWithStatus(m, ControllerPlan.OSR_BASE_2_OPT);
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod)

Example 45 with CompiledMethod

use of org.jikesrvm.compilers.common.CompiledMethod in project JikesRVM by JikesRVM.

the class RVMClass method initialize.

/**
 * {@inheritDoc}<p>
 *
 * Side effects: superclasses are initialized, static fields receive
 * initial values.
 */
@Override
public synchronized void initialize() throws ExceptionInInitializerError {
    if (isInitialized()) {
        return;
    }
    if (state == CLASS_INITIALIZING) {
        return;
    }
    if (state == CLASS_INITIALIZER_FAILED) {
        throw new NoClassDefFoundError(this + " (initialization failure)");
    }
    if (VM.TraceClassLoading && VM.runningVM)
        VM.sysWriteln("RVMClass: (begin) initialize " + this);
    if (VM.VerifyAssertions)
        VM._assert(state == CLASS_INSTANTIATED);
    state = CLASS_INITIALIZING;
    if (VM.verboseClassLoading)
        VM.sysWriteln("[Initializing " + this + "]");
    // 
    if (superClass != null) {
        superClass.initialize();
    }
    // 
    if (classInitializerMethod != null) {
        CompiledMethod cm = classInitializerMethod.getCurrentCompiledMethod();
        while (cm == null) {
            classInitializerMethod.compile();
            cm = classInitializerMethod.getCurrentCompiledMethod();
        }
        if (VM.verboseClassLoading)
            VM.sysWriteln("[Running static initializer for " + this + "]");
        try {
            Magic.invokeClassInitializer(cm.getEntryCodeArray());
        } catch (Error e) {
            state = CLASS_INITIALIZER_FAILED;
            throw e;
        } catch (Throwable t) {
            ExceptionInInitializerError eieio = new ExceptionInInitializerError(t);
            state = CLASS_INITIALIZER_FAILED;
            throw eieio;
        }
        // <clinit> is no longer needed: reclaim space by removing references to it
        classInitializerMethod.invalidateCompiledMethod(cm);
        classInitializerMethod = null;
    }
    if (VM.BuildForOptCompiler) {
        // report that a class is about to be marked initialized to
        // the opt compiler so it can invalidate speculative CHA optimizations
        // before an instance of this class could actually be created.
        classLoadListener.classInitialized(this, false);
    }
    state = CLASS_INITIALIZED;
    Callbacks.notifyClassInitialized(this);
    markFinalFieldsAsLiterals();
    if (VM.verboseClassLoading)
        VM.sysWriteln("[Initialized " + this + "]");
    if (VM.TraceClassLoading && VM.runningVM)
        VM.sysWriteln("RVMClass: (end)   initialize " + this);
}
Also used : CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod)

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