org.jikesrvm.adaptive.controller
Class RecompilationStrategy

java.lang.Object
  extended by org.jikesrvm.adaptive.controller.RecompilationStrategy
Direct Known Subclasses:
AnalyticModel

public abstract class RecompilationStrategy
extends Object

An abstract class providing the interface to the decision making component of the controller.


Field Summary
private  OptOptions[] _options
           
private  OptimizationPlanElement[][] _optPlans
           
 
Constructor Summary
RecompilationStrategy()
           
 
Method Summary
(package private)  boolean considerForRecompilation(HotMethodEvent hme, ControllerPlan plan)
          Should we consider the hme for recompilation?
(package private)  void considerHotCallEdge(CompiledMethod cmpMethod, AINewHotEdgeEvent event)
          A hot call edge has been passed to the controller by an organizer
(package private)  ControllerPlan considerHotMethod(CompiledMethod cmpMethod, HotMethodEvent hme)
          A hot method has been passed to the controller by an organizer
 CompilationPlan createCompilationPlan(NormalMethod method, int optLevel, InstrumentationPlan instPlan)
          Construct a compilation plan that will compile the given method with instrumentation.
(package private)  ControllerPlan createControllerPlan(RVMMethod method, int optLevel, InstrumentationPlan instPlan, int prevCMID, double expectedSpeedup, double expectedCompilationTime, double priority)
          This helper method creates a ControllerPlan, which contains a CompilationPlan, for the passed method using the passed optimization level and instrumentation plan.
(package private)  void createOptimizationPlans()
          Create the default set of pairs Process optimizing compiler command line options.
(package private)  int getMaxOptLevel()
          What is the maximum opt level that is vallid according to this strategy?
(package private)  int getPreviousCompiler(CompiledMethod cmpMethod)
          This method retrieves the previous compiler constant.
(package private)  void init()
          Initialize the recompilation strategy.
(package private)  boolean previousRecompilationAttempted(RVMMethod method)
          This method returns true if we've already tried to recompile the passed method.
static void processCommandLineOptions(OptOptions options, int optLevel, int maxOptLevel, String[] optCompilerOptions)
          Process the command line arguments and pass the appropriate ones to the Options Called by sampling and counters recompilation strategy.
private  void transferSamplesToNewPlan(HotMethodEvent hme)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_optPlans

private OptimizationPlanElement[][] _optPlans

_options

private OptOptions[] _options
Constructor Detail

RecompilationStrategy

public RecompilationStrategy()
Method Detail

considerHotMethod

ControllerPlan considerHotMethod(CompiledMethod cmpMethod,
                                 HotMethodEvent hme)
A hot method has been passed to the controller by an organizer


considerHotCallEdge

void considerHotCallEdge(CompiledMethod cmpMethod,
                         AINewHotEdgeEvent event)
A hot call edge has been passed to the controller by an organizer


init

void init()
Initialize the recompilation strategy.

Note: This uses the command line options to set up the optimization plans, so this must be run after the command line options are available.


createControllerPlan

ControllerPlan createControllerPlan(RVMMethod method,
                                    int optLevel,
                                    InstrumentationPlan instPlan,
                                    int prevCMID,
                                    double expectedSpeedup,
                                    double expectedCompilationTime,
                                    double priority)
This helper method creates a ControllerPlan, which contains a CompilationPlan, for the passed method using the passed optimization level and instrumentation plan.

Parameters:
method - the RVMMethod for the plan
optLevel - the optimization level to use in the plan
instPlan - the instrumentation plan to use
prevCMID - the previous compiled method ID
expectedSpeedup - expected speedup from this recompilation
priority - a measure of the oveall benefit we expect to see by executing this plan.
Returns:
the compilation plan to be used

createCompilationPlan

public CompilationPlan createCompilationPlan(NormalMethod method,
                                             int optLevel,
                                             InstrumentationPlan instPlan)
Construct a compilation plan that will compile the given method with instrumentation.

Parameters:
method - The method to be compiled with instrumentation
optLevel - The opt-level to recompile at
instPlan - The instrumentation plan

considerForRecompilation

boolean considerForRecompilation(HotMethodEvent hme,
                                 ControllerPlan plan)
Should we consider the hme for recompilation?

Parameters:
hme - the HotMethodEvent
plan - the ControllerPlan for the compiled method (may be null)
Returns:
true/false value

transferSamplesToNewPlan

private void transferSamplesToNewPlan(HotMethodEvent hme)

previousRecompilationAttempted

boolean previousRecompilationAttempted(RVMMethod method)
This method returns true if we've already tried to recompile the passed method. It does not guarantee that the compilation was successful.

Parameters:
method - the method of interest
Returns:
whether we've tried to recompile this method

getPreviousCompiler

int getPreviousCompiler(CompiledMethod cmpMethod)
This method retrieves the previous compiler constant.


getMaxOptLevel

int getMaxOptLevel()
What is the maximum opt level that is vallid according to this strategy?


createOptimizationPlans

void createOptimizationPlans()
Create the default set of pairs Process optimizing compiler command line options.


processCommandLineOptions

public static void processCommandLineOptions(OptOptions options,
                                             int optLevel,
                                             int maxOptLevel,
                                             String[] optCompilerOptions)
Process the command line arguments and pass the appropriate ones to the Options Called by sampling and counters recompilation strategy.

Parameters:
options - The options being constructed
optLevel - The level of the options being constructed
maxOptLevel - The maximum valid opt level
optCompilerOptions - The list of command line options