harpoon.Analysis.Quads
Class MethodInliningCodeFactory

java.lang.Object
  extended by harpoon.Analysis.Quads.MethodInliningCodeFactory
All Implemented Interfaces:
HCodeFactory
Direct Known Subclasses:
SmallMethodInliner

public class MethodInliningCodeFactory
extends Object
implements HCodeFactory

MethodInliningCodeFactory makes an HCode from an HMethod, and inlines methods at call sites registered with the inline(CALL) function.

Recursive functions are legal, but this factory does not provide facilities for specifying number of recursive inlinings.

Version:
$Id: MethodInliningCodeFactory.java,v 1.4 2002/04/10 03:00:59 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Constructor Summary
MethodInliningCodeFactory(HCodeFactory parentFactory)
          Creates a MethodInliningCodeFactory, using parentFactory.
 
Method Summary
 void clear(HMethod m)
          Removes representation of method m from all caches in this factory and its parents.
 HCode convert(HMethod m)
          Make an HCode from an HMethod.
 String getCodeName()
          Returns a string naming the type of the HCode that this factory produces.
 void inline(CALL site)
          Marks a call site to be inlined when code is generated.
 void uninline(CALL site)
          Marks a call site to not be inlined when code is generated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInliningCodeFactory

public MethodInliningCodeFactory(HCodeFactory parentFactory)
Creates a MethodInliningCodeFactory, using parentFactory.
requires: parentFactory produces "quad-ssi" code.

Method Detail

getCodeName

public String getCodeName()
Returns a string naming the type of the HCode that this factory produces.

this.getCodeName() should equal this.convert(m).getName() for every HMethod m.

Specified by:
getCodeName in interface HCodeFactory

clear

public void clear(HMethod m)
Removes representation of method m from all caches in this factory and its parents.

Specified by:
clear in interface HCodeFactory

convert

public HCode convert(HMethod m)
Make an HCode from an HMethod.

convert is allowed to return null if the requested conversion is impossible; typically this is because it's attempt to convert a source representation failed -- for example, because m is a native method.

MethodInliningCodeFactory also inlines any call sites within m marked by the this.inline(CALL) method.

Specified by:
convert in interface HCodeFactory

inline

public void inline(CALL site)
Marks a call site to be inlined when code is generated.
modifies: this
effects: Marks site as a location to inline if this is ever asked to generate code for the HMethod containing site.


uninline

public void uninline(CALL site)
Marks a call site to not be inlined when code is generated.
modifies: this
effects: If site is in the set of call sites to be inlined, takes site out of the set. Else does nothing.