Avoid allocating OatFile::OatClass on the heap.
Avoid allocating a BitVector for OatFile::OatClass::bitmap_
with kOatClassSomeCompiled methods. That makes the OatClass
copy-constructible as it doesn't own any memory. We use that
in OatFile::OatDexFile::GetOatClass() to return the result
by value thus avoiding one or two heap allocations per call.
Change-Id: Ic7098109028a5b49e39ef626f877de86e732ed18
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc
index 9cfef12..766ef7b 100644
--- a/compiler/oat_test.cc
+++ b/compiler/oat_test.cc
@@ -155,19 +155,19 @@
SirtRef<mirror::ClassLoader> loader(soa.Self(), nullptr);
mirror::Class* klass = class_linker->FindClass(soa.Self(), descriptor, loader);
- UniquePtr<const OatFile::OatClass> oat_class(oat_dex_file->GetOatClass(i));
- CHECK_EQ(mirror::Class::Status::kStatusNotReady, oat_class->GetStatus()) << descriptor;
+ const OatFile::OatClass oat_class = oat_dex_file->GetOatClass(i);
+ CHECK_EQ(mirror::Class::Status::kStatusNotReady, oat_class.GetStatus()) << descriptor;
CHECK_EQ(kCompile ? OatClassType::kOatClassAllCompiled : OatClassType::kOatClassNoneCompiled,
- oat_class->GetType()) << descriptor;
+ oat_class.GetType()) << descriptor;
size_t method_index = 0;
for (size_t i = 0; i < klass->NumDirectMethods(); i++, method_index++) {
CheckMethod(klass->GetDirectMethod(i),
- oat_class->GetOatMethod(method_index), dex_file);
+ oat_class.GetOatMethod(method_index), dex_file);
}
for (size_t i = 0; i < num_virtual_methods; i++, method_index++) {
CheckMethod(klass->GetVirtualMethod(i),
- oat_class->GetOatMethod(method_index), dex_file);
+ oat_class.GetOatMethod(method_index), dex_file);
}
}
}