1 cananian 1.1.2.5 // InlineMap.java, created Thu Jan 14 22:17:20 1999 by duncan 2 cananian 1.1.2.6 // Copyright (C) 1998 Duncan Bryce <duncan@lcs.mit.edu> 3 cananian 1.1.2.4 // Licensed under the terms of the GNU GPL; see COPYING for details. 4 duncan 1.1.2.2 package harpoon.Backend.Maps; 5 duncan 1.1.2.1 6 duncan 1.1.2.1 import harpoon.ClassFile.HField; 7 duncan 1.1.2.1 8 duncan 1.1.2.1 /** 9 duncan 1.1.2.1 * An <code>InlineMap</code> maps an <code>HField</code> to a boolean value 10 cananian 1.1.2.3 * indicated whether the <code>HField</code> can be inlined. 11 cananian 1.1.2.3 * We leave the policy decision of whether it is wise to do so to other 12 cananian 1.1.2.3 * code, which will also be an InlineMap. So, the idea is that a core 13 cananian 1.1.2.3 * InlineMap implements the conservative analysis of inline-safety, then 14 cananian 1.1.2.3 * a second inline map takes the first inline map and twiddles the inlining 15 cananian 1.1.2.3 * results according to whether or not it thinks inlining is really a good 16 cananian 1.1.2.3 * idea, using some heuristic. Or you can leave out the second inline map 17 cananian 1.1.2.3 * and its heuristics, which just means you'd like to inline wherever 18 cananian 1.1.2.3 * possible. Have I confused everyone yet? 19 duncan 1.1.2.1 * 20 cananian 1.1.2.6 * @author Duncan Bryce <duncan@lcs.mit.edu> 21 cananian 1.2 * @version $Id: InlineMap.java,v 1.2 2002/02/25 21:01:59 cananian Exp $ 22 duncan 1.1.2.1 */ 23 cananian 1.1.2.3 public abstract class InlineMap // may need to be an interface later, but 24 cananian 1.1.2.3 // we'll try to keep it a class if we can. 25 duncan 1.1.2.1 { 26 duncan 1.1.2.1 /** 27 cananian 1.1.2.3 * @return <code>true</code> if the <code>HField</code> can be inlined 28 cananian 1.1.2.3 * using type 1 inlining (the class descriptor for the inlined object is 29 cananian 1.1.2.3 * preserved). This can be done even if the field escapes, as long as it 30 cananian 1.1.2.3 * is a final field. 31 duncan 1.1.2.1 */ 32 cananian 1.1.2.3 public abstract boolean canInline1(HField hf); 33 cananian 1.1.2.3 /** 34 cananian 1.1.2.3 * @return <code>true</code> if the <code>HField</code> should be inlined 35 cananian 1.1.2.3 * using type 2 inlining (the class descriptor for the inlined object is 36 cananian 1.1.2.3 * omitted). This can only be done if the field doesn't escape. 37 cananian 1.1.2.3 * Returning <code>true</code> implies shouldInline1() returns 38 cananian 1.1.2.3 * <code>true</code>, too. 39 cananian 1.1.2.3 */ 40 cananian 1.1.2.3 public abstract boolean canInline2(HField hf); 41 duncan 1.1.2.1 } 42 duncan 1.1.2.1 43 duncan 1.1.2.1 44 cananian 1.2