org.jikesrvm.compilers.opt.driver
Class OptimizationPlanAtomicElement

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanElement
      extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanAtomicElement

public final class OptimizationPlanAtomicElement
extends OptimizationPlanElement

An element in the opt compiler's optimization plan that consists of a single CompilerPhase.

NOTE: Instances of this class are held in OptimizationPlanner.masterPlan and thus represent global state. It is therefore incorrect for any per-compilation state to be stored in an instance field of one of these objects.


Field Summary
 double counter1
          Counters to be used by myPhase to gather phase specific stats.
 double counter2
          Counters to be used by myPhase to gather phase specific stats.
private  CompilerPhase myPhase
          The phase to be performed.
protected  long phaseNanos
          Accumulated nanoseconds spent in the element.
 
Constructor Summary
OptimizationPlanAtomicElement(CompilerPhase p)
          Create a plan element corresponding to a particular compiler phase.
 
Method Summary
 double elapsedTime()
          Report the elapsed time spent in the PlanElement
 String getName()
           
 void initializeForMeasureCompilation()
          Update this phase to support the measuring of compilation
 void perform(IR ir)
          Do the work represented by this element in the optimization plan.
 void reportStats(int indent, int timeCol, double totalTime)
          Generate (to the sysWrite stream) a report of the time spent performing this element of the optimization plan.
 boolean shouldPerform(OptOptions options)
          Determine, possibly by consulting the passed options object, if this optimization plan element should be performed.
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.OptimizationPlanElement
prettyPrintTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myPhase

private final CompilerPhase myPhase
The phase to be performed.


phaseNanos

protected long phaseNanos
Accumulated nanoseconds spent in the element.


counter1

public double counter1
Counters to be used by myPhase to gather phase specific stats.


counter2

public double counter2
Counters to be used by myPhase to gather phase specific stats.

Constructor Detail

OptimizationPlanAtomicElement

public OptimizationPlanAtomicElement(CompilerPhase p)
Create a plan element corresponding to a particular compiler phase.

Parameters:
p -
Method Detail

initializeForMeasureCompilation

public void initializeForMeasureCompilation()
Update this phase to support the measuring of compilation

Specified by:
initializeForMeasureCompilation in class OptimizationPlanElement

shouldPerform

public boolean shouldPerform(OptOptions options)
Description copied from class: OptimizationPlanElement
Determine, possibly by consulting the passed options object, if this optimization plan element should be performed.

Specified by:
shouldPerform in class OptimizationPlanElement
Parameters:
options - The Options object for the current compilation.
Returns:
true if the plan element should be performed.

perform

public void perform(IR ir)
Description copied from class: OptimizationPlanElement
Do the work represented by this element in the optimization plan. The assumption is that the work will modify the IR in some way.

Specified by:
perform in class OptimizationPlanElement
Parameters:
ir - The IR object to work with.

getName

public String getName()
Specified by:
getName in class OptimizationPlanElement
Returns:
a String which is the name of the phase.

reportStats

public void reportStats(int indent,
                        int timeCol,
                        double totalTime)
Description copied from class: OptimizationPlanElement
Generate (to the sysWrite stream) a report of the time spent performing this element of the optimization plan.

Specified by:
reportStats in class OptimizationPlanElement
Parameters:
indent - Number of spaces to indent report.
timeCol - Column number of time portion of report.
totalTime - Total opt compilation time in seconds.

elapsedTime

public double elapsedTime()
Description copied from class: OptimizationPlanElement
Report the elapsed time spent in the PlanElement

Specified by:
elapsedTime in class OptimizationPlanElement
Returns:
time spend in the plan (in ms)