Search in sources :

Example 1 with MethodInvocationCounterData

use of org.jikesrvm.adaptive.measurements.instrumentation.MethodInvocationCounterData in project JikesRVM by JikesRVM.

the class InsertMethodInvocationCounter method perform.

/**
 * Insert basic block counters
 *
 * @param ir the governing IR
 */
@Override
public final void perform(IR ir) {
    // save volatile methods, or when instrumentation is disabled
    if (!ir.method.isInterruptible() || !Instrumentation.instrumentationEnabled() || ir.method.getDeclaringClass().hasSaveVolatileAnnotation()) {
        return;
    }
    BasicBlock firstBB = ir.cfg.entry();
    MethodInvocationCounterData data = AOSDatabase.methodInvocationCounterData;
    int cmid = ir.compiledMethod.getId();
    // Create a dummy instruction that is later converted into an
    // increment of the appropriate CounterArray element.
    Instruction c = data.createEventCounterInstruction(cmid);
    // Insert it at the beginning of the basic block
    firstBB.prependInstructionRespectingPrologue(c);
}
Also used : MethodInvocationCounterData(org.jikesrvm.adaptive.measurements.instrumentation.MethodInvocationCounterData) BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock) Instruction(org.jikesrvm.compilers.opt.ir.Instruction)

Aggregations

MethodInvocationCounterData (org.jikesrvm.adaptive.measurements.instrumentation.MethodInvocationCounterData)1 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)1 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)1