org.jikesrvm.adaptive.controller
Class ControllerPlan

java.lang.Object
  extended by org.jikesrvm.adaptive.controller.ControllerPlan

public final class ControllerPlan
extends Object

An instance of this class describes a compilation decision made by the controller.

Constraints: Given the plan list of a method:

status states:

 UNINITIALIZED -> IN_PROGRESS -> COMPLETED -> OUTDATED
             \              \--> ABORTED_COMPILATION_ERROR (never recompile method)
 


Field Summary
static byte ABORTED_COMPILATION_ERROR
          Compilation for the method was begun, but failed in an error
private  int CMID
          The compiled method ID for this plan
static byte COMPLETED
          The plan was successfully completed, i.e., the method was recompiled
private  CompilationPlan compPlan
          The associate compilation plan
private  double expectedCompilationTime
          The compilation time we were expecting
private  double expectedSpeedup
          The speedup we were expecting
static byte IN_PROGRESS
          The compilation is still in progress
static byte OSR_BASE_2_OPT
          The compilation plan is for a promotion from BASE to OPT
static byte OUTDATED
          The compilation completed, but a new plan for the same method also completed, so this is not the most recent completed plan
private  LinkedList<ControllerPlan> planList
          The list that we are onstatus of this plan
private  int prevCMID
          The compiled method ID for the previous plan for this method
private  double priority
          The priority associated with this plan
private  byte status
          The status of this plan
private  int timeCompleted
          The time compilation end
private  int timeCreated
          The time we created this plan
private  int timeInitiated
          The time compilation began
static byte UNINITIALIZED
          The plan was created, but the setStatus method was never called
static byte UNKNOWN
          This is used by clients to initialize local variables for Java semantics
 
Constructor Summary
ControllerPlan(CompilationPlan compPlan, int timeCreated, int prevCMID, double expectedSpeedup, double expectedCompilationTime, double priority)
          Construct a controller plan
 
Method Summary
 CompiledMethod doRecompile()
          This method will recompile the method designated by the controller plan getCompPlan().
 boolean execute()
          Execute the plan.
 int getCMID()
          CMID (compiled method id) associated with the code produced by executing this plan
 CompilationPlan getCompPlan()
          The compilation plan
 double getExpectedCompilationTime()
          The expected compilation time for this method
 double getExpectedSpeedup()
          The expected speedup for this method due to this recompilation
 int getPrevCMID()
          CMID (compiled method id) associated with the *PREVIOUS* compiled version of this method
 double getPriority()
          The priority (how important is it that this plan be executed)
 byte getStatus()
          Status of this compilation plan, choose from the values above
 String getStatusString()
           
 int getTimeCompleted()
          The time (according to the controller clock) compilation of this plan completed.
 int getTimeCreated()
          The time this plan was created
 int getTimeInitiated()
          The time (according to the controller clock) compilation of this plan began.
 void setCMID(int x)
           
 void setPlanList(LinkedList<ControllerPlan> list)
          List of plans for a source method
 void setStatus(byte newStatus)
           
 void setTimeCompleted(int t)
           
 void setTimeInitiated(int t)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNINITIALIZED

public static final byte UNINITIALIZED
The plan was created, but the setStatus method was never called

See Also:
Constant Field Values

COMPLETED

public static final byte COMPLETED
The plan was successfully completed, i.e., the method was recompiled

See Also:
Constant Field Values

ABORTED_COMPILATION_ERROR

public static final byte ABORTED_COMPILATION_ERROR
Compilation for the method was begun, but failed in an error

See Also:
Constant Field Values

IN_PROGRESS

public static final byte IN_PROGRESS
The compilation is still in progress

See Also:
Constant Field Values

OUTDATED

public static final byte OUTDATED
The compilation completed, but a new plan for the same method also completed, so this is not the most recent completed plan

See Also:
Constant Field Values

OSR_BASE_2_OPT

public static final byte OSR_BASE_2_OPT
The compilation plan is for a promotion from BASE to OPT

See Also:
Constant Field Values

UNKNOWN

public static final byte UNKNOWN
This is used by clients to initialize local variables for Java semantics

See Also:
Constant Field Values

compPlan

private CompilationPlan compPlan
The associate compilation plan


timeCreated

private int timeCreated
The time we created this plan


timeInitiated

private int timeInitiated
The time compilation began


timeCompleted

private int timeCompleted
The time compilation end


expectedSpeedup

private double expectedSpeedup
The speedup we were expecting


expectedCompilationTime

private double expectedCompilationTime
The compilation time we were expecting


priority

private double priority
The priority associated with this plan


CMID

private int CMID
The compiled method ID for this plan


prevCMID

private int prevCMID
The compiled method ID for the previous plan for this method


status

private byte status
The status of this plan


planList

private LinkedList<ControllerPlan> planList
The list that we are onstatus of this plan

Constructor Detail

ControllerPlan

public ControllerPlan(CompilationPlan compPlan,
                      int timeCreated,
                      int prevCMID,
                      double expectedSpeedup,
                      double expectedCompilationTime,
                      double priority)
Construct a controller plan

Parameters:
compPlan - The compilation plan
timeCreated - The "time" this plan was created
prevCMID - The previous compiled method ID
expectedSpeedup - Expected recompilation benefit
expectedCompilationTime - Expected recompilation cost
priority - How important is executing this plan?
Method Detail

execute

public boolean execute()
Execute the plan.

Returns:
true on success, false on failure

doRecompile

public CompiledMethod doRecompile()
This method will recompile the method designated by the controller plan getCompPlan(). It also
  1. credits the samples associated with the old compiled method ID to the new method ID and clears the old value.
  2. clears inlining information
  3. updates the status of the controller plan


getCompPlan

public CompilationPlan getCompPlan()
The compilation plan


getExpectedSpeedup

public double getExpectedSpeedup()
The expected speedup for this method due to this recompilation


getExpectedCompilationTime

public double getExpectedCompilationTime()
The expected compilation time for this method


getPriority

public double getPriority()
The priority (how important is it that this plan be executed)


getTimeCreated

public int getTimeCreated()
The time this plan was created


getTimeInitiated

public int getTimeInitiated()
The time (according to the controller clock) compilation of this plan began.


setTimeInitiated

public void setTimeInitiated(int t)

getTimeCompleted

public int getTimeCompleted()
The time (according to the controller clock) compilation of this plan completed.


setTimeCompleted

public void setTimeCompleted(int t)

getCMID

public int getCMID()
CMID (compiled method id) associated with the code produced by executing this plan


setCMID

public void setCMID(int x)

getPrevCMID

public int getPrevCMID()
CMID (compiled method id) associated with the *PREVIOUS* compiled version of this method


getStatus

public byte getStatus()
Status of this compilation plan, choose from the values above


setStatus

public void setStatus(byte newStatus)

setPlanList

public void setPlanList(LinkedList<ControllerPlan> list)
List of plans for a source method


getStatusString

public String getStatusString()

toString

public String toString()
Overrides:
toString in class Object