org.jikesrvm.adaptive.controller
Class Controller

java.lang.Object
  extended by org.jikesrvm.adaptive.controller.Controller
All Implemented Interfaces:
Callbacks.ExitMonitor, Callbacks.RecompileAllDynamicallyLoadedMethodsMonitor

public class Controller
extends Object
implements Callbacks.ExitMonitor, Callbacks.RecompileAllDynamicallyLoadedMethodsMonitor

This class contains top level adaptive compilation subsystem functions.


Field Summary
private static boolean booted
          Has the execution of boot completed successfully?
static BlockingPriorityQueue compilationQueue
          A blocking priority queue where the controller will place methods to be opt compiled (an output of the controller thread)
static CompilationThread compilationThread
          Thread that will perform opt-compilations as directed by the controller (the thread sets this field when it is created.)
static int controllerClock
          Controller virtual clock, ticked every taken yieldpoint.
static BlockingPriorityQueue controllerInputQueue
          A blocking priority queue where organizers place events to be processed by the controller (an input to the controller thread)
static ControllerThread controllerThread
          The controller thread, it makes all the decisions (the thread sets this field when it is created.)
static PartialCallGraph dcg
          The dynamic call graph
static boolean enabled
          Signals when the options and (optional) logging mechanism are enabled
static MethodCountData methodSamples
          The main hot method raw data object.
private static String[] optCompilerOptions
          Deferred command line arguments for the opt compiler
static AOSOptions options
          Controller subsystem control options
static Vector<Organizer> organizers
          Threads that will organize profile data as directed by the controller
static OSROrganizerThread osrOrganizer
          Thread collecting osr request and pass it to controllerThread
static RecompilationStrategy recompilationStrategy
          The strategy used to make recompilation decisions
private static ThreadDeath threadDeath
          Used to shut down threads
 
Constructor Summary
Controller()
           
 
Method Summary
static void addOptCompilerOption(String arg)
          Add a deferred command line argument
static void boot()
          Initialize the controller subsystem (called from VM.boot) This method is called AFTER the command line options are processed.
(package private) static void createControllerThread()
           
static String[] getOptCompilerOptions()
          Get the deferred command line arguments
 void notifyExit(int value)
          To be called when the VM is about to exit.
 void notifyRecompileAll()
          Called when the application wants to recompile all dynamically loaded methods.
static void processCommandLineArg(String arg)
          Process any command line arguments passed to the controller subsystem.
static void report()
          This method is called when the VM is exiting to provide a hook to allow the adaptive optimization subsystem to generate a summary report.
static void stop()
          Stop all AOS threads and exit the adaptive system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public static boolean enabled
Signals when the options and (optional) logging mechanism are enabled


options

public static final AOSOptions options
Controller subsystem control options


optCompilerOptions

private static String[] optCompilerOptions
Deferred command line arguments for the opt compiler


controllerThread

public static ControllerThread controllerThread
The controller thread, it makes all the decisions (the thread sets this field when it is created.)


compilationThread

public static CompilationThread compilationThread
Thread that will perform opt-compilations as directed by the controller (the thread sets this field when it is created.)


osrOrganizer

public static OSROrganizerThread osrOrganizer
Thread collecting osr request and pass it to controllerThread


organizers

public static final Vector<Organizer> organizers
Threads that will organize profile data as directed by the controller


controllerInputQueue

public static BlockingPriorityQueue controllerInputQueue
A blocking priority queue where organizers place events to be processed by the controller (an input to the controller thread)


compilationQueue

public static BlockingPriorityQueue compilationQueue
A blocking priority queue where the controller will place methods to be opt compiled (an output of the controller thread)


recompilationStrategy

public static RecompilationStrategy recompilationStrategy
The strategy used to make recompilation decisions


controllerClock

public static int controllerClock
Controller virtual clock, ticked every taken yieldpoint.


methodSamples

public static MethodCountData methodSamples
The main hot method raw data object.


dcg

public static PartialCallGraph dcg
The dynamic call graph


threadDeath

private static final ThreadDeath threadDeath
Used to shut down threads


booted

private static boolean booted
Has the execution of boot completed successfully?

Constructor Detail

Controller

public Controller()
Method Detail

addOptCompilerOption

public static void addOptCompilerOption(String arg)
Add a deferred command line argument


getOptCompilerOptions

public static String[] getOptCompilerOptions()
Get the deferred command line arguments


boot

public static void boot()
Initialize the controller subsystem (called from VM.boot) This method is called AFTER the command line options are processed.


notifyExit

public void notifyExit(int value)
To be called when the VM is about to exit.

Specified by:
notifyExit in interface Callbacks.ExitMonitor
Parameters:
value - the exit value

notifyRecompileAll

public void notifyRecompileAll()
Called when the application wants to recompile all dynamically loaded methods. This can be expensive!

Specified by:
notifyRecompileAll in interface Callbacks.RecompileAllDynamicallyLoadedMethodsMonitor

createControllerThread

static void createControllerThread()

processCommandLineArg

public static void processCommandLineArg(String arg)
Process any command line arguments passed to the controller subsystem.

This method has the responsibility of creating the options object if it does not already exist

NOTE: All command line argument processing should be handled via the automatically generated code in AOSOptions.java. Don't even think of adding handwritten stuff here! --dave

Parameters:
arg - the command line argument to be processed

report

public static void report()
This method is called when the VM is exiting to provide a hook to allow the adaptive optimization subsystem to generate a summary report. It can also be called directly from driver programs to allow reporting on a single run of a benchmark that the driver program is executing in a loop (in which case the adaptive system isn't actually exiting.....so some of the log messages may get a little weird).


stop

public static void stop()
Stop all AOS threads and exit the adaptive system. Can be used to assess code quality in a steady state by allowing the adaptive system to run "for a while" and then stopping it