Search in sources :

Example 1 with InsertMethodInvocationCounter

use of org.jikesrvm.adaptive.recompilation.instrumentation.InsertMethodInvocationCounter in project JikesRVM by JikesRVM.

the class OptimizationPlanner method HIROptimizations.

/**
 * This method defines the optimization plan elements that
 * are to be performed on the HIR.
 *
 * @param p the plan under construction
 */
private static void HIROptimizations(ArrayList<OptimizationPlanElement> p) {
    // Various large-scale CFG transformations.
    // Do these very early in the pipe so that all HIR opts can benefit.
    composeComponents(p, "CFG Transformations", new Object[] { // tail recursion elimination
    new TailRecursionElimination(), // Assumption: none of these are active at O0.
    new OptimizationPlanCompositeElement("Basic Block Frequency Estimation", new Object[] { new BuildLST(), new EstimateBlockFrequencies() }) {

        @Override
        public boolean shouldPerform(OptOptions options) {
            return options.getOptLevel() >= 1;
        }
    }, // CFG splitting
    new StaticSplitting(), // restructure loops
    new CFGTransformations(), // Loop unrolling
    new LoopUnrolling(), new BranchOptimizations(1, true, true) });
    // Use the LST to insert yieldpoints and estimate
    // basic block frequency from branch probabilities
    composeComponents(p, "CFG Structural Analysis", new Object[] { new BuildLST(), new YieldPoints(), new EstimateBlockFrequencies() });
    // Simple flow-insensitive optimizations
    addComponent(p, new Simple(1, true, true, false, false));
    // Simple escape analysis and related transformations
    addComponent(p, new EscapeTransformations());
    // Perform peephole branch optimizations to clean-up before SSA stuff
    addComponent(p, new BranchOptimizations(1, true, true));
    // SSA meta-phase
    SSAinHIR(p);
    // Perform local copy propagation for a factored basic block.
    addComponent(p, new LocalCopyProp());
    // Perform local constant propagation for a factored basic block.
    addComponent(p, new LocalConstantProp());
    // Perform local common-subexpression elimination for a
    // factored basic block.
    addComponent(p, new LocalCSE(true));
    // Flow-insensitive field analysis
    addComponent(p, new FieldAnalysis());
    if (VM.BuildForAdaptiveSystem) {
        // Insert counter on each method prologue
        // Insert yieldpoint counters
        addComponent(p, new InsertYieldpointCounters());
        // Insert counter on each HIR instruction
        addComponent(p, new InsertInstructionCounters());
        // Insert method invocation counters
        addComponent(p, new InsertMethodInvocationCounter());
    }
}
Also used : CFGTransformations(org.jikesrvm.compilers.opt.controlflow.CFGTransformations) LocalCopyProp(org.jikesrvm.compilers.opt.LocalCopyProp) EstimateBlockFrequencies(org.jikesrvm.compilers.opt.controlflow.EstimateBlockFrequencies) InsertMethodInvocationCounter(org.jikesrvm.adaptive.recompilation.instrumentation.InsertMethodInvocationCounter) OptOptions(org.jikesrvm.compilers.opt.OptOptions) BuildLST(org.jikesrvm.compilers.opt.controlflow.BuildLST) EscapeTransformations(org.jikesrvm.compilers.opt.escape.EscapeTransformations) LoopUnrolling(org.jikesrvm.compilers.opt.controlflow.LoopUnrolling) StaticSplitting(org.jikesrvm.compilers.opt.controlflow.StaticSplitting) Simple(org.jikesrvm.compilers.opt.Simple) LocalCSE(org.jikesrvm.compilers.opt.LocalCSE) InsertYieldpointCounters(org.jikesrvm.adaptive.recompilation.instrumentation.InsertYieldpointCounters) YieldPoints(org.jikesrvm.compilers.opt.controlflow.YieldPoints) FieldAnalysis(org.jikesrvm.compilers.opt.FieldAnalysis) TailRecursionElimination(org.jikesrvm.compilers.opt.controlflow.TailRecursionElimination) LocalConstantProp(org.jikesrvm.compilers.opt.LocalConstantProp) InsertInstructionCounters(org.jikesrvm.adaptive.recompilation.instrumentation.InsertInstructionCounters) BranchOptimizations(org.jikesrvm.compilers.opt.controlflow.BranchOptimizations)

Aggregations

InsertInstructionCounters (org.jikesrvm.adaptive.recompilation.instrumentation.InsertInstructionCounters)1 InsertMethodInvocationCounter (org.jikesrvm.adaptive.recompilation.instrumentation.InsertMethodInvocationCounter)1 InsertYieldpointCounters (org.jikesrvm.adaptive.recompilation.instrumentation.InsertYieldpointCounters)1 FieldAnalysis (org.jikesrvm.compilers.opt.FieldAnalysis)1 LocalCSE (org.jikesrvm.compilers.opt.LocalCSE)1 LocalConstantProp (org.jikesrvm.compilers.opt.LocalConstantProp)1 LocalCopyProp (org.jikesrvm.compilers.opt.LocalCopyProp)1 OptOptions (org.jikesrvm.compilers.opt.OptOptions)1 Simple (org.jikesrvm.compilers.opt.Simple)1 BranchOptimizations (org.jikesrvm.compilers.opt.controlflow.BranchOptimizations)1 BuildLST (org.jikesrvm.compilers.opt.controlflow.BuildLST)1 CFGTransformations (org.jikesrvm.compilers.opt.controlflow.CFGTransformations)1 EstimateBlockFrequencies (org.jikesrvm.compilers.opt.controlflow.EstimateBlockFrequencies)1 LoopUnrolling (org.jikesrvm.compilers.opt.controlflow.LoopUnrolling)1 StaticSplitting (org.jikesrvm.compilers.opt.controlflow.StaticSplitting)1 TailRecursionElimination (org.jikesrvm.compilers.opt.controlflow.TailRecursionElimination)1 YieldPoints (org.jikesrvm.compilers.opt.controlflow.YieldPoints)1 EscapeTransformations (org.jikesrvm.compilers.opt.escape.EscapeTransformations)1