Skip to content

Commit 07212ef

Browse files
committed
fixup! Revisit newly added files.
1 parent c0291f8 commit 07212ef

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

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

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,17 @@
2828
import org.graalvm.nativeimage.Platforms;
2929

3030
import com.oracle.svm.core.code.CodeInfo;
31-
import com.oracle.svm.core.code.CodeInfoAccess;
3231
import com.oracle.svm.core.code.RuntimeCodeCache.CodeInfoVisitor;
3332
import com.oracle.svm.core.code.RuntimeCodeInfoAccess;
34-
import com.oracle.svm.core.heap.ObjectReferenceVisitor;
33+
import com.oracle.svm.core.genscavenge.compacting.ObjectRefFixupVisitor;
3534

36-
/**
37-
* Before compaction, updates the same references that were visited by
38-
* {@link RuntimeCodeCacheWalker} during the mark phase.
39-
*/
35+
/** Before compaction, updates references from {@link CodeInfo} structures. */
4036
final class RuntimeCodeCacheFixupWalker implements CodeInfoVisitor {
4137

42-
private final ObjectReferenceVisitor visitor;
38+
private final ObjectRefFixupVisitor visitor;
4339

4440
@Platforms(Platform.HOSTED_ONLY.class)
45-
RuntimeCodeCacheFixupWalker(ObjectReferenceVisitor visitor) {
41+
RuntimeCodeCacheFixupWalker(ObjectRefFixupVisitor visitor) {
4642
this.visitor = visitor;
4743
}
4844

@@ -52,18 +48,10 @@ public boolean visitCode(CodeInfo codeInfo) {
5248
return true;
5349
}
5450

55-
int state = CodeInfoAccess.getState(codeInfo);
56-
if (state == CodeInfo.STATE_UNREACHABLE || state == CodeInfo.STATE_READY_FOR_INVALIDATION) {
57-
/*
58-
* The code will be freed during this collection, but we need to make sure that all the
59-
* objects that are accessed during the invalidation remain accessible. Those objects
60-
* can only be collected in a subsequent garbage collection.
61-
*/
62-
RuntimeCodeInfoAccess.walkObjectFields(codeInfo, visitor);
63-
return true;
64-
}
65-
66-
/* The CodeInfo remains valid, so we need to fix up all references. */
51+
/*
52+
* Whether this CodeInfo remains valid or will be invalidated or freed during this GC, we
53+
* update all references, including clearing those to objects that do not survive.
54+
*/
6755
RuntimeCodeInfoAccess.walkStrongReferences(codeInfo, visitor);
6856
RuntimeCodeInfoAccess.walkWeakReferences(codeInfo, visitor);
6957
return true;

0 commit comments

Comments
 (0)