summaryrefslogtreecommitdiffstats
path: root/runtime/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/thread.cc')
-rw-r--r--runtime/thread.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 5ff7490..d2d5be7 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -932,7 +932,10 @@ struct StackDumpVisitor : public StackVisitor {
os << StringPrintf("<@addr=0x%" PRIxPTR "> (a %s)", reinterpret_cast<intptr_t>(o),
PrettyTypeOf(o).c_str());
} else {
- os << StringPrintf("<0x%08x> (a %s)", o->IdentityHashCode(), PrettyTypeOf(o).c_str());
+ // IdentityHashCode can cause thread suspension, which would invalidate o if it moved. So
+ // we get the pretty type beofre we call IdentityHashCode.
+ const std::string pretty_type(PrettyTypeOf(o));
+ os << StringPrintf("<0x%08x> (a %s)", o->IdentityHashCode(), pretty_type.c_str());
}
}
os << "\n";
@@ -1339,7 +1342,6 @@ void Thread::HandleScopeVisitRoots(RootCallback* visitor, void* arg, uint32_t th
}
mirror::Object* Thread::DecodeJObject(jobject obj) const {
- Locks::mutator_lock_->AssertSharedHeld(this);
if (obj == nullptr) {
return nullptr;
}