Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,17 @@ private static Object slowPathNewArrayLikeObjectWithoutAllocation0(DynamicHub hu
Object array;
if (!GenScavengeAllocationSupport.shouldAllocateInAlignedChunk(size)) {
/*
* Large arrays go into their own unaligned chunk. Only arrays and stored continuations
* may be allocated in an unaligned chunk.
* Large arrays go into their own unaligned chunk.
*
* Instance objects with object reference fields, including hybrid objects such as pods,
* must not be allocated in unaligned chunks because field write barriers assume an
* aligned chunk.
*/
int layoutEncoding = hub.getLayoutEncoding();
assert LayoutEncoding.isArray(layoutEncoding) || StoredContinuation.class.isAssignableFrom(DynamicHub.toClass(hub));
if (!LayoutEncoding.isArray(layoutEncoding) && !StoredContinuation.class.isAssignableFrom(DynamicHub.toClass(hub))) {
throw VMError.shouldNotReachHere("Only arrays and StoredContinuation may be allocated in an unaligned chunk. " +
"Hybrid objects such as pods must be small enough to be allocated in an aligned chunk.");
}

boolean needsZeroing = !HeapChunkProvider.areUnalignedChunksZeroed();
UnalignedHeapChunk.UnalignedHeader newTlabChunk = HeapImpl.getChunkProvider().produceUnalignedChunk(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
*
* Stored continuations are {@link Hybrid} objects where the array part contains the raw stack data.
* After writing the stack data into the object, we manually emit the correct GC write barriers for
* all the references (see {@link Heap#dirtyAllReferencesOf}).
* all the references (see {@link Heap#dirtyAllReferencesOf}). Following initialization, an object
* is considered effectively immutable, and only GC is expected to write the references it contains.
* Therefore, implicit write barriers intentionally do not support stored continuations, and they
* cannot have declared object reference fields.
*
* Objects of this type can reside in unaligned chunks.
*/
@Hybrid(componentType = Word.class)
public final class StoredContinuation {
Expand Down