org.jikesrvm.tools.oth
Class OptTestHarness

java.lang.Object
  extended by org.jikesrvm.tools.oth.OptTestHarness

 class OptTestHarness
extends Object

A test harness for the optimizing compiler.

The role of this class is to allow the optimizing compiler to be run as an "application" to enabling selective testing and debugging of the optimizing compiler. For example, the following command line:

rvm -X:h=100 org.jikesrvm.tools.oth.OptTestHarness -oc:O2 -oc:phases=true -class hanoi -er hanoi run  -

invokes the opt compiler at Opt level 2 and phases=true to compile the class hanoi, it then executes the run method of class hanoi.

Any command that can be given to the optimizing compiler via -X:irc:<cmd> can be given to the optimizing compiler by org.jikesrvm.tools.oth.OptTestHarness via -oc:<cmd>. In addition, the org.jikesrvm.tools.oth.OptTestHarness supports the following commands:

 -useBootOptions           Use the same OptOptions as the bootimage compiler.
 -longcommandline     Read commands (one per line) from a file
 +baseline                      Switch default compiler to baseline
 -baseline                      Switch default compiler to optimizing
 -load               Load a class
 -class                  Load a class and compile all its methods
 -method   [-|] Compile method with default compiler
 -methodOpt   [-|] Compile method with opt compiler
 -methodBase   [-|] Compile method with base compiler
 -er   [-|] {args} Compile with default compiler and execute a method
 -performance                   Show performance results
 


Nested Class Summary
private static class OptTestHarness.Performance
           
 
Field Summary
(package private) static boolean BASELINE
          Default value for for compiling opt/baseline
(package private) static Vector<RVMMethod> baselineMethodVector
           
(package private) static ClassLoader cl
           
(package private) static boolean DISABLE_CLASS_LOADING
           
(package private) static boolean EXECUTE_MAIN
           
(package private) static boolean EXECUTE_WITH_REFLECTION
           
(package private) static String[] mainArgs
           
(package private) static RVMClass mainClass
           
(package private) static OptOptions options
           
(package private) static Vector<RVMMethod> optMethodVector
           
(package private) static Vector<OptOptions> optOptionsVector
           
(package private) static OptTestHarness.Performance perf
          Record and show performance of executed methods, if any
(package private) static boolean PRINT_CODE_ADDRESS
          Should we print the address of compiled methods (useful for debugging)
(package private) static Object[] reflectMethodArgs
           
(package private) static Vector<Object[]> reflectMethodArgsVector
           
(package private) static Vector<RVMMethod> reflectMethodVector
           
(package private) static Method reflectoid
           
(package private) static Vector<Method> reflectoidVector
           
 
Constructor Summary
OptTestHarness()
           
 
Method Summary
private static void compileMethodsInVector()
           
private static void executeCommand()
           
(package private) static RVMMethod findDeclaredOrFirstMethod(RVMClass klass, String methname, String methdesc)
          Finds a method, either one with a given descriptor or the first matching one in in the given class.
(package private) static RVMClass loadClass(String s)
           
static void main(String[] args)
           
(package private) static int parseMethodArgs(TypeReference[] argDesc, String[] args, int i, Object[] methodArgs)
           
(package private) static void printFormatString()
           
private static void processClass(RVMClass klass, OptOptions opts)
           
private static void processMethod(RVMMethod method, OptOptions opts)
           
private static void processMethod(RVMMethod method, OptOptions opts, boolean isBaseline)
           
private static void processOptionString(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISABLE_CLASS_LOADING

static boolean DISABLE_CLASS_LOADING

EXECUTE_WITH_REFLECTION

static boolean EXECUTE_WITH_REFLECTION

EXECUTE_MAIN

static boolean EXECUTE_MAIN

BASELINE

static boolean BASELINE
Default value for for compiling opt/baseline


PRINT_CODE_ADDRESS

static boolean PRINT_CODE_ADDRESS
Should we print the address of compiled methods (useful for debugging)


perf

static OptTestHarness.Performance perf
Record and show performance of executed methods, if any


cl

static ClassLoader cl

optMethodVector

static Vector<RVMMethod> optMethodVector

optOptionsVector

static Vector<OptOptions> optOptionsVector

baselineMethodVector

static Vector<RVMMethod> baselineMethodVector

reflectoid

static Method reflectoid

reflectMethodArgs

static Object[] reflectMethodArgs

reflectoidVector

static Vector<Method> reflectoidVector

reflectMethodVector

static Vector<RVMMethod> reflectMethodVector

reflectMethodArgsVector

static Vector<Object[]> reflectMethodArgsVector

mainClass

static RVMClass mainClass

mainArgs

static String[] mainArgs

options

static OptOptions options
Constructor Detail

OptTestHarness

OptTestHarness()
Method Detail

parseMethodArgs

static int parseMethodArgs(TypeReference[] argDesc,
                           String[] args,
                           int i,
                           Object[] methodArgs)

findDeclaredOrFirstMethod

static RVMMethod findDeclaredOrFirstMethod(RVMClass klass,
                                           String methname,
                                           String methdesc)
Finds a method, either one with a given descriptor or the first matching one in in the given class.

Parameters:
klass - the class to search
methname - the method's name
methdesc - a descriptor of the method's signature if a specific method is desired or "-" to find the first method with the given name
Returns:
the method or null if no method was found

loadClass

static RVMClass loadClass(String s)
                   throws ClassNotFoundException
Throws:
ClassNotFoundException

printFormatString

static void printFormatString()

processClass

private static void processClass(RVMClass klass,
                                 OptOptions opts)

processMethod

private static void processMethod(RVMMethod method,
                                  OptOptions opts)

processMethod

private static void processMethod(RVMMethod method,
                                  OptOptions opts,
                                  boolean isBaseline)

processOptionString

private static void processOptionString(String[] args)

compileMethodsInVector

private static void compileMethodsInVector()

executeCommand

private static void executeCommand()
                            throws InvocationTargetException,
                                   IllegalAccessException
Throws:
InvocationTargetException
IllegalAccessException

main

public static void main(String[] args)
                 throws InvocationTargetException,
                        IllegalAccessException
Throws:
InvocationTargetException
IllegalAccessException