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/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 9056d96..a81458f 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -145,7 +145,7 @@
if (kDebugExceptionDelivery) {
mirror::String* msg = exception->GetDetailMessage();
std::string str_msg(msg != nullptr ? msg->ToModifiedUtf8() : "");
- self_->DumpStack(LOG_STREAM(INFO) << "Delivering exception: " << PrettyTypeOf(exception)
+ self_->DumpStack(LOG_STREAM(INFO) << "Delivering exception: " << exception->PrettyTypeOf()
<< ": " << str_msg << "\n");
}
StackHandleScope<1> hs(self_);
@@ -162,7 +162,8 @@
if (handler_method_ != nullptr) {
const DexFile* dex_file = handler_method_->GetDeclaringClass()->GetDexCache()->GetDexFile();
int line_number = annotations::GetLineNumFromPC(dex_file, handler_method_, handler_dex_pc_);
- LOG(INFO) << "Handler: " << PrettyMethod(handler_method_) << " (line: " << line_number << ")";
+ LOG(INFO) << "Handler: " << handler_method_->PrettyMethod() << " (line: "
+ << line_number << ")";
}
}
if (clear_exception_) {
@@ -262,8 +263,8 @@
vreg_kind,
&vreg_value);
CHECK(get_vreg_success) << "VReg " << vreg << " was optimized out ("
- << "method=" << PrettyMethod(stack_visitor->GetMethod()) << ", "
- << "dex_pc=" << stack_visitor->GetDexPc() << ", "
+ << "method=" << ArtMethod::PrettyMethod(stack_visitor->GetMethod())
+ << ", dex_pc=" << stack_visitor->GetDexPc() << ", "
<< "native_pc_offset=" << stack_visitor->GetNativePcOffset() << ")";
// Copy value to the catch phi's stack slot.
@@ -323,7 +324,7 @@
if (GetMethod() == nullptr) {
exception_handler_->SetFullFragmentDone(true);
} else {
- CHECK(callee_method_ != nullptr) << art::PrettyMethod(GetMethod(), false);
+ CHECK(callee_method_ != nullptr) << GetMethod()->PrettyMethod(false);
exception_handler_->SetHandlerQuickArg0(reinterpret_cast<uintptr_t>(callee_method_));
}
}
@@ -669,7 +670,7 @@
return true;
} else if (method->IsRuntimeMethod()) {
if (show_details_) {
- LOG(INFO) << "R " << PrettyMethod(method, true);
+ LOG(INFO) << "R " << method->PrettyMethod(true);
}
return true;
} else {
@@ -677,7 +678,7 @@
LOG(INFO) << (is_shadow ? "S" : "Q")
<< ((!is_shadow && IsInInlinedFrame()) ? "i" : " ")
<< " "
- << PrettyMethod(method, true);
+ << method->PrettyMethod(true);
return true; // Go on.
}
}