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/dex_instruction.cc b/runtime/dex_instruction.cc
index c31d236..c766b54 100644
--- a/runtime/dex_instruction.cc
+++ b/runtime/dex_instruction.cc
@@ -209,7 +209,7 @@
case NEW_INSTANCE:
if (file != nullptr) {
uint32_t type_idx = VRegB_21c();
- os << opcode << " v" << static_cast<int>(VRegA_21c()) << ", " << PrettyType(type_idx, *file)
+ os << opcode << " v" << static_cast<int>(VRegA_21c()) << ", " << file->PrettyType(type_idx)
<< " // type@" << type_idx;
break;
}
@@ -223,7 +223,7 @@
case SGET_SHORT:
if (file != nullptr) {
uint32_t field_idx = VRegB_21c();
- os << opcode << " v" << static_cast<int>(VRegA_21c()) << ", " << PrettyField(field_idx, *file, true)
+ os << opcode << " v" << static_cast<int>(VRegA_21c()) << ", " << file->PrettyField(field_idx, true)
<< " // field@" << field_idx;
break;
}
@@ -237,7 +237,7 @@
case SPUT_SHORT:
if (file != nullptr) {
uint32_t field_idx = VRegB_21c();
- os << opcode << " v" << static_cast<int>(VRegA_21c()) << ", " << PrettyField(field_idx, *file, true)
+ os << opcode << " v" << static_cast<int>(VRegA_21c()) << ", " << file->PrettyField(field_idx, true)
<< " // field@" << field_idx;
break;
}
@@ -264,7 +264,7 @@
if (file != nullptr) {
uint32_t field_idx = VRegC_22c();
os << opcode << " v" << static_cast<int>(VRegA_22c()) << ", v" << static_cast<int>(VRegB_22c()) << ", "
- << PrettyField(field_idx, *file, true) << " // field@" << field_idx;
+ << file->PrettyField(field_idx, true) << " // field@" << field_idx;
break;
}
FALLTHROUGH_INTENDED;
@@ -287,7 +287,7 @@
if (file != nullptr) {
uint32_t field_idx = VRegC_22c();
os << opcode << " v" << static_cast<int>(VRegA_22c()) << ", v" << static_cast<int>(VRegB_22c()) << ", "
- << PrettyField(field_idx, *file, true) << " // field@" << field_idx;
+ << file->PrettyField(field_idx, true) << " // field@" << field_idx;
break;
}
FALLTHROUGH_INTENDED;
@@ -304,7 +304,7 @@
if (file != nullptr) {
uint32_t type_idx = VRegC_22c();
os << opcode << " v" << static_cast<int>(VRegA_22c()) << ", v" << static_cast<int>(VRegB_22c()) << ", "
- << PrettyType(type_idx, *file) << " // type@" << type_idx;
+ << file->PrettyType(type_idx) << " // type@" << type_idx;
break;
}
FALLTHROUGH_INTENDED;
@@ -312,7 +312,7 @@
if (file != nullptr) {
uint32_t type_idx = VRegC_22c();
os << opcode << " v" << static_cast<int>(VRegA_22c()) << ", v" << static_cast<int>(VRegB_22c()) << ", "
- << PrettyType(type_idx, *file) << " // type@" << type_idx;
+ << file->PrettyType(type_idx) << " // type@" << type_idx;
break;
}
FALLTHROUGH_INTENDED;
@@ -382,7 +382,7 @@
}
os << "v" << arg[i];
}
- os << "}, " << PrettyMethod(method_idx, *file) << " // method@" << method_idx;
+ os << "}, " << file->PrettyMethod(method_idx) << " // method@" << method_idx;
break;
}
FALLTHROUGH_INTENDED;
@@ -417,7 +417,7 @@
if (file != nullptr) {
uint32_t method_idx = VRegB_3rc();
os << StringPrintf("%s, {v%d .. v%d}, ", opcode, VRegC_3rc(), (VRegC_3rc() + VRegA_3rc() - 1))
- << PrettyMethod(method_idx, *file) << " // method@" << method_idx;
+ << file->PrettyMethod(method_idx) << " // method@" << method_idx;
break;
}
FALLTHROUGH_INTENDED;