Search in sources :

Example 1 with InstrumentedEventCounterManager

use of org.jikesrvm.compilers.opt.InstrumentedEventCounterManager in project JikesRVM by JikesRVM.

the class LowerInstrumentation method lowerInstrumentation.

/**
 * Actually perform the lowering
 *
 * @param ir the governing IR
 */
static void lowerInstrumentation(IR ir) {
    /*
    for (Enumeration<BasicBlock> bbe = ir.getBasicBlocks();
         bbe.hasMoreElements(); ) {
      BasicBlock bb = bbe.nextElement();
      bb.printExtended();
    }
    */
    ArrayList<Instruction> instrumentedInstructions = new ArrayList<Instruction>();
    // enumeration.
    for (Enumeration<BasicBlock> bbe = ir.getBasicBlocks(); bbe.hasMoreElements(); ) {
        BasicBlock bb = bbe.nextElement();
        Instruction i = bb.firstInstruction();
        while (i != null && i != bb.lastInstruction()) {
            if (i.operator() == INSTRUMENTED_EVENT_COUNTER) {
                instrumentedInstructions.add(i);
            }
            i = i.nextInstructionInCodeOrder();
        }
    }
    // the counter manager to convert them into real instructions
    for (final Instruction i : instrumentedInstructions) {
        // Have the counter manager for this data convert this into the
        // actual counting code.  For now, we'll hard code the counter
        // manager.  Ideally it should be stored in the instruction,
        // (to allow multiple counter managers.  It would also make this
        // code independent of the adaptive system..)
        InstrumentedEventCounterManager counterManager = Instrumentation.eventCounterManager;
        counterManager.mutateOptEventCounterInstruction(i, ir);
    }
/*
    for (Enumeration<BasicBlock> bbe = ir.getBasicBlocks();
         bbe.hasMoreElements(); ) {
      BasicBlock bb = bbe.nextElement();
      bb.printExtended();
    }
    */
}
Also used : ArrayList(java.util.ArrayList) BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) InstrumentedEventCounterManager(org.jikesrvm.compilers.opt.InstrumentedEventCounterManager)

Aggregations

ArrayList (java.util.ArrayList)1 InstrumentedEventCounterManager (org.jikesrvm.compilers.opt.InstrumentedEventCounterManager)1 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)1 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)1