harpoon.Backend.Generic
Class Runtime.TreeBuilder

java.lang.Object
  extended by harpoon.Backend.Generic.Runtime.TreeBuilder
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
TreeBuilder
Enclosing class:
Runtime

public abstract static class Runtime.TreeBuilder
extends Object
implements Serializable

The TreeBuilder constructs bits of code in the IR.Tree form to handle various runtime-dependent tasks---primarily method and field access.

See Also:
Serialized Form

Constructor Summary
Runtime.TreeBuilder()
           
 
Method Summary
abstract  Translation.Exp arrayBase(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
          Return a Translation.Exp representing the array-base of the object referenced by the given objectref Translation.Exp.
abstract  Translation.Exp arrayLength(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp arrayRef)
          Return a Translation.Exp giving the length of the array pointed to by the given expression.
abstract  Translation.Exp arrayNew(TreeFactory tf, HCodeElement source, DerivationGenerator dg, AllocationInformation.AllocationProperties ap, HClass arraytype, Translation.Exp length, boolean initialize)
          Return a Translation.Exp which will create a array of the given type, with length specified by the given expression.
abstract  Translation.Exp arrayOffset(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HClass arrayType, Translation.Exp index)
          Return a Translation.Exp representing the offset from the array base needed to access the array element specified by the index expression.
abstract  Translation.Exp classConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HClass classData)
          Return a Translation.Exp which represents a reference to a Class constant.
abstract  Translation.Exp componentOf(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp arrayref, Translation.Exp objectref)
          Return a Translation.Exp which tests the given object expression for membership in the component type of the given array expression.
abstract  Translation.Exp fieldBase(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
          Return a Translation.Exp representing the field base of the object referenced by the given objectref expression.
abstract  Translation.Exp fieldConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HField fieldData)
          Return a Translation.Exp which represents a reference to a java.lang.reflect.Field constant.
abstract  Translation.Exp fieldOffset(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HField field)
          Return a Translation.Exp representing an offset from the field base required to access the given field.
abstract  int headerSize(HClass hc)
          Utility method for external analyses that want to know the size of an object header.
abstract  Translation.Exp instanceOf(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref, HClass classType)
          Return a Translation.Exp which tests the given expression for membership in the given class or interface.
abstract  Translation.Exp methodBase(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
          Return a Translation.Exp representing the method base of the object referenced by the given objectref expression.
abstract  Translation.Exp methodConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HMethod methodData)
          Return a Translation.Exp which represents a reference to a java.lang.reflect.Method constant.
abstract  Translation.Exp methodOffset(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HMethod method)
          Return a Translation.Exp representing an offset from the method base required to access the given method.
abstract  Translation.Exp monitorEnter(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
          Return a Translation.Exp which acquires the monitor lock of the object specified by the given expression.
abstract  Translation.Exp monitorExit(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
          Return a Translation.Exp which releases the monitor lock of the object specified by the given expression.
abstract  Translation.Exp objectNew(TreeFactory tf, HCodeElement source, DerivationGenerator dg, AllocationInformation.AllocationProperties ap, HClass classType, boolean initialize)
          Return a Translation.Exp which will create a object of the given type, with length specified by the given expression.
abstract  int objectSize(HClass hc)
          Utility method for external analyses that want to know the exact size of an object.
abstract  Translation.Exp referenceEqual(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp refLeft, Translation.Exp refRight)
          Return a Translation.Exp representing an comparison between expressions evaluating to two references, refLeft and refRight.
abstract  Translation.Exp stringConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, String stringData)
          Return a Translation.Exp which represents a reference to a string constant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Runtime.TreeBuilder

public Runtime.TreeBuilder()
Method Detail

objectSize

public abstract int objectSize(HClass hc)
Utility method for external analyses that want to know the exact size of an object. This returns the size in bytes not including the header.


headerSize

public abstract int headerSize(HClass hc)
Utility method for external analyses that want to know the size of an object header. Returns the header size in bytes. The total allocated memory for an object is objectSize(hc)+headerSize(hc).


arrayLength

public abstract Translation.Exp arrayLength(TreeFactory tf,
                                            HCodeElement source,
                                            DerivationGenerator dg,
                                            Translation.Exp arrayRef)
Return a Translation.Exp giving the length of the array pointed to by the given expression.


arrayNew

public abstract Translation.Exp arrayNew(TreeFactory tf,
                                         HCodeElement source,
                                         DerivationGenerator dg,
                                         AllocationInformation.AllocationProperties ap,
                                         HClass arraytype,
                                         Translation.Exp length,
                                         boolean initialize)
Return a Translation.Exp which will create a array of the given type, with length specified by the given expression. Only a single dimension of a multidimensional array will be created. Elements of the array are only initialized if the initialize parameter is true; however the internal object header, length, and any internal fields of the array inherited from java.lang.Object are always initialized.


componentOf

public abstract Translation.Exp componentOf(TreeFactory tf,
                                            HCodeElement source,
                                            DerivationGenerator dg,
                                            Translation.Exp arrayref,
                                            Translation.Exp objectref)
Return a Translation.Exp which tests the given object expression for membership in the component type of the given array expression.


instanceOf

public abstract Translation.Exp instanceOf(TreeFactory tf,
                                           HCodeElement source,
                                           DerivationGenerator dg,
                                           Translation.Exp objectref,
                                           HClass classType)
Return a Translation.Exp which tests the given expression for membership in the given class or interface.


monitorEnter

public abstract Translation.Exp monitorEnter(TreeFactory tf,
                                             HCodeElement source,
                                             DerivationGenerator dg,
                                             Translation.Exp objectref)
Return a Translation.Exp which acquires the monitor lock of the object specified by the given expression.


monitorExit

public abstract Translation.Exp monitorExit(TreeFactory tf,
                                            HCodeElement source,
                                            DerivationGenerator dg,
                                            Translation.Exp objectref)
Return a Translation.Exp which releases the monitor lock of the object specified by the given expression.


objectNew

public abstract Translation.Exp objectNew(TreeFactory tf,
                                          HCodeElement source,
                                          DerivationGenerator dg,
                                          AllocationInformation.AllocationProperties ap,
                                          HClass classType,
                                          boolean initialize)
Return a Translation.Exp which will create a object of the given type, with length specified by the given expression. Fields of the object are only initialized if the initialize parameter is true; however the internal object header is always created and initialized.


classConst

public abstract Translation.Exp classConst(TreeFactory tf,
                                           HCodeElement source,
                                           DerivationGenerator dg,
                                           HClass classData)
Return a Translation.Exp which represents a reference to a Class constant. The runtime may implement this by a call to Class.forName(classname) or other lookup function, or may return a NAME if the class objects are statically allocated.


fieldConst

public abstract Translation.Exp fieldConst(TreeFactory tf,
                                           HCodeElement source,
                                           DerivationGenerator dg,
                                           HField fieldData)
Return a Translation.Exp which represents a reference to a java.lang.reflect.Field constant. The runtime may implement this by a call to Class.forName(classname).getDeclaredField(fieldname) or other lookup functions, or may return a NAME if the Field objects are statically allocated.


methodConst

public abstract Translation.Exp methodConst(TreeFactory tf,
                                            HCodeElement source,
                                            DerivationGenerator dg,
                                            HMethod methodData)
Return a Translation.Exp which represents a reference to a java.lang.reflect.Method constant. The runtime may implement this by a call to Class.forName(classname).getDeclaredMethod(name,...) or other lookup functions, or may return a NAME if the Method objects are statically allocated.


stringConst

public abstract Translation.Exp stringConst(TreeFactory tf,
                                            HCodeElement source,
                                            DerivationGenerator dg,
                                            String stringData)
Return a Translation.Exp which represents a reference to a string constant. Note that invoking String.intern() on the String object reference returned must return a result identical to the reference. This may involve fix-up and/or addition of objects to the class or global HData; these tasks are the responsibility of the Generic.Runtime, and it is anticipated that the invocation of this method may have such side-effects (although other implementations are certainly possible).


arrayBase

public abstract Translation.Exp arrayBase(TreeFactory tf,
                                          HCodeElement source,
                                          DerivationGenerator dg,
                                          Translation.Exp objectref)
Return a Translation.Exp representing the array-base of the object referenced by the given objectref Translation.Exp. This expression should point to the zero'th element of the array object specified by objectref.


arrayOffset

public abstract Translation.Exp arrayOffset(TreeFactory tf,
                                            HCodeElement source,
                                            DerivationGenerator dg,
                                            HClass arrayType,
                                            Translation.Exp index)
Return a Translation.Exp representing the offset from the array base needed to access the array element specified by the index expression. If index is zero, then the Translation.Exp returned should also have value zero.


fieldBase

public abstract Translation.Exp fieldBase(TreeFactory tf,
                                          HCodeElement source,
                                          DerivationGenerator dg,
                                          Translation.Exp objectref)
Return a Translation.Exp representing the field base of the object referenced by the given objectref expression. This expression should point to the first field in the object.


fieldOffset

public abstract Translation.Exp fieldOffset(TreeFactory tf,
                                            HCodeElement source,
                                            DerivationGenerator dg,
                                            HField field)
Return a Translation.Exp representing an offset from the field base required to access the given field. If the given field is the first in the object, then the Translation.Exp returned should have value zero.


methodBase

public abstract Translation.Exp methodBase(TreeFactory tf,
                                           HCodeElement source,
                                           DerivationGenerator dg,
                                           Translation.Exp objectref)
Return a Translation.Exp representing the method base of the object referenced by the given objectref expression. This expression should point a location containing a pointer to the first method of the object.


methodOffset

public abstract Translation.Exp methodOffset(TreeFactory tf,
                                             HCodeElement source,
                                             DerivationGenerator dg,
                                             HMethod method)
Return a Translation.Exp representing an offset from the method base required to access the given method. If the given method is the first of the object, then the Translation.Exp returned should have value zero.


referenceEqual

public abstract Translation.Exp referenceEqual(TreeFactory tf,
                                               HCodeElement source,
                                               DerivationGenerator dg,
                                               Translation.Exp refLeft,
                                               Translation.Exp refRight)
Return a Translation.Exp representing an comparison between expressions evaluating to two references, refLeft and refRight. Note that this is *reference* equality, not *POINTER* equality. The fieldBase method, for example, is required to return a POINTER expression (which is typically a bit-masked and offset version of the reference value); one valid implementation of referenceEqual would be to compare the values returned by a call to fieldBase() on the operands, but there is typically a more efficient means.