use of com.oracle.svm.core.deopt.DeoptimizedFrame in project graal by oracle.
the class JavaStackWalker method doWalk.
@AlwaysInline("avoid virtual call to visitor")
private static boolean doWalk(JavaFrameAnchor lastAnchor, Pointer startSP, CodePointer startIP, StackFrameVisitor visitor) {
if (!visitor.prologue()) {
return false;
}
if (startSP.isNonNull() && startIP.isNonNull()) {
JavaFrameAnchor anchor = lastAnchor;
Pointer sp = startSP;
CodePointer ip = startIP;
while (true) {
while (anchor.isNonNull() && anchor.getLastJavaSP().belowOrEqual(sp)) {
/* Skip anchors that are in parts of the stack we are not traversing. */
anchor = anchor.getPreviousAnchor();
}
long totalFrameSize;
DeoptimizedFrame deoptFrame = Deoptimizer.checkDeoptimized(sp);
if (deoptFrame != null) {
totalFrameSize = deoptFrame.getSourceTotalFrameSize();
} else {
totalFrameSize = CodeInfoTable.lookupTotalFrameSize(ip);
}
if (totalFrameSize != -1) {
/* This is a Java frame, visit it. */
if (!visitor.visitFrame(sp, ip, deoptFrame)) {
return false;
}
/* Bump sp *up* over my frame. */
sp = sp.add(WordFactory.unsigned(totalFrameSize));
/* Read the return address to my caller. */
ip = FrameAccess.readReturnAddress(sp);
} else if (anchor.isNonNull()) {
/*
* At the end of a block of Java frames, but we have more Java frames after a
* block of C frames.
*/
assert anchor.getLastJavaSP().aboveThan(sp);
sp = anchor.getLastJavaSP();
ip = FrameAccess.readReturnAddress(sp);
anchor = anchor.getPreviousAnchor();
} else {
/* Really at the end of the stack, we are done with walking. */
break;
}
}
} else {
/*
* It is fine for a thread to have no Java frames, for example in the case of a native
* thread that was attached via JNI, but is currently not executing any Java code.
*/
}
return visitor.epilogue();
}
use of com.oracle.svm.core.deopt.DeoptimizedFrame in project graal by oracle.
the class SubstrateUtil method dumpTopFrame.
@NeverInline("catch implicit exceptions")
private static void dumpTopFrame(Log log, Pointer sp, CodePointer ip) {
log.string("TopFrame info:").newline();
log.indent(true);
if (sp.isNonNull() && ip.isNonNull()) {
long totalFrameSize;
DeoptimizedFrame deoptFrame = Deoptimizer.checkDeoptimized(sp);
if (deoptFrame != null) {
log.string("RSP ").zhex(sp.rawValue()).string(" frame was deoptimized:").newline();
log.string("SourcePC ").zhex(deoptFrame.getSourcePC().rawValue()).newline();
totalFrameSize = deoptFrame.getSourceTotalFrameSize();
} else {
log.string("Lookup TotalFrameSize in CodeInfoTable:").newline();
totalFrameSize = CodeInfoTable.lookupTotalFrameSize(ip);
}
log.string("SourceTotalFrameSize ").signed(totalFrameSize).newline();
if (totalFrameSize == -1) {
log.string("Does not look like a Java Frame. Use JavaFrameAnchors to find LastJavaSP:").newline();
JavaFrameAnchor anchor = JavaFrameAnchors.getFrameAnchor();
while (anchor.isNonNull() && anchor.getLastJavaSP().belowOrEqual(sp)) {
anchor = anchor.getPreviousAnchor();
}
if (anchor.isNonNull()) {
log.string("Found matching Anchor:").zhex(anchor.rawValue()).newline();
Pointer lastSp = anchor.getLastJavaSP();
log.string("LastJavaSP ").zhex(lastSp.rawValue()).newline();
CodePointer lastIp = FrameAccess.readReturnAddress(lastSp);
log.string("LastJavaIP ").zhex(lastIp.rawValue()).newline();
}
}
}
log.indent(false);
}
Aggregations