summaryrefslogtreecommitdiffstats
path: root/runtime/oat_file.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-08-14 11:34:07 -0700
committerIan Rogers <irogers@google.com>2014-08-14 11:47:39 -0700
commit97b52f89e5e0b52a08d4b9a3953d0973a3cf5636 (patch)
tree31cd309bfbb4e566fcecb1d951e5a5504a891a20 /runtime/oat_file.h
parent3842ad76aaeb80e0bb6b02c5f7dc4674533ef872 (diff)
downloadart-97b52f89e5e0b52a08d4b9a3953d0973a3cf5636.tar.gz
art-97b52f89e5e0b52a08d4b9a3953d0973a3cf5636.tar.bz2
art-97b52f89e5e0b52a08d4b9a3953d0973a3cf5636.zip
Make OatClass and OatMethod immutable once more.
OatClass and OatMethod are representation of disk data and we don't want the runtime to mutate this. Change-Id: Id5b8658fd544f5d6e1b9120af134d3644ff1a52c
Diffstat (limited to 'runtime/oat_file.h')
-rw-r--r--runtime/oat_file.h40
1 files changed, 25 insertions, 15 deletions
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index 810eccb2d1..508bfc229e 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -126,14 +126,19 @@ class OatFile {
const uint8_t* GetMappingTable() const;
const uint8_t* GetVmapTable() const;
- ~OatMethod();
-
// Create an OatMethod with offsets relative to the given base address
- OatMethod(const byte* base,
- const uint32_t code_offset,
- const uint32_t gc_map_offset);
+ OatMethod(const byte* base, const uint32_t code_offset, const uint32_t gc_map_offset)
+ : begin_(base),
+ code_offset_(code_offset),
+ native_gc_map_offset_(gc_map_offset) {
+ }
+ ~OatMethod() {}
- OatMethod() {}
+ // A representation of an invalid OatMethod, used when an OatMethod or OatClass can't be found.
+ // See ClassLinker::FindOatMethodFor.
+ static const OatMethod Invalid() {
+ return OatMethod(nullptr, -1, -1);
+ }
private:
template<class T>
@@ -144,10 +149,10 @@ class OatFile {
return reinterpret_cast<T>(begin_ + offset);
}
- const byte* begin_;
+ const byte* const begin_;
- uint32_t code_offset_;
- uint32_t native_gc_map_offset_;
+ const uint32_t code_offset_;
+ const uint32_t native_gc_map_offset_;
friend class OatClass;
};
@@ -168,7 +173,12 @@ class OatFile {
// methods are not included.
const OatMethod GetOatMethod(uint32_t method_index) const;
- OatClass() {}
+ // A representation of an invalid OatClass, used when an OatClass can't be found.
+ // See ClassLinker::FindOatClass.
+ static OatClass Invalid() {
+ return OatClass(nullptr, mirror::Class::kStatusError, kOatClassNoneCompiled, 0, nullptr,
+ nullptr);
+ }
private:
OatClass(const OatFile* oat_file,
@@ -178,15 +188,15 @@ class OatFile {
const uint32_t* bitmap_pointer,
const OatMethodOffsets* methods_pointer);
- const OatFile* oat_file_;
+ const OatFile* const oat_file_;
- mirror::Class::Status status_;
+ const mirror::Class::Status status_;
- OatClassType type_;
+ const OatClassType type_;
- const uint32_t* bitmap_;
+ const uint32_t* const bitmap_;
- const OatMethodOffsets* methods_pointer_;
+ const OatMethodOffsets* const methods_pointer_;
friend class OatDexFile;
};