summaryrefslogtreecommitdiff
path: root/src/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread.cc')
-rw-r--r--src/thread.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/thread.cc b/src/thread.cc
index 6b340d2784..ae460e48d9 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1330,6 +1330,8 @@ StackIndirectReferenceTable* Thread::PopSirt() {
return sirt;
}
+#if !defined(ART_USE_LLVM_COMPILER) // LLVM use ShadowFrame
+
void Thread::WalkStack(StackVisitor* visitor, bool include_upcalls) const {
Frame frame = GetTopOfStack();
uintptr_t pc = ManglePc(top_of_managed_stack_pc_);
@@ -1375,6 +1377,60 @@ void Thread::WalkStack(StackVisitor* visitor, bool include_upcalls) const {
}
}
+#else // defined(ART_USE_LLVM_COMPILER) // LLVM uses ShadowFrame
+
+void Thread::WalkStack(StackVisitor* visitor, bool /*include_upcalls*/) const {
+ for (ShadowFrame* cur = top_shadow_frame_; cur; cur = cur->GetLink()) {
+ Frame frame;
+ frame.SetSP(reinterpret_cast<Method**>(reinterpret_cast<byte*>(cur) +
+ ShadowFrame::MethodOffset()));
+ bool should_continue = visitor->VisitFrame(frame, 0);
+ if (!should_continue) {
+ return;
+ }
+ }
+}
+
+/*
+ * | |
+ * | |
+ * | |
+ * | . |
+ * | . |
+ * | . |
+ * | . |
+ * | Method* |
+ * | . |
+ * | . | <-- top_shadow_frame_ (ShadowFrame*)
+ * / +------------------------+
+ * ->| . |
+ * . | . |
+ * . | . |
+ * /+------------------------+
+ * / | . |
+ * / | . |
+ * --- | | . |
+ * | | | . |
+ * | | Method* | <-- frame.GetSP() (Method**)
+ * ShadowFrame \ | . |
+ * | ->| . | <-- cur (ShadowFrame*)
+ * --- /+------------------------+
+ * / | . |
+ * / | . |
+ * --- | | . |
+ * | cur->GetLink() | | . |
+ * | | Method* |
+ * ShadowFrame \ | . |
+ * | ->| . |
+ * --- +------------------------+
+ * | . |
+ * | . |
+ * | . |
+ * +========================+
+ */
+
+#endif
+
jobject Thread::CreateInternalStackTrace(JNIEnv* env) const {
// Compute depth of stack
CountStackDepthVisitor count_visitor;