org.jikesrvm.compilers.opt.driver
Class OptimizingCompiler

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.OptimizingCompiler
All Implemented Interfaces:
Callbacks.StartupMonitor

public final class OptimizingCompiler
extends Object
implements Callbacks.StartupMonitor

The main driver of the Compiler.

External drivers are responsible for providing the policies; the role of this class is simply to take a CompilationPlan and execute it.

Currently, this class is invoked from four clients:

Clients are responsible for ensuring that:

This class is not meant to be instantiated.


Field Summary
private static boolean appStarted
          indicate when the application has started
private static boolean isInitialized
          Has the optimizing compiler been initialized?
 
Constructor Summary
private OptimizingCompiler()
          Prevent instantiation by clients
 
Method Summary
static void bottom(String what, NormalMethod method)
          Debugging aid to be called after printing the IR
private static void checkSupported(NormalMethod method, OptOptions options)
          Check whether opt compilation of a particular method is supported.
static CompiledMethod compile(CompilationPlan cp)
          Invoke the opt compiler to execute a compilation plan.
private static void fail(Throwable e, NormalMethod method)
          Abort a compilation with an error.
static boolean getAppStarted()
           
static void header(String what, NormalMethod method)
          Debugging aid to be called before printing the IR
static void init(OptOptions options)
          Prepare compiler for use.
private static void initializeStatics()
          Call the static init functions for the Compiler subsystems
static boolean isInitialized()
          Has the optimizing compiler been initialized?
 void notifyStartup()
          Notify the monitor that the VM has started up.
static void printInstructions(IR ir, String message)
          Print the IR along with a message
private static void printMethodMessage(NormalMethod method, OptOptions options)
          Print a message of a method name
static void report(String what)
          Debugging aid.
static void report(String what, long time)
          Debugging aid.
(package private) static void reset()
          Reset the optimizing compiler
static void setAppStarted()
           
static void setBootOptions(OptOptions options)
          Set up option used while compiling the boot image
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appStarted

private static boolean appStarted
indicate when the application has started


isInitialized

private static boolean isInitialized
Has the optimizing compiler been initialized?

Constructor Detail

OptimizingCompiler

private OptimizingCompiler()
Prevent instantiation by clients

Method Detail

init

public static void init(OptOptions options)
Prepare compiler for use.

Parameters:
options - options to use for compilations during initialization

notifyStartup

public void notifyStartup()
Description copied from interface: Callbacks.StartupMonitor
Notify the monitor that the VM has started up.

Specified by:
notifyStartup in interface Callbacks.StartupMonitor

getAppStarted

public static boolean getAppStarted()

setAppStarted

public static void setAppStarted()

setBootOptions

public static void setBootOptions(OptOptions options)
Set up option used while compiling the boot image

Parameters:
options - the options to set

initializeStatics

private static void initializeStatics()
Call the static init functions for the Compiler subsystems


isInitialized

public static boolean isInitialized()
Has the optimizing compiler been initialized?


reset

static void reset()
Reset the optimizing compiler


compile

public static CompiledMethod compile(CompilationPlan cp)
Invoke the opt compiler to execute a compilation plan.

Parameters:
cp - the compilation plan to be executed
Returns:
the CompiledMethod object that is the result of compilation

report

public static void report(String what)
Debugging aid.

Parameters:
what - a string message to print

report

public static void report(String what,
                          long time)
Debugging aid.

Parameters:
what - a string message to print
time - a timestamp to print

header

public static void header(String what,
                          NormalMethod method)
Debugging aid to be called before printing the IR

Parameters:
what - a string message to print
method - the method being compiled

bottom

public static void bottom(String what,
                          NormalMethod method)
Debugging aid to be called after printing the IR

Parameters:
what - a string message to print
method - the method being compiled

printInstructions

public static void printInstructions(IR ir,
                                     String message)
Print the IR along with a message

Parameters:
ir -
message -

printMethodMessage

private static void printMethodMessage(NormalMethod method,
                                       OptOptions options)
Print a message of a method name

Parameters:
method -
options -

fail

private static void fail(Throwable e,
                         NormalMethod method)
Abort a compilation with an error.

Parameters:
e - The exception thrown by a compiler phase
method - The method being compiled

checkSupported

private static void checkSupported(NormalMethod method,
                                   OptOptions options)
Check whether opt compilation of a particular method is supported. If not, throw a non-fatal run-time exception.