summaryrefslogtreecommitdiffstats
path: root/runtime/oat_file.h
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-04-11 16:32:51 +0100
committerVladimir Marko <vmarko@google.com>2014-04-14 18:03:41 +0100
commitd3c5bebcb52a67cb06e7ab303eaf45f230c08b60 (patch)
tree85df477ba745b1e2c85ab1d167b0297236060f2f /runtime/oat_file.h
parent043a7a6182870964021476484b1534106ff20600 (diff)
downloadart-d3c5bebcb52a67cb06e7ab303eaf45f230c08b60.tar.gz
art-d3c5bebcb52a67cb06e7ab303eaf45f230c08b60.tar.bz2
art-d3c5bebcb52a67cb06e7ab303eaf45f230c08b60.zip
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
Diffstat (limited to 'runtime/oat_file.h')
-rw-r--r--runtime/oat_file.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index d6e8dc07f2..10f64cc91e 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -181,7 +181,6 @@ class OatFile {
// methods. note that runtime created methods such as miranda
// methods are not included.
const OatMethod GetOatMethod(uint32_t method_index) const;
- ~OatClass();
private:
OatClass(const OatFile* oat_file,
@@ -191,15 +190,13 @@ class OatFile {
const uint32_t* bitmap_pointer,
const OatMethodOffsets* methods_pointer);
- const OatFile* oat_file_;
+ const OatFile* const oat_file_;
const mirror::Class::Status status_;
- COMPILE_ASSERT(mirror::Class::Status::kStatusMax < (2 ^ 16), class_status_wont_fit_in_16bits);
- OatClassType type_;
- COMPILE_ASSERT(OatClassType::kOatClassMax < (2 ^ 16), oat_class_type_wont_fit_in_16bits);
+ const OatClassType type_;
- const BitVector* bitmap_;
+ const uint32_t* const bitmap_;
const OatMethodOffsets* methods_pointer_;
@@ -225,7 +222,7 @@ class OatFile {
}
// Returns the OatClass for the class specified by the given DexFile class_def_index.
- const OatClass* GetOatClass(uint16_t class_def_index) const;
+ OatClass GetOatClass(uint16_t class_def_index) const;
~OatDexFile();