Search in sources :

Example 1 with OnStackReplacementEvent

use of org.jikesrvm.adaptive.OnStackReplacementEvent in project JikesRVM by JikesRVM.

the class ControllerThread method run.

/**
 * This method is the entry point to the controller, it is called when
 * the controllerThread is created.
 */
@Override
public void run() {
    // save this object so others can access it, if needed
    Controller.controllerThread = this;
    // Cache option object because it'll be accessed often
    AOSExternalOptions opts = Controller.options;
    // Bring up the logging system
    AOSLogging.logger.boot();
    if (opts.ENABLE_ADVICE_GENERATION) {
        AOSGenerator.boot();
    }
    // Create measurement entities that are NOT related to
    // adaptive recompilation
    createProfilers();
    if (!opts.ENABLE_RECOMPILATION) {
        // left to do but exit.
        if (opts.ENABLE_BULK_COMPILE || opts.ENABLE_PRECOMPILE) {
            Controller.options.DERIVED_MAX_OPT_LEVEL = 2;
            Controller.recompilationStrategy.init();
        }
        controllerInitDone();
        AOSLogging.logger.reportThatAOSIsInNonAdaptiveMode();
        // controller thread exits.
        return;
    }
    if (opts.ENABLE_PRECOMPILE) {
        if (Controller.options.sampling()) {
            // Create our set of standard optimization plans.
            Controller.recompilationStrategy.init();
        } else if (Controller.options.counters()) {
            InvocationCounts.init();
        }
        Controller.osrOrganizer = new OSROrganizerThread();
        Controller.osrOrganizer.start();
        createCompilationThread();
        // We're running an AOS bootimage with a non-adaptive primary strategy.
        // We already set up any requested profiling infrastructure, so nothing
        // left to do but exit.
        controllerInitDone();
        // to have a fair comparison, we need to create the data structures
        // of organizers
        createOrganizerThreads();
        AOSLogging.logger.reportThatAOSIsInReplayMode();
        while (true) {
            if (opts.EARLY_EXIT && opts.EARLY_EXIT_TIME < Controller.controllerClock) {
                Controller.stop();
            }
            Object event = Controller.controllerInputQueue.deleteMin();
            ((OnStackReplacementEvent) event).process();
        }
    }
    // Initialize the CompilerDNA class
    // This computes some internal options, must be done early in boot process
    CompilerDNA.init();
    // Create the organizerThreads and schedule them
    createOrganizerThreads();
    // Create the compilationThread and schedule it
    createCompilationThread();
    if (Controller.options.sampling()) {
        // Create our set of standard optimization plans.
        Controller.recompilationStrategy.init();
    } else if (Controller.options.counters()) {
        InvocationCounts.init();
    }
    controllerInitDone();
    // Repeat forever.
    while (true) {
        if (opts.EARLY_EXIT && opts.EARLY_EXIT_TIME < Controller.controllerClock) {
            Controller.stop();
        }
        Object event = Controller.controllerInputQueue.deleteMin();
        ((ControllerInputEvent) event).process();
    }
}
Also used : OnStackReplacementEvent(org.jikesrvm.adaptive.OnStackReplacementEvent) AOSExternalOptions(org.jikesrvm.adaptive.util.AOSExternalOptions) OSROrganizerThread(org.jikesrvm.adaptive.OSROrganizerThread)

Aggregations

OSROrganizerThread (org.jikesrvm.adaptive.OSROrganizerThread)1 OnStackReplacementEvent (org.jikesrvm.adaptive.OnStackReplacementEvent)1 AOSExternalOptions (org.jikesrvm.adaptive.util.AOSExternalOptions)1