001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Eclipse Public License (EPL);
005 * You may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013 package org.jikesrvm.adaptive.controller;
014
015 import org.jikesrvm.classloader.NormalMethod;
016 import org.jikesrvm.compilers.common.CompiledMethod;
017
018 /**
019 * A recompilation choice represents an action (or a set of actions)
020 * that can be considered by the controller's analytic model.
021 */
022 abstract class RecompilationChoice {
023
024 //--- Interface ---
025
026 /**
027 * What is the cost of selecting this recompilation choice
028 *
029 * @param meth The method being considered for recompilation.
030 * @return The expected cost of exeuting this recompilation choice
031 */
032 abstract double getCost(NormalMethod meth);
033
034 /**
035 * What is the benefit of executing this recompilation choice, given
036 * the estimated future time for the method if nothing changes?
037 *
038 * @param prevCompiler The previous compiler
039 * @param futureExecutionTime The expected future execution time of
040 * the method if left running with the previous compiler.
041 * @return The expected future execution time if this choice were selected
042 */
043 abstract double getFutureExecutionTime(int prevCompiler, double futureExecutionTime);
044
045 /**
046 * Return a controller plan that will start this recompilation choice
047 * in action
048 *
049 * @param cmpMethod The method in question
050 * @param prevCompiler The previous compiler
051 * @param prevTimeFormethod The estimated future time had nothing been done
052 * @param bestActionTime The estimated total time implementing this choice
053 * @param bestCost The estimated compilation cost implementing this choice
054 * @return The controller plan implementing this recompilation choice
055 */
056 abstract ControllerPlan makeControllerPlan(CompiledMethod cmpMethod, int prevCompiler, double prevTimeFormethod,
057 double bestActionTime, double bestCost);
058
059 }
060
061
062
063
064
065
066