public class AlignmentEncoding extends Object
31 24 16 8 0 +-------+-------+-------+-------+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxfff00where the natural alignment of the object is preserved (the low-order bits are zero), and the next least significant n bits contain the encoded metadata.
With the cooperation of MemoryManager, the idea is that we allocate 2^n additional words of memory, then offset the object within the allocated region so that the value of fff is encoded.
The current implementation specifically encodes the TIB pointer, because this is the only pointer field where this technique can give a speedup that makes it worthwhile.
Modifier and Type | Field and Description |
---|---|
static int |
ALIGN_CODE_NONE |
private static int |
ALIGNMENT_INCREMENT
How far do we need to shift the object to increment the encoded field by 1
|
private static int |
FIELD_SHIFT
First bit of the encoded field
|
(package private) static int |
FIELD_WIDTH
Bits of metadata that we encode
|
private static int |
MAX_ALIGN_WORDS
Maximum distance (in words) that we shift an object
|
private static int |
TIB_ALIGN_MASK
Bit-mask to select out the encoded field
|
private static boolean |
VERBOSE |
Constructor and Description |
---|
AlignmentEncoding() |
Modifier and Type | Method and Description |
---|---|
static Address |
adjustRegion(int alignCode,
Address region)
Adjust a region address so that the object pointer of an object that starts at this address
will be aligned so as to encode the specified value.
|
(package private) static void |
assertSanity(int alignCode)
Assert that a prospective encoded value is sane
|
static int |
extractTibCode(Address address)
Extract the encoded value from a TIB pointer,
represented as a raw address.
|
static int |
getTibCode(ObjectReference object)
Extract the encoded value from an object's TIB pointer
|
private static int |
getTibCodeForRegion(Address region) |
static int |
padding(int alignCode)
Number of padding bytes required.
|
public static final int ALIGN_CODE_NONE
static final int FIELD_WIDTH
private static final int MAX_ALIGN_WORDS
private static final int FIELD_SHIFT
private static final int ALIGNMENT_INCREMENT
private static final int TIB_ALIGN_MASK
private static final boolean VERBOSE
public AlignmentEncoding()
static void assertSanity(int alignCode)
alignCode
- Prospective encoded valuepublic static int padding(int alignCode)
alignCode
- Prospective encoded value.public static Address adjustRegion(int alignCode, Address region)
alignCode
- Value to encoderegion
- The initial regionprivate static int getTibCodeForRegion(Address region)
public static int extractTibCode(Address address)
address
- the TIB's addresspublic static int getTibCode(ObjectReference object)
object
- the object