Skip to content
Open
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 @@ -36,6 +36,7 @@
import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.config.ConfigurationValues;
import com.oracle.svm.core.genscavenge.AlignedHeapChunk.AlignedHeader;
import com.oracle.svm.core.genscavenge.StackVerifier.VerifyFrameReferencesVisitor;
import com.oracle.svm.core.genscavenge.UnalignedHeapChunk.UnalignedHeader;
import com.oracle.svm.core.genscavenge.remset.RememberedSet;
import com.oracle.svm.core.heap.Heap;
Expand Down Expand Up @@ -390,10 +391,11 @@ private static boolean verifyReference(Object parentObject, Pointer reference, P
}

private static void printParent(Object parentObject) {
if (parentObject != null) {
Log.log().string("The object that contains the invalid reference is of type ").string(parentObject.getClass().getName()).newline();
if (parentObject instanceof VerifyFrameReferencesVisitor visitor) {
Log.log().string("The invalid reference is on the stack: sp=").zhex(visitor.getSP()).string(", ip=").zhex(visitor.getIP()).newline();
} else {
Log.log().string("The invalid reference is on the stack").newline();
assert parentObject != null;
Log.log().string("The object that contains the invalid reference is of type ").string(parentObject.getClass().getName()).newline();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,37 @@ public void initialize() {
@Override
@RestrictHeapAccess(access = RestrictHeapAccess.Access.NO_ALLOCATION, reason = "Must not allocate while verifying the stack.")
public boolean visitFrame(Pointer currentSP, CodePointer currentIP, CodeInfo codeInfo, DeoptimizedFrame deoptimizedFrame) {
verifyFrameReferencesVisitor.initialize();
verifyFrameReferencesVisitor.initialize(currentSP, currentIP);
CodeInfoTable.visitObjectReferences(currentSP, currentIP, codeInfo, deoptimizedFrame, verifyFrameReferencesVisitor);
result &= verifyFrameReferencesVisitor.result;
return true;
}
}

private static class VerifyFrameReferencesVisitor implements ObjectReferenceVisitor {
public static class VerifyFrameReferencesVisitor implements ObjectReferenceVisitor {
private Pointer sp;
private CodePointer ip;
private boolean result;

@Platforms(Platform.HOSTED_ONLY.class)
VerifyFrameReferencesVisitor() {
}

public void initialize() {
@SuppressWarnings("hiding")
public void initialize(Pointer sp, CodePointer ip) {
this.sp = sp;
this.ip = ip;
this.result = true;
}

public Pointer getSP() {
return sp;
}

public CodePointer getIP() {
return ip;
}

@Override
public boolean visitObjectReference(Pointer objRef, boolean compressed, Object holderObject) {
result &= HeapVerifier.verifyReference(holderObject, objRef, compressed);
Expand Down