Skip to content
Merged
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 @@ -149,8 +149,8 @@ static boolean walkObjects(AlignedHeader that, ObjectVisitor visitor) {

@AlwaysInline("GC performance")
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
static boolean walkObjectsInline(AlignedHeader that, ObjectVisitor visitor) {
return HeapChunk.walkObjectsFromInline(that, getObjectsStart(that), visitor);
static boolean walkObjectsFromInline(AlignedHeader that, Pointer start, ObjectVisitor visitor) {
return HeapChunk.walkObjectsFromInline(that, start, visitor);
}

@Fold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,27 @@ void walkGreyObjects() {
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
private void walkAlignedGreyObjects() {
AlignedHeapChunk.AlignedHeader aChunk;
Pointer aStart;
if (alignedHeapChunk.isNull() && alignedTop.isNull()) {
/* If the snapshot is empty, then I have to walk from the beginning of the Space. */
aChunk = space.getFirstAlignedHeapChunk();
aStart = (aChunk.isNonNull() ? AlignedHeapChunk.getObjectsStart(aChunk) : WordFactory.nullPointer());
} else {
/* Otherwise walk Objects that arrived after the snapshot. */
aChunk = alignedHeapChunk;
aStart = alignedTop;
}
/* Visit Objects in the AlignedChunks. */
GreyToBlackObjectVisitor visitor = GCImpl.getGCImpl().getGreyToBlackObjectVisitor();
if (aChunk.isNonNull()) {
AlignedHeapChunk.AlignedHeader lastChunk;
do {
lastChunk = aChunk;
if (!AlignedHeapChunk.walkObjectsInline(aChunk, visitor)) {
if (!AlignedHeapChunk.walkObjectsFromInline(aChunk, aStart, visitor)) {
throw VMError.shouldNotReachHereAtRuntime();
}
aChunk = HeapChunk.getNext(aChunk);
aStart = (aChunk.isNonNull() ? AlignedHeapChunk.getObjectsStart(aChunk) : WordFactory.nullPointer());
} while (aChunk.isNonNull());

/* Move the scan point. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,20 +297,20 @@ private static SignedWord offsetFromPointer(Header<?> that, PointerBase pointer)
}

@NeverInline("Not performance critical")
public static boolean walkObjectsFrom(Header<?> that, Pointer offset, ObjectVisitor visitor) {
return walkObjectsFromInline(that, offset, visitor);
public static boolean walkObjectsFrom(Header<?> that, Pointer start, ObjectVisitor visitor) {
return walkObjectsFromInline(that, start, visitor);
}

@AlwaysInline("GC performance")
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static boolean walkObjectsFromInline(Header<?> that, Pointer startOffset, ObjectVisitor visitor) {
Pointer offset = startOffset;
while (offset.belowThan(getTopPointer(that))) { // crucial: top can move, so always re-read
Object obj = offset.toObject();
public static boolean walkObjectsFromInline(Header<?> that, Pointer start, ObjectVisitor visitor) {
Pointer p = start;
while (p.belowThan(getTopPointer(that))) { // crucial: top can move, so always re-read
Object obj = p.toObject();
if (!callVisitor(visitor, obj)) {
return false;
}
offset = offset.add(LayoutEncoding.getSizeFromObjectInlineInGC(obj));
p = p.add(LayoutEncoding.getSizeFromObjectInlineInGC(obj));
}
return true;
}
Expand Down