Improve VerifyNoFromSpaceRefsObjectVisitor logging
Remove read barriers in PrettyTypeOf to prevent recursive failures.
Pass down holder and offset information to
VerifyNoFromSpaceRefsFieldVisitor.
Test: test-art-host
Bug: 37531237
Change-Id: I704ec18ebecfc1ca2982b38f67a2f0788e59dfe9
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc
index f5b9ab3..eabc29a 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -281,12 +281,16 @@
}
std::string Object::PrettyTypeOf() {
- if (GetClass() == nullptr) {
+ // From-space version is the same as the to-space version since the dex file never changes.
+ // Avoiding the read barrier here is important to prevent recursive AssertToSpaceInvariant
+ // issues.
+ ObjPtr<mirror::Class> klass = GetClass<kDefaultVerifyFlags, kWithoutReadBarrier>();
+ if (klass == nullptr) {
return "(raw)";
}
std::string temp;
- std::string result(PrettyDescriptor(GetClass()->GetDescriptor(&temp)));
- if (IsClass()) {
+ std::string result(PrettyDescriptor(klass->GetDescriptor(&temp)));
+ if (klass->IsClassClass()) {
result += "<" + PrettyDescriptor(AsClass()->GetDescriptor(&temp)) + ">";
}
return result;