Skip to content

Commit ea43523

Browse files
[GR-71401] Verify that objects in the young generation don't have a remembered set bit.
PullRequest: graal/22628
2 parents ae73f7c + 93ab769 commit ea43523

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/FillerObjectUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ static int arrayBaseOffset() {
6565
}
6666

6767
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
68-
public static void writeFillerObjectAt(Pointer p, UnsignedWord size) {
68+
public static void writeFillerObjectAt(Pointer p, UnsignedWord size, boolean rememberedSet) {
6969
assert size.aboveThan(0);
7070
if (size.aboveOrEqual(arrayMinSize())) {
7171
int length = UnsignedUtils.safeToInt(size.subtract(arrayBaseOffset()).unsignedDivide(ARRAY_ELEMENT_SIZE));
72-
FormatArrayNode.formatArray(p, ARRAY_CLASS, length, true, false, WITH_GARBAGE_IF_ASSERTIONS_ENABLED, false);
72+
FormatArrayNode.formatArray(p, ARRAY_CLASS, length, rememberedSet, false, WITH_GARBAGE_IF_ASSERTIONS_ENABLED, false);
7373
} else {
74-
FormatObjectNode.formatObject(p, FillerObject.class, true, WITH_GARBAGE_IF_ASSERTIONS_ENABLED, false);
74+
FormatObjectNode.formatObject(p, FillerObject.class, rememberedSet, WITH_GARBAGE_IF_ASSERTIONS_ENABLED, false);
7575
}
7676
assert LayoutEncoding.getSizeFromObjectInGC(p.toObject()).equal(size);
7777
}

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/HeapVerifier.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ private static boolean verifyObject(Object obj, AlignedHeader aChunk, UnalignedH
323323
Log.log().string("Object ").zhex(ptr).string(" is in ").string(space.getName()).string(" chunk ").zhex(chunk).string(" but does not have a remembered set.").newline();
324324
return false;
325325
}
326+
} else if (space.isYoungSpace()) {
327+
if (SerialGCOptions.useRememberedSet() && RememberedSet.get().hasRememberedSet(header)) {
328+
Log.log().string("Object ").zhex(ptr).string(" is in ").string(space.getName()).string(" chunk ").zhex(chunk).string(" but has a remembered set.").newline();
329+
return false;
330+
}
326331
}
327332

328333
return verifyReferences(obj);

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/TlabSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ private static void insertFiller(ThreadLocalAllocation.Descriptor tlab) {
363363
UnsignedWord size = hardEnd.subtract(top);
364364

365365
if (top.belowThan(hardEnd)) {
366-
FillerObjectUtil.writeFillerObjectAt(top, size);
366+
FillerObjectUtil.writeFillerObjectAt(top, size, false);
367367
}
368368
}
369369

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/compacting/SweepingVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public boolean visit(Pointer objSeq, UnsignedWord size, Pointer newAddress, Poin
4343
if (nextObjSeq.isNonNull()) {
4444
Pointer gapStart = objSeq.add(size);
4545
assert gapStart.belowThan(nextObjSeq);
46-
FillerObjectUtil.writeFillerObjectAt(gapStart, nextObjSeq.subtract(gapStart));
46+
FillerObjectUtil.writeFillerObjectAt(gapStart, nextObjSeq.subtract(gapStart), true);
4747
// Note that we have already added first object table entries for fillers during fixup.
4848
} else {
4949
AlignedHeapChunk.AlignedHeader chunk = AlignedHeapChunk.getEnclosingChunkFromObjectPointer(objSeq);

0 commit comments

Comments
 (0)