@@ -89,7 +89,7 @@ public void initialize() {
89
89
@ Override
90
90
@ RestrictHeapAccess (access = RestrictHeapAccess .Access .NO_ALLOCATION , reason = "Must not allocate while verifying the stack." )
91
91
public boolean visitRegularFrame (Pointer currentSP , CodePointer currentIP , CodeInfo codeInfo ) {
92
- verifyFrameReferencesVisitor .initialize ();
92
+ verifyFrameReferencesVisitor .initialize (currentSP , currentIP );
93
93
CodeInfoTable .visitObjectReferences (currentSP , currentIP , codeInfo , verifyFrameReferencesVisitor );
94
94
result &= verifyFrameReferencesVisitor .result ;
95
95
return true ;
@@ -103,29 +103,44 @@ protected boolean visitDeoptimizedFrame(Pointer originalSP, CodePointer deoptStu
103
103
}
104
104
}
105
105
106
- private static class VerifyFrameReferencesVisitor implements ObjectReferenceVisitor {
106
+ public static class VerifyFrameReferencesVisitor implements ObjectReferenceVisitor {
107
+ private Pointer sp ;
108
+ private CodePointer ip ;
107
109
private boolean result ;
108
110
109
111
@ Platforms (Platform .HOSTED_ONLY .class )
110
112
VerifyFrameReferencesVisitor () {
111
113
}
112
114
113
- public void initialize () {
115
+ @ SuppressWarnings ("hiding" )
116
+ public void initialize (Pointer sp , CodePointer ip ) {
117
+ this .sp = sp ;
118
+ this .ip = ip ;
114
119
this .result = true ;
115
120
}
116
121
122
+ public Pointer getSP () {
123
+ return sp ;
124
+ }
125
+
126
+ public CodePointer getIP () {
127
+ return ip ;
128
+ }
129
+
117
130
@ Override
118
131
public void visitObjectReferences (Pointer firstObjRef , boolean compressed , int referenceSize , Object holderObject , int count ) {
132
+ assert holderObject == null ;
133
+
119
134
Pointer pos = firstObjRef ;
120
135
Pointer end = firstObjRef .add (Word .unsigned (count ).multiply (referenceSize ));
121
136
while (pos .belowThan (end )) {
122
- visitObjectReference (pos , compressed , holderObject );
137
+ visitObjectReference (pos , compressed );
123
138
pos = pos .add (referenceSize );
124
139
}
125
140
}
126
141
127
- private void visitObjectReference (Pointer objRef , boolean compressed , Object holderObject ) {
128
- result &= HeapVerifier .verifyReference (holderObject , objRef , compressed );
142
+ private void visitObjectReference (Pointer objRef , boolean compressed ) {
143
+ result &= HeapVerifier .verifyReference (this , objRef , compressed );
129
144
}
130
145
}
131
146
}
0 commit comments