|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.Backend.Generic.Runtime.TreeBuilder
harpoon.Backend.Runtime1.TreeBuilder
public class TreeBuilder
Runtime1.TreeBuilder
is an implementation of
Generic.Runtime.TreeBuilder
which creates
accessor expressions for the Runtime1
runtime.
Pretty straightforward. No weird hacks.
Field Summary | |
---|---|
protected AllocationStrategy |
as
allocation strategy to use. |
protected ClassDepthMap |
cdm
|
protected FieldMap |
cfm
|
protected int |
CLAZ_CLAZINFO
|
protected int |
CLAZ_COMPONENT_OFF
|
protected int |
CLAZ_DEPTH_OFF
|
protected int |
CLAZ_DISPLAY_OFF
|
protected int |
CLAZ_EXTRAINFO_OFF
|
protected int |
CLAZ_GCENTRY_OFF
|
protected int |
CLAZ_INTERFACES_OFF
|
protected int |
CLAZ_INTERFZ_OFF
|
protected int |
CLAZ_METHODS_OFF
|
protected int |
CLAZ_SIZE_OFF
|
protected MethodMap |
cmm
|
protected MethodMap |
imm
|
protected Linker |
linker
|
protected int |
LONG_WORD_SIZE
|
protected int |
OBJ_ALENGTH_OFF
|
protected int |
OBJ_AZERO_OFF
|
protected int |
OBJ_CLAZ_OFF
|
protected int |
OBJ_FZERO_OFF
|
protected int |
OBJ_HASH_OFF
|
protected int |
OBJECT_HEADER_SIZE
|
protected int |
POINTER_SIZE
|
protected Runtime |
runtime
|
protected int |
WORD_SIZE
|
Constructor Summary | |
---|---|
protected |
TreeBuilder(Runtime runtime,
Linker linker,
AllocationStrategy as,
boolean pointersAreLong,
int pointerAlignment)
|
Method Summary | |
---|---|
protected Stm |
_call_FNI_Monitor(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
Translation.Exp objectref,
boolean isEnter)
wrap objectref and then call FNI_Monitor{Enter|Exit}() |
protected Exp |
_claz_(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
Translation.Exp objectref)
Returns a pointer to the claz structure associated with the given objectref. |
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 . |
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. |
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. |
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. |
Translation.Exp |
classConst(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
HClass classData)
Return a Translation.Exp which represents a
reference to a Class constant. |
Stm |
clearHashBit(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
Exp objExp)
|
Translation.Exp |
componentOf(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
Translation.Exp arrayref,
Translation.Exp componentref)
Return a Translation.Exp which tests the
given object expression for membership in the component
type of the given array expression. |
protected static Exp |
DECLARE(DerivationGenerator dg,
Derivation.DList dl,
Exp exp)
|
protected static Exp |
DECLARE(DerivationGenerator dg,
HClass hc,
Exp exp)
|
protected static Exp |
DECLARE(DerivationGenerator dg,
HClass hc,
Temp t,
Exp exp)
|
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. |
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. |
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 . |
int |
headerSize(HClass hc)
Utility method for external analyses that want to know the size of an object header. |
protected FieldMap |
initClassFieldMap()
|
Translation.Exp |
instanceOf(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
Translation.Exp objref,
HClass classType)
Return a Translation.Exp which tests the
given expression for membership in the given class or
interface. |
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. |
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. |
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 . |
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. |
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. |
Exp |
objAlloc(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
AllocationInformation.AllocationProperties ap,
HClass objectType,
Exp length)
|
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. |
int |
objectSize(HClass hc)
Utility method for external analyses that want to know the exact size of an object. |
protected Exp |
PTRMASK(TreeFactory tf,
HCodeElement source,
DerivationGenerator dg,
Exp e)
|
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 . |
protected void |
setClassHierarchy(ClassHierarchy ch)
|
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 |
Field Detail |
---|
protected final AllocationStrategy as
protected final int WORD_SIZE
protected final int LONG_WORD_SIZE
protected final int POINTER_SIZE
protected int OBJECT_HEADER_SIZE
protected int OBJ_CLAZ_OFF
protected int OBJ_HASH_OFF
protected int OBJ_ALENGTH_OFF
protected int OBJ_AZERO_OFF
protected int OBJ_FZERO_OFF
protected final int CLAZ_INTERFACES_OFF
protected final int CLAZ_CLAZINFO
protected final int CLAZ_COMPONENT_OFF
protected final int CLAZ_INTERFZ_OFF
protected final int CLAZ_SIZE_OFF
protected final int CLAZ_DEPTH_OFF
protected final int CLAZ_GCENTRY_OFF
protected final int CLAZ_EXTRAINFO_OFF
protected final int CLAZ_DISPLAY_OFF
protected int CLAZ_METHODS_OFF
protected final Runtime runtime
protected final Linker linker
protected ClassDepthMap cdm
protected MethodMap imm
protected final MethodMap cmm
protected final FieldMap cfm
Constructor Detail |
---|
protected TreeBuilder(Runtime runtime, Linker linker, AllocationStrategy as, boolean pointersAreLong, int pointerAlignment)
Method Detail |
---|
protected FieldMap initClassFieldMap()
protected void setClassHierarchy(ClassHierarchy ch)
protected static Exp DECLARE(DerivationGenerator dg, HClass hc, Exp exp)
protected static Exp DECLARE(DerivationGenerator dg, HClass hc, Temp t, Exp exp)
protected static Exp DECLARE(DerivationGenerator dg, Derivation.DList dl, Exp exp)
protected Exp PTRMASK(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Exp e)
public int objectSize(HClass hc)
Runtime.TreeBuilder
objectSize
in class Runtime.TreeBuilder
public int headerSize(HClass hc)
Runtime.TreeBuilder
objectSize(hc)+headerSize(hc)
.
headerSize
in class Runtime.TreeBuilder
public Exp objAlloc(TreeFactory tf, HCodeElement source, DerivationGenerator dg, AllocationInformation.AllocationProperties ap, HClass objectType, Exp length)
public Stm clearHashBit(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Exp objExp)
public Translation.Exp arrayLength(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp arrayRef)
Runtime.TreeBuilder
Translation.Exp
giving the length of the
array pointed to by the given expression.
arrayLength
in class Runtime.TreeBuilder
public Translation.Exp arrayNew(TreeFactory tf, HCodeElement source, DerivationGenerator dg, AllocationInformation.AllocationProperties ap, HClass arrayType, Translation.Exp length, boolean initialize)
Runtime.TreeBuilder
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.
arrayNew
in class Runtime.TreeBuilder
public Translation.Exp componentOf(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp arrayref, Translation.Exp componentref)
Runtime.TreeBuilder
Translation.Exp
which tests the
given object expression for membership in the component
type of the given array expression.
componentOf
in class Runtime.TreeBuilder
public Translation.Exp instanceOf(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objref, HClass classType)
Runtime.TreeBuilder
Translation.Exp
which tests the
given expression for membership in the given class or
interface.
instanceOf
in class Runtime.TreeBuilder
public Translation.Exp monitorEnter(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
Runtime.TreeBuilder
Translation.Exp
which acquires
the monitor lock of the object specified by the given
expression.
monitorEnter
in class Runtime.TreeBuilder
public Translation.Exp monitorExit(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
Runtime.TreeBuilder
Translation.Exp
which releases
the monitor lock of the object specified by the given
expression.
monitorExit
in class Runtime.TreeBuilder
protected Stm _call_FNI_Monitor(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref, boolean isEnter)
public Translation.Exp objectNew(TreeFactory tf, HCodeElement source, DerivationGenerator dg, AllocationInformation.AllocationProperties ap, HClass classType, boolean initialize)
Runtime.TreeBuilder
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.
objectNew
in class Runtime.TreeBuilder
public Translation.Exp classConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HClass classData)
Runtime.TreeBuilder
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.
classConst
in class Runtime.TreeBuilder
public Translation.Exp fieldConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HField fieldData)
Runtime.TreeBuilder
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.
fieldConst
in class Runtime.TreeBuilder
public Translation.Exp methodConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HMethod methodData)
Runtime.TreeBuilder
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.
methodConst
in class Runtime.TreeBuilder
public Translation.Exp stringConst(TreeFactory tf, HCodeElement source, DerivationGenerator dg, String stringData)
Runtime.TreeBuilder
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).
stringConst
in class Runtime.TreeBuilder
public Translation.Exp arrayBase(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
Runtime.TreeBuilder
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
.
arrayBase
in class Runtime.TreeBuilder
public Translation.Exp arrayOffset(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HClass arrayType, Translation.Exp index)
Runtime.TreeBuilder
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.
arrayOffset
in class Runtime.TreeBuilder
public Translation.Exp fieldBase(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
Runtime.TreeBuilder
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.
fieldBase
in class Runtime.TreeBuilder
public Translation.Exp fieldOffset(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HField field)
Runtime.TreeBuilder
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.
fieldOffset
in class Runtime.TreeBuilder
protected Exp _claz_(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
public Translation.Exp methodBase(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp objectref)
Runtime.TreeBuilder
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.
methodBase
in class Runtime.TreeBuilder
public Translation.Exp methodOffset(TreeFactory tf, HCodeElement source, DerivationGenerator dg, HMethod method)
Runtime.TreeBuilder
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.
methodOffset
in class Runtime.TreeBuilder
public Translation.Exp referenceEqual(TreeFactory tf, HCodeElement source, DerivationGenerator dg, Translation.Exp refLeft, Translation.Exp refRight)
Runtime.TreeBuilder
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.
referenceEqual
in class Runtime.TreeBuilder
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |