Search in sources :

Example 1 with OSROrganizerThread

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

the class ControllerThread method createOrganizerThreads.

/**
 *  Create the organizerThreads and schedule them
 */
private void createOrganizerThreads() {
    AOSOptions opts = Controller.options;
    if (opts.sampling()) {
        // Primary backing store for method sample data
        Controller.methodSamples = new MethodCountData();
        // Install organizer to drive method recompilation
        Controller.organizers.add(new MethodSampleOrganizer(opts.DERIVED_FILTER_OPT_LEVEL));
        // Additional set up for feedback directed inlining
        if (opts.ADAPTIVE_INLINING) {
            Organizer decayOrganizer = new DecayOrganizer(new YieldCounterListener(opts.DECAY_FREQUENCY));
            Controller.organizers.add(decayOrganizer);
            createDynamicCallGraphOrganizer();
        }
    }
    if ((!opts.ENABLE_PRECOMPILE) && (!opts.ENABLE_BULK_COMPILE)) {
        Controller.osrOrganizer = new OSROrganizerThread();
        Controller.osrOrganizer.start();
    }
}
Also used : MethodSampleOrganizer(org.jikesrvm.adaptive.measurements.organizers.MethodSampleOrganizer) AccumulatingMethodSampleOrganizer(org.jikesrvm.adaptive.measurements.organizers.AccumulatingMethodSampleOrganizer) YieldCounterListener(org.jikesrvm.adaptive.measurements.listeners.YieldCounterListener) DynamicCallGraphOrganizer(org.jikesrvm.adaptive.measurements.organizers.DynamicCallGraphOrganizer) MethodSampleOrganizer(org.jikesrvm.adaptive.measurements.organizers.MethodSampleOrganizer) AccumulatingMethodSampleOrganizer(org.jikesrvm.adaptive.measurements.organizers.AccumulatingMethodSampleOrganizer) Organizer(org.jikesrvm.adaptive.measurements.organizers.Organizer) DecayOrganizer(org.jikesrvm.adaptive.measurements.organizers.DecayOrganizer) MethodCountData(org.jikesrvm.adaptive.database.methodsamples.MethodCountData) AOSOptions(org.jikesrvm.adaptive.util.AOSOptions) DecayOrganizer(org.jikesrvm.adaptive.measurements.organizers.DecayOrganizer) OSROrganizerThread(org.jikesrvm.adaptive.OSROrganizerThread)

Example 2 with OSROrganizerThread

use of org.jikesrvm.adaptive.OSROrganizerThread 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)2 OnStackReplacementEvent (org.jikesrvm.adaptive.OnStackReplacementEvent)1 MethodCountData (org.jikesrvm.adaptive.database.methodsamples.MethodCountData)1 YieldCounterListener (org.jikesrvm.adaptive.measurements.listeners.YieldCounterListener)1 AccumulatingMethodSampleOrganizer (org.jikesrvm.adaptive.measurements.organizers.AccumulatingMethodSampleOrganizer)1 DecayOrganizer (org.jikesrvm.adaptive.measurements.organizers.DecayOrganizer)1 DynamicCallGraphOrganizer (org.jikesrvm.adaptive.measurements.organizers.DynamicCallGraphOrganizer)1 MethodSampleOrganizer (org.jikesrvm.adaptive.measurements.organizers.MethodSampleOrganizer)1 Organizer (org.jikesrvm.adaptive.measurements.organizers.Organizer)1 AOSExternalOptions (org.jikesrvm.adaptive.util.AOSExternalOptions)1 AOSOptions (org.jikesrvm.adaptive.util.AOSOptions)1