org.jikesrvm.adaptive.recompilation
Class CompilerDNA

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

public class CompilerDNA
extends Object
implements Constants

This class codifies the cost/benefit properties of the various compilers used in the adaptive optimization system.

The DNA tells the AOS two important kinds of averages for each optimization level: the cost of compiling at an optimization level (as measured in bytecode/milliseconds) and the expected speedup of the resulting code (relative to the first compiler).

There is an AOS command-line option to set the compiler DNA. The method readDNA(java.lang.String) contains a comment on the expected format.

This DNA was gathered on July 9, 2008 using revision r14679 + the bugfix in r14688. The PowerPC data was gathered on piccolo.watson.ibm.com (JS21, machine type 8884; ppc64-aix). The IA32 data was gathered on lyric.watson.ibm.com (LS41, machine type 7972; x86_64-linux).


Field Summary
static int BASELINE
           
private static double[][] benefitRatio
          Benefits of moving from one compilation level to another USAGE NOTE: The data is layed out in a upper triangular matrix
private static double[] compilationRates
          Average bytecodes compiled per millisecond.
private static String[] compilerNames
           
private static double[][] compileTimeRatio
          Compile time ratio of one compilation level to another For example, if compiler1 (say OPT1) compiles at 50 bc/msec and compiler2 (say OPT2) compiles at 100 bc/msec, compileTimeRatio[OPT1][OPT2] = 2 USAGE NOTE: The data is layed out in a upper triangular matrix
private static int numCompilers
          The number of compilers available
(package private) static int OPT0
           
(package private) static int OPT1
           
(package private) static int OPT2
           
private static double[] speedupRates
          What is the execution rate of each compiler normalized to the 1st compiler
 
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
CompilerDNA()
           
 
Method Summary
static double estimateCompileTime(int compiler, NormalMethod meth)
          Estimate how long (in milliseconds) it will/did take the given compiler to compile the given method.
static double getBaselineCompilationRate()
          Returns the compilation rates of the baseline compiler in bytecodes/millisecond.
static double getBenefitRatio(int compiler1, int compiler2)
          This method returns the expected speedup from going from compiler1 to compiler2
static int getCompilerConstant(int optLevel)
          maps opt levels to the compiler
static String getCompilerString(int compiler)
          maps a compiler constant to a string
static double getCompileTimeRatio(int compiler1, int compiler2)
          What is the additional overhead (relative to compiler1 compile time) of compile2 compile time.
static int getNumberOfCompilers()
          returns the number of compilers
static int getOptLevel(int compiler)
          A mapping from an Opt compiler number to the corresponding Opt level
static void init()
          initialize static fields
private static void initializeCompilerRatioArrays()
           
private static void processOneLine(LineNumberReader in, String title, double[] valueHolder)
          Helper method to read one line of the DNA file
private static void readDNA(String filename)
          Read a serialized representation of the DNA info
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compilerNames

private static final String[] compilerNames

BASELINE

public static final int BASELINE
See Also:
Constant Field Values

OPT0

static final int OPT0
See Also:
Constant Field Values

OPT1

static final int OPT1
See Also:
Constant Field Values

OPT2

static final int OPT2
See Also:
Constant Field Values

numCompilers

private static int numCompilers
The number of compilers available


compilationRates

private static final double[] compilationRates
Average bytecodes compiled per millisecond.


speedupRates

private static final double[] speedupRates
What is the execution rate of each compiler normalized to the 1st compiler


benefitRatio

private static double[][] benefitRatio
Benefits of moving from one compilation level to another USAGE NOTE: The data is layed out in a upper triangular matrix


compileTimeRatio

private static double[][] compileTimeRatio
Compile time ratio of one compilation level to another For example, if compiler1 (say OPT1) compiles at 50 bc/msec and compiler2 (say OPT2) compiles at 100 bc/msec, compileTimeRatio[OPT1][OPT2] = 2 USAGE NOTE: The data is layed out in a upper triangular matrix

Constructor Detail

CompilerDNA

public CompilerDNA()
Method Detail

getBenefitRatio

public static double getBenefitRatio(int compiler1,
                                     int compiler2)
This method returns the expected speedup from going from compiler1 to compiler2

Parameters:
compiler1 -
compiler2 -
Returns:
the benefit ratio (speedup) of moving from compiler1 to compiler2

getCompileTimeRatio

public static double getCompileTimeRatio(int compiler1,
                                         int compiler2)
What is the additional overhead (relative to compiler1 compile time) of compile2 compile time. For example, if compiler1 compiles at 50 bc/msec and compiler2 compiles at 100 bc/msec, this method returns 2

Parameters:
compiler1 - the compiler whose compile time we compare to
compiler2 - the compiler's compile time we care about
Returns:
the additional overhead (relative to compiler1 compile time) of compile2 compile time

estimateCompileTime

public static double estimateCompileTime(int compiler,
                                         NormalMethod meth)
Estimate how long (in milliseconds) it will/did take the given compiler to compile the given method.

Parameters:
compiler - the compiler to compile meth
meth - the method to be compiled
Returns:
an estimate of compile time (in milliseconds)

getBaselineCompilationRate

public static double getBaselineCompilationRate()
Returns the compilation rates of the baseline compiler in bytecodes/millisecond.

Returns:
the compilation rates of the baseline compiler in bytecodes/millisecond

init

public static void init()
initialize static fields


initializeCompilerRatioArrays

private static void initializeCompilerRatioArrays()

readDNA

private static void readDNA(String filename)
Read a serialized representation of the DNA info

Parameters:
filename - DNA filename

processOneLine

private static void processOneLine(LineNumberReader in,
                                   String title,
                                   double[] valueHolder)
                            throws IOException
Helper method to read one line of the DNA file

Parameters:
in - the LineNumberReader object
title - the title string to look for
valueHolder - the array to hold the read values
Throws:
IOException

getNumberOfCompilers

public static int getNumberOfCompilers()
returns the number of compilers

Returns:
the number of compilers

getOptLevel

public static int getOptLevel(int compiler)
A mapping from an Opt compiler number to the corresponding Opt level

Parameters:
compiler - the compiler constant of interest
Returns:
the Opt level that corresponds to the Opt compiler constant passed

getCompilerString

public static String getCompilerString(int compiler)
maps a compiler constant to a string

Parameters:
compiler -
Returns:
the string that represents the passed compiler constant

getCompilerConstant

public static int getCompilerConstant(int optLevel)
maps opt levels to the compiler

Parameters:
optLevel - opt level
Returns:
the opt level that corresponds to the passed compiler constant