public final class UnalignedHeapChunk extends Object
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 an 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. The size of the card table depends on the used
RememberedSet implementation and may even be zero.
In this implementation, I am only implementing imprecise 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 interface |
UnalignedHeapChunk.UnalignedHeader
Additional fields beyond what is in
HeapChunk.Header. |
public static void initialize(UnalignedHeapChunk.UnalignedHeader chunk, org.graalvm.word.UnsignedWord chunkSize)
public static org.graalvm.word.Pointer getObjectStart(UnalignedHeapChunk.UnalignedHeader that)
public static org.graalvm.word.Pointer getObjectEnd(UnalignedHeapChunk.UnalignedHeader that)
public static org.graalvm.word.UnsignedWord getOverhead()
public static org.graalvm.word.Pointer allocateMemory(UnalignedHeapChunk.UnalignedHeader that, org.graalvm.word.UnsignedWord size)
public static UnalignedHeapChunk.UnalignedHeader getEnclosingChunk(Object obj)
public static boolean walkObjects(UnalignedHeapChunk.UnalignedHeader that, ObjectVisitor visitor)
public static boolean walkObjectsInline(UnalignedHeapChunk.UnalignedHeader that, ObjectVisitor visitor)
public static org.graalvm.word.UnsignedWord getCommittedObjectMemory(UnalignedHeapChunk.UnalignedHeader that)
public static MemoryWalker.HeapChunkAccess<UnalignedHeapChunk.UnalignedHeader> getMemoryWalkerAccess()