org.jikesrvm.adaptive.controller
Class ControllerMemory

java.lang.Object
  extended by org.jikesrvm.adaptive.controller.ControllerMemory
All Implemented Interfaces:
Constants, HeapLayoutConstants, ThinLockConstants, TIBLayoutConstants, SizeConstants

public final class ControllerMemory
extends Object
implements Constants

This class records decisions taken by the controller. It will remember controller plans, which contain compilation plans and other goodies, and allows searching for previous decisions


Field Summary
private static int awoken
          Number of times controller is awoken
private static int didNothing
          Number of times controller is awoken and did nothing.
private static int numBase
           
private static int numMethodsConsidered
           
private static int numMethodsScheduledForRecomp
           
private static int numOpt0
           
private static int numOpt1
           
private static int numOpt2
           
private static int numOpt3
           
private static int numOpt4
           
private static ImmutableEntryHashMapRVM<RVMMethod,LinkedList<ControllerPlan>> table
          This is a hashtable of controller plans indexed by RVMMethod.
 
Fields inherited from interface org.jikesrvm.Constants
NOT_REACHED, REFLECTION_FPRS_BITS, REFLECTION_FPRS_MASK, REFLECTION_GPRS_BITS, REFLECTION_GPRS_MASK
 
Fields inherited from interface org.jikesrvm.objectmodel.ThinLockConstants
TL_DEDICATED_U16_OFFSET, TL_DEDICATED_U16_SHIFT, TL_LOCK_COUNT_MASK, TL_LOCK_COUNT_SHIFT, TL_LOCK_COUNT_UNIT, TL_LOCK_ID_MASK, TL_LOCK_ID_SHIFT, TL_NUM_BITS_RC, TL_NUM_BITS_STAT, TL_NUM_BITS_TID, TL_STAT_BIASABLE, TL_STAT_FAT, TL_STAT_MASK, TL_STAT_SHIFT, TL_STAT_THIN, TL_THREAD_ID_MASK, TL_THREAD_ID_SHIFT, TL_UNLOCK_MASK
 
Fields inherited from interface org.jikesrvm.SizeConstants
BITS_IN_ADDRESS, BITS_IN_BOOLEAN, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_DOUBLE, BITS_IN_EXTENT, BITS_IN_FLOAT, BITS_IN_INT, BITS_IN_LONG, BITS_IN_OFFSET, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_EXTENT, BYTES_IN_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, BYTES_IN_OFFSET, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BOOLEAN, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_DOUBLE, LOG_BITS_IN_EXTENT, LOG_BITS_IN_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, LOG_BITS_IN_OFFSET, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_BOOLEAN, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_DOUBLE, LOG_BYTES_IN_EXTENT, LOG_BYTES_IN_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_OFFSET, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
Fields inherited from interface org.jikesrvm.objectmodel.TIBLayoutConstants
IMT_METHOD_SLOTS, NEEDS_DYNAMIC_LINK, TIB_ARRAY_ELEMENT_TIB_INDEX, TIB_DOES_IMPLEMENT_INDEX, TIB_FIRST_SPECIALIZED_METHOD_INDEX, TIB_FIRST_VIRTUAL_METHOD_INDEX, TIB_INTERFACE_DISPATCH_TABLE_INDEX, TIB_SUPERCLASS_IDS_INDEX, TIB_TYPE_INDEX
 
Fields inherited from interface org.jikesrvm.HeapLayoutConstants
BAD_MAP_COMPRESSION, BOOT_IMAGE_CODE_END, BOOT_IMAGE_CODE_SIZE, BOOT_IMAGE_CODE_START, BOOT_IMAGE_DATA_END, BOOT_IMAGE_DATA_SIZE, BOOT_IMAGE_DATA_START, BOOT_IMAGE_END, BOOT_IMAGE_RMAP_END, BOOT_IMAGE_RMAP_START, MAX_BOOT_IMAGE_RMAP_SIZE, MAXIMUM_MAPPABLE
 
Constructor Summary
ControllerMemory()
           
 
Method Summary
(package private) static String asString()
           
(package private) static boolean bitIsSet(int bitPattern, int optLevel)
          check if the bit position defined by the 2nd parm is set in the first parm
(package private) static boolean completedPlanWithOptLevel(RVMMethod method, int optLevel)
          Return true if there is a completed plan with the given opt level for the given method
static ControllerPlan findLatestPlan(RVMMethod method)
          Looks for the last controller plan for the passed method
static ControllerPlan findMatchingPlan(CompiledMethod cmpMethod)
          Find the plan for the compiled method that is passed
private static LinkedList<ControllerPlan> findPlan(RVMMethod method)
          Looks for a controller plan for the passed method
static int getNumAwoken()
           
static int getNumBase()
           
static int getNumDidNothing()
           
static int getNumMethodsConsidered()
           
static int getNumMethodsScheduledForRecomp()
           
static int getNumOpt0()
           
static int getNumOpt1()
           
static int getNumOpt2()
           
static int getNumOpt3()
           
(package private) static int getNumOpt4()
           
(package private) static void incrementNumAwoken()
           
static void incrementNumBase()
           
(package private) static void incrementNumDidNothing()
           
(package private) static void incrementNumMethodsConsidered()
           
(package private) static void incrementNumMethodsScheduledForRecomp()
           
(package private) static void incrementNumOpt0()
           
(package private) static void incrementNumOpt1()
           
(package private) static void incrementNumOpt2()
           
(package private) static void incrementNumOpt3()
           
(package private) static void incrementNumOpt4()
           
(package private) static void insert(ControllerPlan plan)
          Inserts a controller plan keyed on the underlying method
(package private) static boolean planWithStatus(RVMMethod method, byte status)
          Return true if there is a plan with the given status for the given method
static void printFinalMethodStats(PrintStream log)
          This method summarizes the recompilation actions taken for all methods in this object and produces a report to the passed PrintStream.
static boolean requestedOSR(int cmid)
          Return true iff there is a plan to transition from Base to Opt for a given CMID.
(package private) static int setBitPattern(int bitPattern, int optLevel)
          set the optLevel bit in the passed bitPattern and return the result
(package private) static boolean shouldConsiderForInitialRecompilation(RVMMethod method)
          Determine if the passed method should be considered as a candidate for _initial_ AOS recompilation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

private static final ImmutableEntryHashMapRVM<RVMMethod,LinkedList<ControllerPlan>> table
This is a hashtable of controller plans indexed by RVMMethod. Each method can have a list of such plans associated with.


didNothing

private static int didNothing
Number of times controller is awoken and did nothing.


awoken

private static int awoken
Number of times controller is awoken


numMethodsConsidered

private static int numMethodsConsidered

numMethodsScheduledForRecomp

private static int numMethodsScheduledForRecomp

numBase

private static int numBase

numOpt0

private static int numOpt0

numOpt1

private static int numOpt1

numOpt2

private static int numOpt2

numOpt3

private static int numOpt3

numOpt4

private static int numOpt4
Constructor Detail

ControllerMemory

public ControllerMemory()
Method Detail

getNumAwoken

public static int getNumAwoken()

getNumDidNothing

public static int getNumDidNothing()

getNumMethodsConsidered

public static int getNumMethodsConsidered()

getNumMethodsScheduledForRecomp

public static int getNumMethodsScheduledForRecomp()

getNumBase

public static int getNumBase()

getNumOpt0

public static int getNumOpt0()

getNumOpt1

public static int getNumOpt1()

getNumOpt2

public static int getNumOpt2()

getNumOpt3

public static int getNumOpt3()

getNumOpt4

static int getNumOpt4()

incrementNumAwoken

static void incrementNumAwoken()

incrementNumDidNothing

static void incrementNumDidNothing()

incrementNumMethodsConsidered

static void incrementNumMethodsConsidered()

incrementNumMethodsScheduledForRecomp

static void incrementNumMethodsScheduledForRecomp()

incrementNumBase

public static void incrementNumBase()

incrementNumOpt0

static void incrementNumOpt0()

incrementNumOpt1

static void incrementNumOpt1()

incrementNumOpt2

static void incrementNumOpt2()

incrementNumOpt3

static void incrementNumOpt3()

incrementNumOpt4

static void incrementNumOpt4()

insert

static void insert(ControllerPlan plan)
Inserts a controller plan keyed on the underlying method

Parameters:
plan - the controller plan to insert

findPlan

private static LinkedList<ControllerPlan> findPlan(RVMMethod method)
Looks for a controller plan for the passed method

Parameters:
method - The method to look for
Returns:
the list of controller plans for this method if one exists, otherwise, null

findMatchingPlan

public static ControllerPlan findMatchingPlan(CompiledMethod cmpMethod)
Find the plan for the compiled method that is passed

Parameters:
cmpMethod - the compiled method of interest
Returns:
the matching plan or null if none exists.

shouldConsiderForInitialRecompilation

static boolean shouldConsiderForInitialRecompilation(RVMMethod method)
Determine if the passed method should be considered as a candidate for _initial_ AOS recompilation. A method should not be reconsider for initial AOS recompilation if a plan already exists for the method whose status is ControllerPlan.IN_PROGRESS, ControllerPlan.COMPLETED, ControllerPlan.OUTDATED, or ControllerPlan.ABORTED_COMPILATION_ERROR because of compilation error.

Parameters:
method - the method of interest
Returns:
whether the method should be considered or not

planWithStatus

static boolean planWithStatus(RVMMethod method,
                              byte status)
Return true if there is a plan with the given status for the given method

Parameters:
method - the method of interest
status - the status of interest
Returns:
whether or not there is plan with that status for the method

requestedOSR

public static boolean requestedOSR(int cmid)
Return true iff there is a plan to transition from Base to Opt for a given CMID.


completedPlanWithOptLevel

static boolean completedPlanWithOptLevel(RVMMethod method,
                                         int optLevel)
Return true if there is a completed plan with the given opt level for the given method

Parameters:
method - the method of interest
optLevel - the opt level of interest
Returns:
whether or not there is completed plan with that level for the method

findLatestPlan

public static ControllerPlan findLatestPlan(RVMMethod method)
Looks for the last controller plan for the passed method

Parameters:
method - The method to look for
Returns:
The last controller plan for this method if it exists, otherwise, null

printFinalMethodStats

public static void printFinalMethodStats(PrintStream log)
This method summarizes the recompilation actions taken for all methods in this object and produces a report to the passed PrintStream.

Parameters:
log - the stream to print to

setBitPattern

static int setBitPattern(int bitPattern,
                         int optLevel)
set the optLevel bit in the passed bitPattern and return the result

Parameters:
bitPattern -
optLevel -

bitIsSet

static boolean bitIsSet(int bitPattern,
                        int optLevel)
check if the bit position defined by the 2nd parm is set in the first parm

Parameters:
bitPattern -
optLevel -
Returns:
whether the passed bit is set

asString

static String asString()