Skip to content

Conversation

@bulasevich
Copy link
Contributor

@bulasevich bulasevich commented Nov 10, 2025

This PR backports:

Conflicts: [1]

The change (currentSP, currentIP params of verifyFrameReferencesVisitor.initialize) have to be applied manually to visitFrame in current code base:

<<<<<<< HEAD
        public boolean visitFrame(Pointer currentSP, CodePointer currentIP, CodeInfo codeInfo, DeoptimizedFrame deoptimizedFrame) {
            verifyFrameReferencesVisitor.initialize();
            CodeInfoTable.visitObjectReferences(currentSP, currentIP, codeInfo, deoptimizedFrame, verifyFrameReferencesVisitor);
=======
        public boolean visitRegularFrame(Pointer currentSP, CodePointer currentIP, CodeInfo codeInfo) {
            verifyFrameReferencesVisitor.initialize(currentSP, currentIP);
            CodeInfoTable.visitObjectReferences(currentSP, currentIP, codeInfo, verifyFrameReferencesVisitor);
>>>>>>> 7b247bbec1d (Report more information if the heap verification finds a broken reference on the stack.)

==>

+++ b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/StackVer    +++ b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/StackVer
@@ -89,7 +89,7 @@ public void initialize() {                                                       |  @@ -90,24 +90,37 @@ final class StackVerifier {
         @Override                                                                                             @Override
         @RestrictHeapAccess(access = RestrictHeapAccess.Access.NO_ALLOCATION, reason = "Must not              @RestrictHeapAccess(access = RestrictHeapAccess.Access.NO_ALLOCATION, reason = "Must not
         public boolean visitRegularFrame(Pointer currentSP, CodePointer currentIP, CodeInfo codeI |           public boolean visitFrame(Pointer currentSP, CodePointer currentIP, CodeInfo codeInfo, De
-            verifyFrameReferencesVisitor.initialize();                                               -            verifyFrameReferencesVisitor.initialize();
+            verifyFrameReferencesVisitor.initialize(currentSP, currentIP);                           +            verifyFrameReferencesVisitor.initialize(currentSP, currentIP);
             CodeInfoTable.visitObjectReferences(currentSP, currentIP, codeInfo, verifyFrameRefere |               CodeInfoTable.visitObjectReferences(currentSP, currentIP, codeInfo, deoptimizedFrame,
             result &= verifyFrameReferencesVisitor.result;                                                        result &= verifyFrameReferencesVisitor.result;
             return true;                                                                                          return true;

Conflicts: [2]

visitObjectReferences update:

         public void visitObjectReferences(Pointer firstObjRef, boolean compressed, int referenceSize, Object holderObject, int count) {
+            assert holderObject == null;
+
             Pointer pos = firstObjRef;
             Pointer end = firstObjRef.add(Word.unsigned(count).multiply(referenceSize));
             while (pos.belowThan(end)) {
-                visitObjectReference(pos, compressed, holderObject);
+                visitObjectReference(pos, compressed);
                 pos = pos.add(referenceSize);
             }
         }
 
-        private void visitObjectReference(Pointer objRef, boolean compressed, Object holderObject) {
-            result &= HeapVerifier.verifyReference(holderObject, objRef, compressed);
+        private void visitObjectReference(Pointer objRef, boolean compressed) {
+            result &= HeapVerifier.verifyReference(this, objRef, compressed);
         }
  • is not applicable without commit 9feb32da update that introduced visitObjectReferences() on the mainline
+++ substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GreyToBlackObjRefVisitor.java
@@ -60,31 +59,32 @@ final class GreyToBlackObjRefVisitor implements ObjectReferenceVisitor {
     }

     @Override
+    @AlwaysInline("GC performance")
     @Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
-    public boolean visitObjectReference(Pointer objRef, boolean compressed, Object holderObject) {
-        return visitObjectReferenceInline(objRef, 0, compressed, holderObject);
+    public void visitObjectReferences(Pointer firstObjRef, boolean compressed, int referenceSize, Object holderObject, int count) {
+        Pointer pos = firstObjRef;
+        Pointer end = firstObjRef.add(Word.unsigned(count).multiply(referenceSize));
+        while (pos.belowThan(end)) {
+            visitObjectReference(pos, compressed, holderObject);
+            pos = pos.add(referenceSize);
+        }
     }

resoltution: skipped.

Closes: #222

…ence on the stack.

(cherry picked from commit 7b247bbec1d38505c42f093078d425864e777e34)
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 10, 2025
@bulasevich bulasevich marked this pull request as ready for review November 12, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backport] [Oracle GraalVM] [GR-67944] Backport to 23.1: Report more information if the heap verification finds a broken reference on the stack.

2 participants