public class UnalignedHeapChunk extends HeapChunk
An UnalignedHeapChunk does not have a way to map from a Pointer to (or into) the Object they contain to the UnalignedHeapChunk that contains them.
An Object in a UnalignedHeapChunk needs to have a bit set in its DynamicHub to identify it as an Object in a UnalignedHeapChunk, so things like write-barriers don't try to update meta-data. Also so things like the getEnclosingHeapChunk(Object) can tell that the object is in an UnalignedHeapChunk.
Only a slow-path allocation method is available for UnalignedHeapChunks. This is acceptable because UnalignedHeapChunks are for large objects, so the cost of initializing the object dwarfs the cost of slow-path allocation.
The Object in a UnalignedHeapChunk can be promoted from one Space to another by moving the UnalignedHeapChunk from one Space to the other, rather than copying the Object out of the HeapChunk in one Space and into a destination HeapChunk in the other Space. That saves some amount of copying cost for these large objects. An UnalignedHeapChunk is laid out:
+=================+-------+-------------------------------------+ | UnalignedHeader | Card | Object | | Fields | Table | | +=================+-------+-------------------------------------+The HeapChunk fields can be accessed as declared fields, but the card "table" and the location of the Object are just computed as Pointers. In this implementation, I am only implementing precise card remembered sets, so I only need one entry for the whole Object. But for consistency I am treating it as a 1-element table.
Modifier and Type | Class and Description |
---|---|
static class |
UnalignedHeapChunk.TestingBackDoor
Expose some methods that should be protected.
|
static interface |
UnalignedHeapChunk.UnalignedHeader
Additional fields beyond what is in
HeapChunk.Header . |
HeapChunk.Header<T extends HeapChunk.Header<T>>
Constructor and Description |
---|
UnalignedHeapChunk() |
Modifier and Type | Method and Description |
---|---|
static org.graalvm.word.Pointer |
allocateMemory(UnalignedHeapChunk.UnalignedHeader that,
org.graalvm.word.UnsignedWord size)
Allocate memory within this AlignedHeapChunk.
|
protected static void |
cleanRememberedSetOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
Clean the remembered set for the given chunk.
|
static org.graalvm.word.UnsignedWord |
committedObjectMemoryOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
The committed object memory is the space between start and end.
|
static void |
dirtyCardForObjectOfUnalignedHeapChunk(Object obj,
boolean verifyOnly)
Dirty the card corresponding to the given Object.
|
protected static org.graalvm.word.Pointer |
getCardTableLimit(UnalignedHeapChunk.UnalignedHeader that)
Where is the limit of the card table.
|
protected static org.graalvm.word.Pointer |
getCardTableStart(UnalignedHeapChunk.UnalignedHeader that)
Where is the start of the card table?
|
protected static org.graalvm.word.UnsignedWord |
getChunkSizeForObject(org.graalvm.word.UnsignedWord objectSize)
How large an UnalignedHeapChunk is needed to hold an object of the given size?
|
protected static UnalignedHeapChunk.UnalignedHeader |
getEnclosingUnalignedHeapChunk(Object obj)
Map from an object to a header for the enclosing chunk.
|
static MemoryWalker.HeapChunkAccess<UnalignedHeapChunk.UnalignedHeader> |
getMemoryWalkerAccess() |
protected static org.graalvm.word.Pointer |
getObjectStart(UnalignedHeapChunk.UnalignedHeader that)
Where is the start of the Object?
|
static org.graalvm.word.Pointer |
getUnalignedHeapChunkStart(UnalignedHeapChunk.UnalignedHeader that)
A well-named method, similar to the field access methods on HeapChunk.
|
static org.graalvm.word.UnsignedWord |
getUnalignedHeapOverhead()
The overhead of an unaligned chunk.
|
protected static org.graalvm.word.Pointer |
getUnalignedStart(UnalignedHeapChunk.UnalignedHeader that)
A well-named method, similar to the field access methods on HeapChunk.
|
protected static void |
setUpRememberedSetOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
Set up the remembered set for the Object in this chunk.
|
static org.graalvm.word.UnsignedWord |
usedObjectMemoryOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
How much space is used for the objects in an UnalignedHeapChunk?
|
static boolean |
walkDirtyObjectsOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that,
ObjectVisitor visitor,
boolean clean)
Walk the dirty Objects in this chunk, passing each to a Visitor.
|
static boolean |
walkObjectsOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that,
ObjectVisitor visitor)
Walk the objects in the given chunk, starting from the first object.
|
asPointer, availableObjectMemory, getEnclosingHeapChunk, getEnclosingHeapChunk, setTopCarefully, walkObjectsFrom, walkObjectsFromInline
protected static org.graalvm.word.Pointer getCardTableStart(UnalignedHeapChunk.UnalignedHeader that)
protected static org.graalvm.word.Pointer getCardTableLimit(UnalignedHeapChunk.UnalignedHeader that)
protected static org.graalvm.word.Pointer getObjectStart(UnalignedHeapChunk.UnalignedHeader that)
protected static org.graalvm.word.Pointer getUnalignedStart(UnalignedHeapChunk.UnalignedHeader that)
public static org.graalvm.word.UnsignedWord getUnalignedHeapOverhead()
protected static org.graalvm.word.UnsignedWord getChunkSizeForObject(org.graalvm.word.UnsignedWord objectSize)
public static org.graalvm.word.Pointer allocateMemory(UnalignedHeapChunk.UnalignedHeader that, org.graalvm.word.UnsignedWord size)
protected static UnalignedHeapChunk.UnalignedHeader getEnclosingUnalignedHeapChunk(Object obj)
public static boolean walkObjectsOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that, ObjectVisitor visitor)
public static void dirtyCardForObjectOfUnalignedHeapChunk(Object obj, boolean verifyOnly)
public static boolean walkDirtyObjectsOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that, ObjectVisitor visitor, boolean clean)
protected static void cleanRememberedSetOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
protected static void setUpRememberedSetOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
public static org.graalvm.word.Pointer getUnalignedHeapChunkStart(UnalignedHeapChunk.UnalignedHeader that)
public static org.graalvm.word.UnsignedWord committedObjectMemoryOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
public static org.graalvm.word.UnsignedWord usedObjectMemoryOfUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader that)
public static MemoryWalker.HeapChunkAccess<UnalignedHeapChunk.UnalignedHeader> getMemoryWalkerAccess()