Remove mirror:: and ArtMethod deps in utils.{h,cc}
The latest chapter in the ongoing saga of attempting to dump a DEX
file without having to start a whole runtime instance. This episode
finds us removing references to ArtMethod/ArtField/mirror.
One aspect of this change that I would like to call out specfically
is that the utils versions of the "Pretty*" functions all were written
to accept nullptr as an argument. I have split these functions up as
follows:
1) an instance method, such as PrettyClass that obviously requires
this != nullptr.
2) a static method, that behaves the same way as the util method, but
calls the instance method if p != nullptr.
This requires using a full class qualifier for the static methods,
which isn't exactly beautiful. I have tried to remove as many cases
as possible where it was clear p != nullptr.
Bug: 22322814
Test: test-art-host
Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 8077c21..31811fb 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -148,12 +148,13 @@
}
if (kAccessCheck) {
if (UNLIKELY(!klass->IsInstantiable())) {
- self->ThrowNewException("Ljava/lang/InstantiationError;", PrettyDescriptor(klass).c_str());
+ self->ThrowNewException("Ljava/lang/InstantiationError;", klass->PrettyDescriptor().c_str());
*slow_path = true;
return nullptr; // Failure
}
if (UNLIKELY(klass->IsClassClass())) {
- ThrowIllegalAccessError(nullptr, "Class %s is inaccessible", PrettyDescriptor(klass).c_str());
+ ThrowIllegalAccessError(nullptr, "Class %s is inaccessible",
+ klass->PrettyDescriptor().c_str());
*slow_path = true;
return nullptr; // Failure
}
@@ -293,7 +294,7 @@
DCHECK(Thread::Current()->IsExceptionPending());
return nullptr; // Failure
}
- CHECK(klass->IsArrayClass()) << PrettyClass(klass);
+ CHECK(klass->IsArrayClass()) << klass->PrettyClass();
}
if (kAccessCheck) {
mirror::Class* referrer = method->GetDeclaringClass();
@@ -433,7 +434,7 @@
"Attempted read of %zd-bit %s on field '%s'",
expected_size * (32 / sizeof(int32_t)),
is_primitive ? "primitive" : "non-primitive",
- PrettyField(resolved_field, true).c_str());
+ resolved_field->PrettyField(true).c_str());
return nullptr; // Failure.
}
}
@@ -549,7 +550,7 @@
resolved_method->GetName(), resolved_method->GetSignature());
return nullptr; // Failure.
}
- DCHECK(klass->HasVTable()) << PrettyClass(klass);
+ DCHECK(klass->HasVTable()) << klass->PrettyClass();
return klass->GetVTableEntry(vtable_index, class_linker->GetImagePointerSize());
}
case kSuper: {
@@ -624,9 +625,10 @@
mirror::Class* klass = (*this_object)->GetClass();
ArtMethod* method = klass->FindVirtualMethodForInterface(
resolved_method, class_linker->GetImagePointerSize());
- CHECK_EQ(imt_method, method) << PrettyMethod(resolved_method) << " / " <<
- PrettyMethod(imt_method) << " / " << PrettyMethod(method) << " / " <<
- PrettyClass(klass);
+ CHECK_EQ(imt_method, method) << ArtMethod::PrettyMethod(resolved_method) << " / "
+ << imt_method->PrettyMethod() << " / "
+ << ArtMethod::PrettyMethod(method) << " / "
+ << klass->PrettyClass();
}
return imt_method;
} else {