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.VM; 016 import org.jikesrvm.compilers.common.CompiledMethod; 017 018 /** 019 * Event used by the Adaptive Inlining Organizer 020 * to notify the controller that a call arc 021 * originating in a hot method has become hot 022 * and therefore recompilation of the method should 023 * be considered to enable additional profile-directed inlining. 024 */ 025 public final class AINewHotEdgeEvent extends HotMethodEvent implements ControllerInputEvent { 026 027 /** 028 * Estimate of the expected benefit if the method is 029 * recompiled AT THE SAME OPT LEVEL with the newly 030 * enabled profile-directed inlining. 031 * <p> 032 * TODO: Think about reasonable ways to encode the expected 033 * boost factor for recompiling at higher opt levels. 034 * In the short run, this is academic, since we only plan to 035 * create an instance of this event for methods already compiled 036 * at max opt level, but it may be required later. 037 * <p> 038 * NB: Boost factor is a value >= 1.0! 039 * (1.0 means no boost, 1.1 means a 10% improvement, etc). 040 */ 041 private double boostFactor; 042 043 public double getBoostFactor() { return boostFactor; } 044 045 /** 046 * @param _cm the compiled method 047 * @param _numSamples the number of samples attributed to the method 048 * @param _boostFactor improvement expected by applying FDO 049 */ 050 AINewHotEdgeEvent(CompiledMethod _cm, double _numSamples, double _boostFactor) { 051 super(_cm, _numSamples); 052 if (VM.VerifyAssertions) VM._assert(_boostFactor >= 1.0); 053 boostFactor = _boostFactor; 054 } 055 056 /** 057 * @param _cm the compiled method 058 * @param _numSamples the number of samples attributed to the method 059 * @param _boostFactor improvement expected by applying FDO 060 */ 061 AINewHotEdgeEvent(CompiledMethod _cm, int _numSamples, double _boostFactor) { 062 this(_cm, (double) _numSamples, _boostFactor); 063 } 064 065 @Override 066 public String toString() { 067 return "NewHotEdgeEvent: " + super.toString() + ", boost factor = " + getBoostFactor(); 068 } 069 070 /** 071 * Called when the controller is ready to process this event. 072 * Simply passes itself to the recompilation strategy. 073 */ 074 @Override 075 public void process() { 076 CompiledMethod cmpMethod = getCompiledMethod(); 077 Controller.recompilationStrategy.considerHotCallEdge(cmpMethod, this); 078 } 079 080 }