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/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index bc8facd..51bf9ea 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -86,7 +86,7 @@
MakeExecutable(code_ptr, code.size());
const void* method_code = CompiledMethod::CodePointer(code_ptr,
compiled_method->GetInstructionSet());
- LOG(INFO) << "MakeExecutable " << PrettyMethod(method) << " code=" << method_code;
+ LOG(INFO) << "MakeExecutable " << method->PrettyMethod() << " code=" << method_code;
class_linker_->SetEntryPointsToCompiledCode(method, method_code);
} else {
// No code? You must mean to go into the interpreter.
diff --git a/compiler/compiler.cc b/compiler/compiler.cc
index 1626317..c500921 100644
--- a/compiler/compiler.cc
+++ b/compiler/compiler.cc
@@ -47,12 +47,12 @@
if (code_item.insns_size_in_code_units_ >= UINT16_MAX / 4) {
LOG(INFO) << "Method exceeds compiler instruction limit: "
<< code_item.insns_size_in_code_units_
- << " in " << PrettyMethod(method_idx, dex_file);
+ << " in " << dex_file.PrettyMethod(method_idx);
return true;
}
if (code_item.registers_size_ >= UINT16_MAX / 4) {
LOG(INFO) << "Method exceeds compiler virtual register limit: "
- << code_item.registers_size_ << " in " << PrettyMethod(method_idx, dex_file);
+ << code_item.registers_size_ << " in " << dex_file.PrettyMethod(method_idx);
return true;
}
return false;
diff --git a/compiler/debug/elf_symtab_writer.h b/compiler/debug/elf_symtab_writer.h
index 045eddd..af9f091 100644
--- a/compiler/debug/elf_symtab_writer.h
+++ b/compiler/debug/elf_symtab_writer.h
@@ -69,7 +69,7 @@
name_offset = strtab->Write(info.trampoline_name);
} else {
DCHECK(info.dex_file != nullptr);
- std::string name = PrettyMethod(info.dex_method_index, *info.dex_file, with_signature);
+ std::string name = info.dex_file->PrettyMethod(info.dex_method_index, with_signature);
if (deduped_addresses.find(info.code_address) != deduped_addresses.end()) {
name += " [DEDUPED]";
}
diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc
index 236a3b2..9c1d72b 100644
--- a/compiler/dex/dex_to_dex_compiler.cc
+++ b/compiler/dex/dex_to_dex_compiler.cc
@@ -212,7 +212,7 @@
VLOG(compiler) << "Replacing " << Instruction::Name(inst->Opcode())
<< " by " << Instruction::Name(Instruction::RETURN_VOID_NO_BARRIER)
<< " at dex pc " << StringPrintf("0x%x", dex_pc) << " in method "
- << PrettyMethod(unit_.GetDexMethodIndex(), GetDexFile(), true);
+ << GetDexFile().PrettyMethod(unit_.GetDexMethodIndex(), true);
inst->SetOpcode(Instruction::RETURN_VOID_NO_BARRIER);
}
@@ -232,7 +232,7 @@
VLOG(compiler) << "Removing " << Instruction::Name(inst->Opcode())
<< " by replacing it with 2 NOPs at dex pc "
<< StringPrintf("0x%x", dex_pc) << " in method "
- << PrettyMethod(unit_.GetDexMethodIndex(), GetDexFile(), true);
+ << GetDexFile().PrettyMethod(unit_.GetDexMethodIndex(), true);
// We are modifying 4 consecutive bytes.
inst->SetOpcode(Instruction::NOP);
inst->SetVRegA_10x(0u); // keep compliant with verifier.
@@ -262,7 +262,7 @@
<< " by replacing field index " << field_idx
<< " by field offset " << field_offset.Int32Value()
<< " at dex pc " << StringPrintf("0x%x", dex_pc) << " in method "
- << PrettyMethod(unit_.GetDexMethodIndex(), GetDexFile(), true);
+ << GetDexFile().PrettyMethod(unit_.GetDexMethodIndex(), true);
// We are modifying 4 consecutive bytes.
inst->SetOpcode(new_opcode);
// Replace field index by field offset.
@@ -300,12 +300,12 @@
uint32_t vtable_idx = resolved_method->GetMethodIndex();
DCHECK(IsUint<16>(vtable_idx));
VLOG(compiler) << "Quickening " << Instruction::Name(inst->Opcode())
- << "(" << PrettyMethod(method_idx, GetDexFile(), true) << ")"
+ << "(" << GetDexFile().PrettyMethod(method_idx, true) << ")"
<< " to " << Instruction::Name(new_opcode)
<< " by replacing method index " << method_idx
<< " by vtable index " << vtable_idx
<< " at dex pc " << StringPrintf("0x%x", dex_pc) << " in method "
- << PrettyMethod(unit_.GetDexMethodIndex(), GetDexFile(), true);
+ << GetDexFile().PrettyMethod(unit_.GetDexMethodIndex(), true);
// We are modifying 4 consecutive bytes.
inst->SetOpcode(new_opcode);
// Replace method index by vtable index.
diff --git a/compiler/dex/verification_results.cc b/compiler/dex/verification_results.cc
index d87762d..511a787 100644
--- a/compiler/dex/verification_results.cc
+++ b/compiler/dex/verification_results.cc
@@ -58,8 +58,7 @@
auto it = verified_methods_.find(ref);
if (it != verified_methods_.end()) {
// TODO: Investigate why are we doing the work again for this method and try to avoid it.
- LOG(WARNING) << "Method processed more than once: "
- << PrettyMethod(ref.dex_method_index, *ref.dex_file);
+ LOG(WARNING) << "Method processed more than once: " << ref.PrettyMethod();
if (!Runtime::Current()->UseJitCompilation()) {
DCHECK_EQ(it->second->GetDevirtMap().size(), verified_method->GetDevirtMap().size());
DCHECK_EQ(it->second->GetSafeCastSet().size(), verified_method->GetSafeCastSet().size());
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index afaec52..7d2abdf 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -617,7 +617,7 @@
if (kTimeCompileMethod) {
uint64_t duration_ns = NanoTime() - start_ns;
if (duration_ns > MsToNs(driver->GetCompiler()->GetMaximumCompilationTimeBeforeWarning())) {
- LOG(WARNING) << "Compilation of " << PrettyMethod(method_idx, dex_file)
+ LOG(WARNING) << "Compilation of " << dex_file.PrettyMethod(method_idx)
<< " took " << PrettyDuration(duration_ns);
}
}
@@ -639,7 +639,7 @@
if (self->IsExceptionPending()) {
ScopedObjectAccess soa(self);
- LOG(FATAL) << "Unexpected exception compiling: " << PrettyMethod(method_idx, dex_file) << "\n"
+ LOG(FATAL) << "Unexpected exception compiling: " << dex_file.PrettyMethod(method_idx) << "\n"
<< self->GetException()->Dump();
}
}
@@ -940,7 +940,7 @@
return true;
}
- std::string tmp = PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file, true);
+ std::string tmp = method_ref.dex_file->PrettyMethod(method_ref.dex_method_index, true);
return methods_to_compile_->find(tmp.c_str()) != methods_to_compile_->end();
}
@@ -955,7 +955,7 @@
if (kDebugProfileGuidedCompilation) {
LOG(INFO) << "[ProfileGuidedCompilation] "
<< (result ? "Compiled" : "Skipped") << " method:"
- << PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file, true);
+ << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index, true);
}
return result;
}
@@ -1679,7 +1679,7 @@
const DexFile& original_dex_file = *klass->GetDexCache()->GetDexFile();
if (&dex_file != &original_dex_file) {
if (class_loader == nullptr) {
- LOG(WARNING) << "Skipping class " << PrettyDescriptor(klass) << " from "
+ LOG(WARNING) << "Skipping class " << klass->PrettyDescriptor() << " from "
<< dex_file.GetLocation() << " previously found in "
<< original_dex_file.GetLocation();
}
@@ -1991,7 +1991,7 @@
manager_->GetCompiler()->SetHadHardVerifierFailure();
}
} else if (!SkipClass(jclass_loader, dex_file, klass.Get())) {
- CHECK(klass->IsResolved()) << PrettyClass(klass.Get());
+ CHECK(klass->IsResolved()) << klass->PrettyClass();
class_linker->VerifyClass(soa.Self(), klass, log_level_);
if (klass->IsErroneous()) {
@@ -2002,13 +2002,14 @@
}
CHECK(klass->IsCompileTimeVerified() || klass->IsErroneous())
- << PrettyDescriptor(klass.Get()) << ": state=" << klass->GetStatus();
+ << klass->PrettyDescriptor() << ": state=" << klass->GetStatus();
// It is *very* problematic if there are verification errors in the boot classpath. For example,
// we rely on things working OK without verification when the decryption dialog is brought up.
// So abort in a debug build if we find this violated.
DCHECK(!manager_->GetCompiler()->GetCompilerOptions().IsBootImage() || klass->IsVerified())
- << "Boot classpath class " << PrettyClass(klass.Get()) << " failed to fully verify.";
+ << "Boot classpath class " << klass->PrettyClass()
+ << " failed to fully verify.";
}
soa.Self()->AssertNoPendingException();
}
@@ -2446,14 +2447,14 @@
CompiledMethod* const compiled_method,
size_t non_relative_linker_patch_count) {
DCHECK(GetCompiledMethod(method_ref) == nullptr)
- << PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file);
+ << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index);
{
MutexLock mu(Thread::Current(), compiled_methods_lock_);
compiled_methods_.Put(method_ref, compiled_method);
non_relative_linker_patch_count_ += non_relative_linker_patch_count;
}
DCHECK(GetCompiledMethod(method_ref) != nullptr)
- << PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file);
+ << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index);
}
void CompilerDriver::RemoveCompiledMethod(const MethodReference& method_ref) {
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index e323b16..20f0e5e 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -216,7 +216,7 @@
const auto pointer_size = class_linker->GetImagePointerSize();
for (auto& m : klass->GetDirectMethods(pointer_size)) {
- std::string name = PrettyMethod(&m, true);
+ std::string name = m.PrettyMethod(true);
const void* code = m.GetEntryPointFromQuickCompiledCodePtrSize(pointer_size);
ASSERT_NE(code, nullptr);
if (expected->find(name) != expected->end()) {
@@ -273,7 +273,7 @@
const auto pointer_size = class_linker->GetImagePointerSize();
size_t number_of_compiled_methods = 0;
for (auto& m : klass->GetVirtualMethods(pointer_size)) {
- std::string name = PrettyMethod(&m, true);
+ std::string name = m.PrettyMethod(true);
const void* code = m.GetEntryPointFromQuickCompiledCodePtrSize(pointer_size);
ASSERT_NE(code, nullptr);
if (expected_methods.find(name) != expected_methods.end()) {
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 3c920d9..4eb6954 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -29,6 +29,8 @@
namespace art {
+class DexFile;
+
class CompilerOptions FINAL {
public:
// Guide heuristics to determine whether to compile method if profile data not available.
diff --git a/compiler/driver/dex_compilation_unit.cc b/compiler/driver/dex_compilation_unit.cc
index b0ee448..64fd9e7 100644
--- a/compiler/driver/dex_compilation_unit.cc
+++ b/compiler/driver/dex_compilation_unit.cc
@@ -45,7 +45,7 @@
const std::string& DexCompilationUnit::GetSymbol() {
if (symbol_.empty()) {
symbol_ = "dex_";
- symbol_ += MangleForJni(PrettyMethod(dex_method_idx_, *dex_file_));
+ symbol_ += MangleForJni(dex_file_->PrettyMethod(dex_method_idx_));
}
return symbol_;
}
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 8f15ea4..b19a95b 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -114,7 +114,7 @@
static void CheckNoDexObjectsCallback(Object* obj, void* arg ATTRIBUTE_UNUSED)
REQUIRES_SHARED(Locks::mutator_lock_) {
Class* klass = obj->GetClass();
- CHECK_NE(PrettyClass(klass), "com.android.dex.Dex");
+ CHECK_NE(Class::PrettyClass(klass), "com.android.dex.Dex");
}
static void CheckNoDexObjects() {
@@ -489,7 +489,7 @@
if (method != nullptr && !method->IsRuntimeMethod()) {
mirror::Class* klass = method->GetDeclaringClass();
CHECK(klass == nullptr || KeepClass(klass))
- << PrettyClass(klass) << " should be a kept class";
+ << Class::PrettyClass(klass) << " should be a kept class";
}
}
}
@@ -757,7 +757,7 @@
if (klass->GetStatus() == mirror::Class::kStatusError) {
result = true;
} else {
- CHECK(klass->GetVerifyError() == nullptr) << PrettyClass(klass);
+ CHECK(klass->GetVerifyError() == nullptr) << klass->PrettyClass();
}
if (!result) {
// Check interfaces since these wont be visited through VisitReferences.)
@@ -910,7 +910,7 @@
} else {
// Check that the class is still in the classes table.
DCHECK(class_linker->ClassInClassTable(declaring_class)) << "Class "
- << PrettyClass(declaring_class) << " not in class linker table";
+ << Class::PrettyClass(declaring_class) << " not in class linker table";
}
}
ArtField** resolved_fields = dex_cache->GetResolvedFields();
@@ -947,7 +947,7 @@
image_writer->DumpImageClasses();
std::string temp;
CHECK(image_writer->KeepClass(klass)) << klass->GetDescriptor(&temp)
- << " " << PrettyDescriptor(klass);
+ << " " << klass->PrettyDescriptor();
}
}
}
@@ -1100,7 +1100,7 @@
DCHECK_NE(as_klass->GetStatus(), mirror::Class::kStatusError);
if (compile_app_image_) {
// Extra sanity, no boot loader classes should be left!
- CHECK(!IsBootClassLoaderClass(as_klass)) << PrettyClass(as_klass);
+ CHECK(!IsBootClassLoaderClass(as_klass)) << as_klass->PrettyClass();
}
LengthPrefixedArray<ArtField>* fields[] = {
as_klass->GetSFieldsPtr(), as_klass->GetIFieldsPtr(),
@@ -1136,7 +1136,7 @@
ArtField* field = &cur_fields->At(i);
auto it2 = native_object_relocations_.find(field);
CHECK(it2 == native_object_relocations_.end()) << "Field at index=" << i
- << " already assigned " << PrettyField(field) << " static=" << field->IsStatic();
+ << " already assigned " << field->PrettyField() << " static=" << field->IsStatic();
DCHECK(!IsInBootImage(field));
native_object_relocations_.emplace(
field,
@@ -1268,7 +1268,7 @@
size_t oat_index) {
DCHECK(!IsInBootImage(method));
CHECK(!NativeRelocationAssigned(method)) << "Method " << method << " already assigned "
- << PrettyMethod(method);
+ << ArtMethod::PrettyMethod(method);
if (method->IsRuntimeMethod()) {
TryAssignConflictTableOffset(method->GetImtConflictTable(target_ptr_size_), oat_index);
}
@@ -1282,7 +1282,7 @@
ImageWriter* writer = reinterpret_cast<ImageWriter*>(arg);
DCHECK(writer != nullptr);
if (!Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(obj)) {
- CHECK(writer->IsImageBinSlotAssigned(obj)) << PrettyTypeOf(obj) << " " << obj;
+ CHECK(writer->IsImageBinSlotAssigned(obj)) << mirror::Object::PrettyTypeOf(obj) << " " << obj;
}
}
@@ -1690,7 +1690,8 @@
ArtMethod* ImageWriter::GetImageMethodAddress(ArtMethod* method) {
auto it = native_object_relocations_.find(method);
- CHECK(it != native_object_relocations_.end()) << PrettyMethod(method) << " @ " << method;
+ CHECK(it != native_object_relocations_.end()) << ArtMethod::PrettyMethod(method) << " @ "
+ << method;
size_t oat_index = GetOatIndex(method->GetDexCache());
ImageInfo& image_info = GetImageInfo(oat_index);
CHECK_GE(it->second.offset, image_info.image_end_) << "ArtMethods should be after Objects";
@@ -1877,7 +1878,7 @@
void ImageWriter::FixupPointerArray(mirror::Object* dst, mirror::PointerArray* arr,
mirror::Class* klass, Bin array_type) {
CHECK(klass->IsArrayClass());
- CHECK(arr->IsIntArray() || arr->IsLongArray()) << PrettyClass(klass) << " " << arr;
+ CHECK(arr->IsIntArray() || arr->IsLongArray()) << klass->PrettyClass() << " " << arr;
// Fixup int and long pointers for the ArtMethod or ArtField arrays.
const size_t num_elements = arr->GetLength();
dst->SetClass(GetImageAddress(arr->GetClass()));
@@ -1889,15 +1890,15 @@
if (UNLIKELY(it == native_object_relocations_.end())) {
if (it->second.IsArtMethodRelocation()) {
auto* method = reinterpret_cast<ArtMethod*>(elem);
- LOG(FATAL) << "No relocation entry for ArtMethod " << PrettyMethod(method) << " @ "
- << method << " idx=" << i << "/" << num_elements << " with declaring class "
- << PrettyClass(method->GetDeclaringClass());
+ LOG(FATAL) << "No relocation entry for ArtMethod " << method->PrettyMethod() << " @ "
+ << method << " idx=" << i << "/" << num_elements << " with declaring class "
+ << Class::PrettyClass(method->GetDeclaringClass());
} else {
CHECK_EQ(array_type, kBinArtField);
auto* field = reinterpret_cast<ArtField*>(elem);
- LOG(FATAL) << "No relocation entry for ArtField " << PrettyField(field) << " @ "
+ LOG(FATAL) << "No relocation entry for ArtField " << field->PrettyField() << " @ "
<< field << " idx=" << i << "/" << num_elements << " with declaring class "
- << PrettyClass(field->GetDeclaringClass());
+ << Class::PrettyClass(field->GetDeclaringClass());
}
UNREACHABLE();
} else {
@@ -2013,7 +2014,7 @@
template <>
std::string PrettyPrint(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) {
- return PrettyMethod(method);
+ return ArtMethod::PrettyMethod(method);
}
template <typename T>
@@ -2228,11 +2229,11 @@
const uint8_t* ImageWriter::GetQuickCode(ArtMethod* method,
const ImageInfo& image_info,
bool* quick_is_interpreted) {
- DCHECK(!method->IsResolutionMethod()) << PrettyMethod(method);
- DCHECK_NE(method, Runtime::Current()->GetImtConflictMethod()) << PrettyMethod(method);
- DCHECK(!method->IsImtUnimplementedMethod()) << PrettyMethod(method);
- DCHECK(method->IsInvokable()) << PrettyMethod(method);
- DCHECK(!IsInBootImage(method)) << PrettyMethod(method);
+ DCHECK(!method->IsResolutionMethod()) << method->PrettyMethod();
+ DCHECK_NE(method, Runtime::Current()->GetImtConflictMethod()) << method->PrettyMethod();
+ DCHECK(!method->IsImtUnimplementedMethod()) << method->PrettyMethod();
+ DCHECK(method->IsInvokable()) << method->PrettyMethod();
+ DCHECK(!IsInBootImage(method)) << method->PrettyMethod();
// Use original code if it exists. Otherwise, set the code pointer to the resolution
// trampoline.
@@ -2310,7 +2311,7 @@
break;
}
}
- CHECK(found_one) << "Expected to find callee save method but got " << PrettyMethod(orig);
+ CHECK(found_one) << "Expected to find callee save method but got " << orig->PrettyMethod();
CHECK(copy->IsRuntimeMethod());
}
} else {
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index 4ef2db8..c398703 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -208,7 +208,7 @@
// Ensure the class is initialized.
Handle<mirror::Class> h_class(hs.NewHandle(method->GetDeclaringClass()));
if (!runtime->GetClassLinker()->EnsureInitialized(self, h_class, true, true)) {
- VLOG(jit) << "JIT failed to initialize " << PrettyMethod(method);
+ VLOG(jit) << "JIT failed to initialize " << method->PrettyMethod();
return false;
}
@@ -226,7 +226,7 @@
<< " "
<< code_cache->GetMemorySizeOfCodePointer(ptr)
<< " "
- << PrettyMethod(method)
+ << method->PrettyMethod()
<< std::endl;
std::string str = stream.str();
bool res = perf_file_->WriteFully(str.c_str(), str.size());
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index 13d8c16..e171441 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -96,24 +96,24 @@
bool is_critical_native = (optimization_flags == Compiler::kCriticalNative);
VLOG(jni) << "JniCompile: Method :: "
- << art::PrettyMethod(method_idx, dex_file, /* with signature */ true)
+ << dex_file.PrettyMethod(method_idx, /* with signature */ true)
<< " :: access_flags = " << std::hex << access_flags << std::dec;
if (UNLIKELY(is_fast_native)) {
VLOG(jni) << "JniCompile: Fast native method detected :: "
- << art::PrettyMethod(method_idx, dex_file, /* with signature */ true);
+ << dex_file.PrettyMethod(method_idx, /* with signature */ true);
}
if (UNLIKELY(is_critical_native)) {
VLOG(jni) << "JniCompile: Critical native method detected :: "
- << art::PrettyMethod(method_idx, dex_file, /* with signature */ true);
+ << dex_file.PrettyMethod(method_idx, /* with signature */ true);
}
if (kIsDebugBuild) {
// Don't allow both @FastNative and @CriticalNative. They are mutually exclusive.
if (UNLIKELY(is_fast_native && is_critical_native)) {
LOG(FATAL) << "JniCompile: Method cannot be both @CriticalNative and @FastNative"
- << art::PrettyMethod(method_idx, dex_file, /* with_signature */ true);
+ << dex_file.PrettyMethod(method_idx, /* with_signature */ true);
}
// @CriticalNative - extra checks:
@@ -124,15 +124,15 @@
CHECK(is_static)
<< "@CriticalNative functions cannot be virtual since that would"
<< "require passing a reference parameter (this), which is illegal "
- << art::PrettyMethod(method_idx, dex_file, /* with_signature */ true);
+ << dex_file.PrettyMethod(method_idx, /* with_signature */ true);
CHECK(!is_synchronized)
<< "@CriticalNative functions cannot be synchronized since that would"
<< "require passing a (class and/or this) reference parameter, which is illegal "
- << art::PrettyMethod(method_idx, dex_file, /* with_signature */ true);
+ << dex_file.PrettyMethod(method_idx, /* with_signature */ true);
for (size_t i = 0; i < strlen(shorty); ++i) {
CHECK_NE(Primitive::kPrimNot, Primitive::GetType(shorty[i]))
<< "@CriticalNative methods' shorty types must not have illegal references "
- << art::PrettyMethod(method_idx, dex_file, /* with_signature */ true);
+ << dex_file.PrettyMethod(method_idx, /* with_signature */ true);
}
}
}
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc
index b4c60d1..593d8e9 100644
--- a/compiler/oat_test.cc
+++ b/compiler/oat_test.cc
@@ -65,14 +65,14 @@
method->GetDexMethodIndex()));
if (compiled_method == nullptr) {
- EXPECT_TRUE(oat_method.GetQuickCode() == nullptr) << PrettyMethod(method) << " "
+ EXPECT_TRUE(oat_method.GetQuickCode() == nullptr) << method->PrettyMethod() << " "
<< oat_method.GetQuickCode();
EXPECT_EQ(oat_method.GetFrameSizeInBytes(), 0U);
EXPECT_EQ(oat_method.GetCoreSpillMask(), 0U);
EXPECT_EQ(oat_method.GetFpSpillMask(), 0U);
} else {
const void* quick_oat_code = oat_method.GetQuickCode();
- EXPECT_TRUE(quick_oat_code != nullptr) << PrettyMethod(method);
+ EXPECT_TRUE(quick_oat_code != nullptr) << method->PrettyMethod();
EXPECT_EQ(oat_method.GetFrameSizeInBytes(), compiled_method->GetFrameSizeInBytes());
EXPECT_EQ(oat_method.GetCoreSpillMask(), compiled_method->GetCoreSpillMask());
EXPECT_EQ(oat_method.GetFpSpillMask(), compiled_method->GetFpSpillMask());
@@ -82,7 +82,7 @@
EXPECT_FALSE(quick_code.empty());
size_t code_size = quick_code.size() * sizeof(quick_code[0]);
EXPECT_EQ(0, memcmp(quick_oat_code, &quick_code[0], code_size))
- << PrettyMethod(method) << " " << code_size;
+ << method->PrettyMethod() << " " << code_size;
CHECK_EQ(0, memcmp(quick_oat_code, &quick_code[0], code_size));
}
}
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index 44c26ed..52134e8 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -759,7 +759,7 @@
if (writer_->relative_patcher_->GetOffset(method_ref) != 0u) {
// TODO: Should this be a hard failure?
LOG(WARNING) << "Multiple definitions of "
- << PrettyMethod(method_ref.dex_method_index, *method_ref.dex_file)
+ << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index)
<< " offsets " << writer_->relative_patcher_->GetOffset(method_ref)
<< " " << quick_code_offset;
} else {
@@ -967,7 +967,7 @@
invoke_type);
if (method == nullptr) {
LOG(FATAL_WITHOUT_ABORT) << "Unexpected failure to resolve a method: "
- << PrettyMethod(it.GetMemberIndex(), *dex_file_, true);
+ << dex_file_->PrettyMethod(it.GetMemberIndex(), true);
soa.Self()->AssertPendingException();
mirror::Throwable* exc = soa.Self()->GetException();
std::string dump = exc->Dump();
@@ -1073,7 +1073,7 @@
GetInstructionSetAlignment(compiled_method->GetInstructionSet()));
DCHECK_EQ(method_offsets.code_offset_,
offset_ + sizeof(OatQuickMethodHeader) + compiled_method->CodeDelta())
- << PrettyMethod(it.GetMemberIndex(), *dex_file_);
+ << dex_file_->PrettyMethod(it.GetMemberIndex());
const OatQuickMethodHeader& method_header =
oat_class->method_headers_[method_offsets_index_];
if (!out->WriteFully(&method_header, sizeof(method_header))) {
@@ -1185,7 +1185,7 @@
void ReportWriteFailure(const char* what, const ClassDataItemIterator& it) {
PLOG(ERROR) << "Failed to write " << what << " for "
- << PrettyMethod(it.GetMemberIndex(), *dex_file_) << " to " << out_->GetLocation();
+ << dex_file_->PrettyMethod(it.GetMemberIndex()) << " to " << out_->GetLocation();
}
ArtMethod* GetTargetMethod(const LinkerPatch& patch)
@@ -1370,13 +1370,13 @@
DCHECK((compiled_method->GetVmapTable().size() == 0u && map_offset == 0u) ||
(compiled_method->GetVmapTable().size() != 0u && map_offset != 0u))
<< compiled_method->GetVmapTable().size() << " " << map_offset << " "
- << PrettyMethod(it.GetMemberIndex(), *dex_file_);
+ << dex_file_->PrettyMethod(it.GetMemberIndex());
if (map_offset != 0u) {
// Transform map_offset to actual oat data offset.
map_offset = (code_offset - compiled_method->CodeDelta()) - map_offset;
DCHECK_NE(map_offset, 0u);
- DCHECK_LE(map_offset, offset_) << PrettyMethod(it.GetMemberIndex(), *dex_file_);
+ DCHECK_LE(map_offset, offset_) << dex_file_->PrettyMethod(it.GetMemberIndex());
ArrayRef<const uint8_t> map = compiled_method->GetVmapTable();
size_t map_size = map.size() * sizeof(map[0]);
@@ -1401,7 +1401,7 @@
void ReportWriteFailure(const ClassDataItemIterator& it) {
PLOG(ERROR) << "Failed to write map for "
- << PrettyMethod(it.GetMemberIndex(), *dex_file_) << " to " << out_->GetLocation();
+ << dex_file_->PrettyMethod(it.GetMemberIndex()) << " to " << out_->GetLocation();
}
};
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 86742e6..2927e1f 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -51,7 +51,7 @@
if (compiler_options.IsHugeMethod(code_item_.insns_size_in_code_units_)) {
VLOG(compiler) << "Skip compilation of huge method "
- << PrettyMethod(dex_compilation_unit_->GetDexMethodIndex(), *dex_file_)
+ << dex_file_->PrettyMethod(dex_compilation_unit_->GetDexMethodIndex())
<< ": " << code_item_.insns_size_in_code_units_ << " code units";
MaybeRecordStat(MethodCompilationStat::kNotCompiledHugeMethod);
return true;
@@ -61,7 +61,7 @@
if (compiler_options.IsLargeMethod(code_item_.insns_size_in_code_units_)
&& (number_of_branches == 0)) {
VLOG(compiler) << "Skip compilation of large method with no branch "
- << PrettyMethod(dex_compilation_unit_->GetDexMethodIndex(), *dex_file_)
+ << dex_file_->PrettyMethod(dex_compilation_unit_->GetDexMethodIndex())
<< ": " << code_item_.insns_size_in_code_units_ << " code units";
MaybeRecordStat(MethodCompilationStat::kNotCompiledLargeMethodNoBranches);
return true;
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index 912ee29..09dcefa 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -441,8 +441,8 @@
void VisitInvoke(HInvoke* invoke) OVERRIDE {
StartAttributeStream("dex_file_index") << invoke->GetDexMethodIndex();
- StartAttributeStream("method_name") << PrettyMethod(
- invoke->GetDexMethodIndex(), GetGraph()->GetDexFile(), /* with_signature */ false);
+ StartAttributeStream("method_name") << GetGraph()->GetDexFile().PrettyMethod(
+ invoke->GetDexMethodIndex(), /* with_signature */ false);
}
void VisitInvokeUnresolved(HInvokeUnresolved* invoke) OVERRIDE {
@@ -465,15 +465,15 @@
}
void VisitInstanceFieldGet(HInstanceFieldGet* iget) OVERRIDE {
- StartAttributeStream("field_name") << PrettyField(iget->GetFieldInfo().GetFieldIndex(),
- iget->GetFieldInfo().GetDexFile(),
+ StartAttributeStream("field_name") <<
+ iget->GetFieldInfo().GetDexFile().PrettyField(iget->GetFieldInfo().GetFieldIndex(),
/* with type */ false);
StartAttributeStream("field_type") << iget->GetFieldType();
}
void VisitInstanceFieldSet(HInstanceFieldSet* iset) OVERRIDE {
- StartAttributeStream("field_name") << PrettyField(iset->GetFieldInfo().GetFieldIndex(),
- iset->GetFieldInfo().GetDexFile(),
+ StartAttributeStream("field_name") <<
+ iset->GetFieldInfo().GetDexFile().PrettyField(iset->GetFieldInfo().GetFieldIndex(),
/* with type */ false);
StartAttributeStream("field_type") << iset->GetFieldType();
}
@@ -604,7 +604,8 @@
: instruction->GetReferenceTypeInfo();
ScopedObjectAccess soa(Thread::Current());
if (info.IsValid()) {
- StartAttributeStream("klass") << PrettyDescriptor(info.GetTypeHandle().Get());
+ StartAttributeStream("klass")
+ << mirror::Class::PrettyDescriptor(info.GetTypeHandle().Get());
StartAttributeStream("can_be_null")
<< std::boolalpha << instruction->CanBeNull() << std::noboolalpha;
StartAttributeStream("exact") << std::boolalpha << info.IsExact() << std::noboolalpha;
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 6080551..9faa98a 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -90,14 +90,14 @@
if (!TryInline(call)) {
if (kIsDebugBuild && IsCompilingWithCoreImage()) {
std::string callee_name =
- PrettyMethod(call->GetDexMethodIndex(), *outer_compilation_unit_.GetDexFile());
+ outer_compilation_unit_.GetDexFile()->PrettyMethod(call->GetDexMethodIndex());
bool should_inline = callee_name.find("$inline$") != std::string::npos;
CHECK(!should_inline) << "Could not inline " << callee_name;
}
} else {
if (kIsDebugBuild && IsCompilingWithCoreImage()) {
std::string callee_name =
- PrettyMethod(call->GetDexMethodIndex(), *outer_compilation_unit_.GetDexFile());
+ outer_compilation_unit_.GetDexFile()->PrettyMethod(call->GetDexMethodIndex());
bool must_not_inline = callee_name.find("$noinline$") != std::string::npos;
CHECK(!must_not_inline) << "Should not have inlined " << callee_name;
}
@@ -203,10 +203,10 @@
REQUIRES_SHARED(Locks::mutator_lock_) {
uint32_t index = DexFile::kDexNoIndex;
if (cls->GetDexCache() == nullptr) {
- DCHECK(cls->IsArrayClass()) << PrettyClass(cls);
+ DCHECK(cls->IsArrayClass()) << cls->PrettyClass();
index = cls->FindTypeIndexInOtherDexFile(dex_file);
} else if (cls->GetDexTypeIndex() == DexFile::kDexNoIndex16) {
- DCHECK(cls->IsProxyClass()) << PrettyClass(cls);
+ DCHECK(cls->IsProxyClass()) << cls->PrettyClass();
// TODO: deal with proxy classes.
} else if (IsSameDexFile(cls->GetDexFile(), dex_file)) {
DCHECK_EQ(cls->GetDexCache(), dex_cache.Get());
@@ -266,7 +266,7 @@
ScopedObjectAccess soa(Thread::Current());
uint32_t method_index = invoke_instruction->GetDexMethodIndex();
const DexFile& caller_dex_file = *caller_compilation_unit_.GetDexFile();
- VLOG(compiler) << "Try inlining " << PrettyMethod(method_index, caller_dex_file);
+ VLOG(compiler) << "Try inlining " << caller_dex_file.PrettyMethod(method_index);
// We can query the dex cache directly. The verifier has populated it already.
ArtMethod* resolved_method = invoke_instruction->GetResolvedMethod();
@@ -304,7 +304,7 @@
const InlineCache& ic = *profiling_info->GetInlineCache(invoke_instruction->GetDexPc());
if (ic.IsUninitialized()) {
VLOG(compiler) << "Interface or virtual call to "
- << PrettyMethod(method_index, caller_dex_file)
+ << caller_dex_file.PrettyMethod(method_index)
<< " is not hit and not inlined";
return false;
} else if (ic.IsMonomorphic()) {
@@ -322,7 +322,7 @@
} else {
DCHECK(ic.IsMegamorphic());
VLOG(compiler) << "Interface or virtual call to "
- << PrettyMethod(method_index, caller_dex_file)
+ << caller_dex_file.PrettyMethod(method_index)
<< " is megamorphic and not inlined";
MaybeRecordStat(kMegamorphicCall);
return false;
@@ -331,7 +331,7 @@
}
VLOG(compiler) << "Interface or virtual call to "
- << PrettyMethod(method_index, caller_dex_file)
+ << caller_dex_file.PrettyMethod(method_index)
<< " could not be statically determined";
return false;
}
@@ -366,7 +366,7 @@
uint32_t class_index = FindClassIndexIn(
ic.GetMonomorphicType(), caller_dex_file, caller_compilation_unit_.GetDexCache());
if (class_index == DexFile::kDexNoIndex) {
- VLOG(compiler) << "Call to " << PrettyMethod(resolved_method)
+ VLOG(compiler) << "Call to " << ArtMethod::PrettyMethod(resolved_method)
<< " from inline cache is not inlined because its class is not"
<< " accessible to the caller";
return false;
@@ -526,7 +526,7 @@
}
if (!one_target_inlined) {
- VLOG(compiler) << "Call to " << PrettyMethod(resolved_method)
+ VLOG(compiler) << "Call to " << ArtMethod::PrettyMethod(resolved_method)
<< " from inline cache is not inlined because none"
<< " of its targets could be inlined";
return false;
@@ -660,7 +660,7 @@
actual_method = new_method;
} else if (actual_method != new_method) {
// Different methods, bailout.
- VLOG(compiler) << "Call to " << PrettyMethod(resolved_method)
+ VLOG(compiler) << "Call to " << ArtMethod::PrettyMethod(resolved_method)
<< " from inline cache is not inlined because it resolves"
<< " to different methods";
return false;
@@ -794,7 +794,7 @@
ArtMethod* method,
HInstruction** return_replacement) {
if (method->IsProxyMethod()) {
- VLOG(compiler) << "Method " << PrettyMethod(method)
+ VLOG(compiler) << "Method " << method->PrettyMethod()
<< " is not inlined because of unimplemented inline support for proxy methods.";
return false;
}
@@ -804,11 +804,12 @@
if (!compiler_driver_->MayInline(method->GetDexFile(),
outer_compilation_unit_.GetDexFile())) {
if (TryPatternSubstitution(invoke_instruction, method, return_replacement)) {
- VLOG(compiler) << "Successfully replaced pattern of invoke " << PrettyMethod(method);
+ VLOG(compiler) << "Successfully replaced pattern of invoke "
+ << method->PrettyMethod();
MaybeRecordStat(kReplacedInvokeWithSimplePattern);
return true;
}
- VLOG(compiler) << "Won't inline " << PrettyMethod(method) << " in "
+ VLOG(compiler) << "Won't inline " << method->PrettyMethod() << " in "
<< outer_compilation_unit_.GetDexFile()->GetLocation() << " ("
<< caller_compilation_unit_.GetDexFile()->GetLocation() << ") from "
<< method->GetDexFile()->GetLocation();
@@ -820,14 +821,14 @@
const DexFile::CodeItem* code_item = method->GetCodeItem();
if (code_item == nullptr) {
- VLOG(compiler) << "Method " << PrettyMethod(method)
+ VLOG(compiler) << "Method " << method->PrettyMethod()
<< " is not inlined because it is native";
return false;
}
size_t inline_max_code_units = compiler_driver_->GetCompilerOptions().GetInlineMaxCodeUnits();
if (code_item->insns_size_in_code_units_ > inline_max_code_units) {
- VLOG(compiler) << "Method " << PrettyMethod(method)
+ VLOG(compiler) << "Method " << method->PrettyMethod()
<< " is too big to inline: "
<< code_item->insns_size_in_code_units_
<< " > "
@@ -836,13 +837,13 @@
}
if (code_item->tries_size_ != 0) {
- VLOG(compiler) << "Method " << PrettyMethod(method)
+ VLOG(compiler) << "Method " << method->PrettyMethod()
<< " is not inlined because of try block";
return false;
}
if (!method->IsCompilable()) {
- VLOG(compiler) << "Method " << PrettyMethod(method)
+ VLOG(compiler) << "Method " << method->PrettyMethod()
<< " has soft failures un-handled by the compiler, so it cannot be inlined";
}
@@ -851,7 +852,7 @@
if (Runtime::Current()->UseJitCompilation() ||
!compiler_driver_->IsMethodVerifiedWithoutFailures(
method->GetDexMethodIndex(), class_def_idx, *method->GetDexFile())) {
- VLOG(compiler) << "Method " << PrettyMethod(method)
+ VLOG(compiler) << "Method " << method->PrettyMethod()
<< " couldn't be verified, so it cannot be inlined";
return false;
}
@@ -861,7 +862,7 @@
invoke_instruction->AsInvokeStaticOrDirect()->IsStaticWithImplicitClinitCheck()) {
// Case of a static method that cannot be inlined because it implicitly
// requires an initialization check of its declaring class.
- VLOG(compiler) << "Method " << PrettyMethod(method)
+ VLOG(compiler) << "Method " << method->PrettyMethod()
<< " is not inlined because it is static and requires a clinit"
<< " check that cannot be emitted due to Dex cache limitations";
return false;
@@ -871,7 +872,7 @@
return false;
}
- VLOG(compiler) << "Successfully inlined " << PrettyMethod(method);
+ VLOG(compiler) << "Successfully inlined " << method->PrettyMethod();
MaybeRecordStat(kInlinedInvoke);
return true;
}
@@ -1143,14 +1144,14 @@
handles_);
if (builder.BuildGraph() != kAnalysisSuccess) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be built, so cannot be inlined";
return false;
}
if (!RegisterAllocator::CanAllocateRegistersFor(*callee_graph,
compiler_driver_->GetInstructionSet())) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " cannot be inlined because of the register allocator";
return false;
}
@@ -1200,7 +1201,7 @@
// a throw predecessor.
HBasicBlock* exit_block = callee_graph->GetExitBlock();
if (exit_block == nullptr) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because it has an infinite loop";
return false;
}
@@ -1213,7 +1214,7 @@
}
}
if (has_throw_predecessor) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because one branch always throws";
return false;
}
@@ -1231,7 +1232,7 @@
if (block->IsLoopHeader() && block->GetLoopInformation()->IsIrreducible()) {
// Don't inline methods with irreducible loops, they could prevent some
// optimizations to run.
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because it contains an irreducible loop";
return false;
}
@@ -1240,28 +1241,28 @@
!instr_it.Done();
instr_it.Advance()) {
if (number_of_instructions++ == number_of_instructions_budget) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " is not inlined because its caller has reached"
<< " its instruction budget limit.";
return false;
}
HInstruction* current = instr_it.Current();
if (!can_inline_environment && current->NeedsEnvironment()) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " is not inlined because its caller has reached"
<< " its environment budget limit.";
return false;
}
if (!same_dex_file && current->NeedsEnvironment()) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because " << current->DebugName()
<< " needs an environment and is in a different dex file";
return false;
}
if (!same_dex_file && current->NeedsDexCacheOfDeclaringClass()) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because " << current->DebugName()
<< " it is in a different dex file and requires access to the dex cache";
return false;
@@ -1269,7 +1270,7 @@
if (current->IsNewInstance() &&
(current->AsNewInstance()->GetEntrypoint() == kQuickAllocObjectWithAccessCheck)) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because it is using an entrypoint"
<< " with access checks";
// Allocation entrypoint does not handle inlined frames.
@@ -1278,7 +1279,7 @@
if (current->IsNewArray() &&
(current->AsNewArray()->GetEntrypoint() == kQuickAllocArrayWithAccessCheck)) {
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because it is using an entrypoint"
<< " with access checks";
// Allocation entrypoint does not handle inlined frames.
@@ -1290,7 +1291,7 @@
current->IsUnresolvedStaticFieldSet() ||
current->IsUnresolvedInstanceFieldSet()) {
// Entrypoint for unresolved fields does not handle inlined frames.
- VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file)
+ VLOG(compiler) << "Method " << callee_dex_file.PrettyMethod(method_index)
<< " could not be inlined because it is using an unresolved"
<< " entrypoint";
return false;
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index f7d67db..613e008 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -1065,7 +1065,7 @@
// reject any class where this is violated. However, the verifier only does these checks
// on non trivially dead instructions, so we just bailout the compilation.
VLOG(compiler) << "Did not compile "
- << PrettyMethod(dex_compilation_unit_->GetDexMethodIndex(), *dex_file_)
+ << dex_file_->PrettyMethod(dex_compilation_unit_->GetDexMethodIndex())
<< " because of non-sequential dex register pair in wide argument";
MaybeRecordStat(MethodCompilationStat::kNotCompiledMalformedOpcode);
return false;
@@ -1079,7 +1079,7 @@
if (*argument_index != invoke->GetNumberOfArguments()) {
VLOG(compiler) << "Did not compile "
- << PrettyMethod(dex_compilation_unit_->GetDexMethodIndex(), *dex_file_)
+ << dex_file_->PrettyMethod(dex_compilation_unit_->GetDexMethodIndex())
<< " because of wrong number of arguments in invoke instruction";
MaybeRecordStat(MethodCompilationStat::kNotCompiledMalformedOpcode);
return false;
@@ -2716,7 +2716,7 @@
default:
VLOG(compiler) << "Did not compile "
- << PrettyMethod(dex_compilation_unit_->GetDexMethodIndex(), *dex_file_)
+ << dex_file_->PrettyMethod(dex_compilation_unit_->GetDexMethodIndex())
<< " because of unhandled instruction "
<< instruction.Name();
MaybeRecordStat(MethodCompilationStat::kNotCompiledUnhandledInstruction);
diff --git a/compiler/optimizing/intrinsics.cc b/compiler/optimizing/intrinsics.cc
index 412ccfc..8327a4c 100644
--- a/compiler/optimizing/intrinsics.cc
+++ b/compiler/optimizing/intrinsics.cc
@@ -146,7 +146,7 @@
if (!CheckInvokeType(intrinsic, invoke)) {
LOG(WARNING) << "Found an intrinsic with unexpected invoke type: "
<< intrinsic << " for "
- << PrettyMethod(invoke->GetDexMethodIndex(), invoke->GetDexFile())
+ << invoke->GetDexFile().PrettyMethod(invoke->GetDexMethodIndex())
<< invoke->DebugName();
} else {
invoke->SetIntrinsic(intrinsic,
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 1e69966..59cc009 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -2295,7 +2295,7 @@
ScopedObjectAccess soa(Thread::Current());
os << "["
<< " is_valid=" << rhs.IsValid()
- << " type=" << (!rhs.IsValid() ? "?" : PrettyClass(rhs.GetTypeHandle().Get()))
+ << " type=" << (!rhs.IsValid() ? "?" : mirror::Class::PrettyClass(rhs.GetTypeHandle().Get()))
<< " is_exact=" << rhs.IsExact()
<< " ]";
return os;
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 4370a84..6ba0963 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -173,7 +173,7 @@
const char* GetMethodName() {
// PrettyMethod() is expensive, so we delay calling it until we actually have to.
if (cached_method_name_.empty()) {
- cached_method_name_ = PrettyMethod(graph_->GetMethodIdx(), graph_->GetDexFile());
+ cached_method_name_ = graph_->GetDexFile().PrettyMethod(graph_->GetMethodIdx());
}
return cached_method_name_.c_str();
}
@@ -1044,7 +1044,7 @@
if (kArenaAllocatorCountAllocations) {
if (arena.BytesAllocated() > kArenaAllocatorMemoryReportThreshold) {
MemStats mem_stats(arena.GetMemStats());
- LOG(INFO) << PrettyMethod(method_idx, dex_file) << " " << Dumpable<MemStats>(mem_stats);
+ LOG(INFO) << dex_file.PrettyMethod(method_idx) << " " << Dumpable<MemStats>(mem_stats);
}
}
}
@@ -1066,7 +1066,7 @@
// instruction set is supported -- and has support for read
// barriers, if they are enabled). This makes sure we're not
// regressing.
- std::string method_name = PrettyMethod(method_idx, dex_file);
+ std::string method_name = dex_file.PrettyMethod(method_idx);
bool shouldCompile = method_name.find("$opt$") != std::string::npos;
DCHECK((method != nullptr) || !shouldCompile) << "Didn't compile " << method_name;
}
@@ -1131,7 +1131,7 @@
if (kArenaAllocatorCountAllocations) {
if (arena.BytesAllocated() > kArenaAllocatorMemoryReportThreshold) {
MemStats mem_stats(arena.GetMemStats());
- LOG(INFO) << PrettyMethod(method_idx, *dex_file) << " " << Dumpable<MemStats>(mem_stats);
+ LOG(INFO) << dex_file->PrettyMethod(method_idx) << " " << Dumpable<MemStats>(mem_stats);
}
}
}
diff --git a/compiler/optimizing/prepare_for_register_allocation.cc b/compiler/optimizing/prepare_for_register_allocation.cc
index 8fb5396..a4df9e5 100644
--- a/compiler/optimizing/prepare_for_register_allocation.cc
+++ b/compiler/optimizing/prepare_for_register_allocation.cc
@@ -44,7 +44,7 @@
// Add a fake environment for String.charAt() inline info as we want
// the exception to appear as being thrown from there.
const DexFile& dex_file = check->GetEnvironment()->GetDexFile();
- DCHECK_STREQ(PrettyMethod(check->GetStringCharAtMethodIndex(), dex_file).c_str(),
+ DCHECK_STREQ(dex_file.PrettyMethod(check->GetStringCharAtMethodIndex()).c_str(),
"char java.lang.String.charAt(int)");
ArenaAllocator* arena = GetGraph()->GetArena();
HEnvironment* environment = new (arena) HEnvironment(arena,
diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc
index 83698ad..b16c3ea 100644
--- a/compiler/optimizing/reference_type_propagation.cc
+++ b/compiler/optimizing/reference_type_propagation.cc
@@ -448,9 +448,9 @@
mirror::Class* declaring_class = method->GetDeclaringClass();
DCHECK(declaring_class != nullptr);
DCHECK(declaring_class->IsStringClass())
- << "Expected String class: " << PrettyDescriptor(declaring_class);
+ << "Expected String class: " << declaring_class->PrettyDescriptor();
DCHECK(method->IsConstructor())
- << "Expected String.<init>: " << PrettyMethod(method);
+ << "Expected String.<init>: " << method->PrettyMethod();
}
instr->SetReferenceTypeInfo(
ReferenceTypeInfo::Create(handle_cache_->GetStringClassHandle(), /* is_exact */ true));
diff --git a/compiler/utils/test_dex_file_builder_test.cc b/compiler/utils/test_dex_file_builder_test.cc
index 7a424a2..da4ac79 100644
--- a/compiler/utils/test_dex_file_builder_test.cc
+++ b/compiler/utils/test_dex_file_builder_test.cc
@@ -66,14 +66,14 @@
}
ASSERT_EQ(1u, dex_file->NumFieldIds());
- EXPECT_STREQ("[I TestClass.intField", PrettyField(0u, *dex_file).c_str());
+ EXPECT_STREQ("[I TestClass.intField", dex_file->PrettyField(0u).c_str());
ASSERT_EQ(2u, dex_file->NumProtoIds());
ASSERT_EQ(2u, dex_file->NumMethodIds());
EXPECT_STREQ("TestClass TestClass.bar(java.lang.Object, java.lang.Object[])",
- PrettyMethod(0u, *dex_file).c_str());
+ dex_file->PrettyMethod(0u).c_str());
EXPECT_STREQ("int TestClass.foo()",
- PrettyMethod(1u, *dex_file).c_str());
+ dex_file->PrettyMethod(1u).c_str());
EXPECT_EQ(0u, builder.GetStringIdx("Arbitrary string"));
EXPECT_EQ(2u, builder.GetTypeIdx("Ljava/lang/Class;"));