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 */ 013package org.jikesrvm.adaptive.controller; 014 015import org.jikesrvm.VM; 016import 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 */ 025public 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 final double boostFactor; 042 043 public double getBoostFactor() { 044 return boostFactor; 045 } 046 047 /** 048 * @param _cm the compiled method 049 * @param _numSamples the number of samples attributed to the method 050 * @param _boostFactor improvement expected by applying FDO 051 */ 052 AINewHotEdgeEvent(CompiledMethod _cm, double _numSamples, double _boostFactor) { 053 super(_cm, _numSamples); 054 if (VM.VerifyAssertions) VM._assert(_boostFactor >= 1.0); 055 boostFactor = _boostFactor; 056 } 057 058 /** 059 * @param _cm the compiled method 060 * @param _numSamples the number of samples attributed to the method 061 * @param _boostFactor improvement expected by applying FDO 062 */ 063 AINewHotEdgeEvent(CompiledMethod _cm, int _numSamples, double _boostFactor) { 064 this(_cm, (double) _numSamples, _boostFactor); 065 } 066 067 @Override 068 public String toString() { 069 return "NewHotEdgeEvent: " + super.toString() + ", boost factor = " + getBoostFactor(); 070 } 071 072 /** 073 * Called when the controller is ready to process this event. 074 * Simply passes itself to the recompilation strategy. 075 */ 076 @Override 077 public void process() { 078 CompiledMethod cmpMethod = getCompiledMethod(); 079 Controller.recompilationStrategy.considerHotCallEdge(cmpMethod, this); 080 } 081 082}