public abstract class FieldLayout extends Object
The field layout object encapsulates layout state.
| Modifier and Type | Field and Description |
|---|---|
private boolean |
clusterReferenceFields
Lay out reference fields in a block
|
protected static boolean |
DEBUG
Enable debugging
|
private boolean |
largeFieldsFirst
Whether to lay out 8byte values first in order to avoid some holes
|
| Constructor and Description |
|---|
FieldLayout(boolean largeFieldsFirst,
boolean clusterReferenceFields) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract FieldLayoutContext |
getLayoutContext(RVMClass klass)
Return the appropriate layout context object for the given class.
|
protected void |
layoutField(FieldLayoutContext layout,
RVMClass klass,
RVMField field,
int fieldSize)
Lay out a given field.
|
void |
layoutInstanceFields(RVMClass klass)
This is where a class gets laid out.
|
protected static int |
log2(int x) |
protected void |
setOffset(RVMClass klass,
RVMField field,
int offset)
Update a field to set its offset within the object.
|
protected void |
updateClass(RVMClass klass,
FieldLayoutContext fieldLayout)
Updates the RVMClass with context info.
|
protected static final boolean DEBUG
private final boolean largeFieldsFirst
private final boolean clusterReferenceFields
public FieldLayout(boolean largeFieldsFirst, boolean clusterReferenceFields)
protected static int log2(int x)
x - the integerprotected abstract FieldLayoutContext getLayoutContext(RVMClass klass)
klass - The classpublic void layoutInstanceFields(RVMClass klass)
klass - The class to lay out.protected void updateClass(RVMClass klass, FieldLayoutContext fieldLayout)
klass - the class to updatefieldLayout - the layout for the classprotected void setOffset(RVMClass klass, RVMField field, int offset)
klass - the class that the field belongs tofield - the fieldoffset - the new offset for the fieldprotected void layoutField(FieldLayoutContext layout, RVMClass klass, RVMField field, int fieldSize)
layout - State for the layout processklass - The class whose fields we're laying out.field - The field we are laying out.fieldSize - The size of the field in bytes