summaryrefslogtreecommitdiffstats
path: root/runtime/oat_file.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2018-11-19 12:59:15 -0800
committerAndreas Gampe <agampe@google.com>2018-11-20 13:04:36 -0800
commit875b4f26517ce215342746f07e41cda4c1991237 (patch)
tree16d061e67632c2980af958383db77883eabbdf1f /runtime/oat_file.cc
parent3573c3669b281e0fa6c59019d4e9de5d37e651ea (diff)
downloadart-875b4f26517ce215342746f07e41cda4c1991237.tar.gz
art-875b4f26517ce215342746f07e41cda4c1991237.tar.bz2
art-875b4f26517ce215342746f07e41cda4c1991237.zip
ART: Avoid some tidy nullptr warnings
Sprinkle some (D)CHECKs to tell tidy our expectations. Bug: 32619234 Test: m test-art-host Change-Id: I315b1602b20475402dd8383e1accc49e5a63eb5c
Diffstat (limited to 'runtime/oat_file.cc')
-rw-r--r--runtime/oat_file.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index af87637d57..c1ccd33774 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -33,6 +33,7 @@
#include "android/dlext.h"
#endif
+#include <android-base/logging.h>
#include "android-base/stringprintf.h"
#include "art_method.h"
@@ -467,6 +468,7 @@ static void DCheckIndexToBssMapping(OatFile* oat_file,
}
prev_entry = &entry;
}
+ CHECK(prev_entry != nullptr);
CHECK_LT(prev_entry->GetIndex(index_bits), number_of_indexes);
}
}
@@ -1755,11 +1757,15 @@ OatDexFile::OatDexFile(const OatFile* oat_file,
}
}
-OatDexFile::OatDexFile(TypeLookupTable&& lookup_table) : lookup_table_(std::move(lookup_table)) {}
+OatDexFile::OatDexFile(TypeLookupTable&& lookup_table) : lookup_table_(std::move(lookup_table)) {
+ // Stripped-down OatDexFile only allowed in the compiler.
+ CHECK(Runtime::Current() == nullptr || Runtime::Current()->IsAotCompiler());
+}
OatDexFile::~OatDexFile() {}
size_t OatDexFile::FileSize() const {
+ DCHECK(dex_file_pointer_ != nullptr);
return reinterpret_cast<const DexFile::Header*>(dex_file_pointer_)->file_size_;
}
@@ -1779,6 +1785,7 @@ std::unique_ptr<const DexFile> OatDexFile::OpenDexFile(std::string* error_msg) c
}
uint32_t OatDexFile::GetOatClassOffset(uint16_t class_def_index) const {
+ DCHECK(oat_class_offsets_pointer_ != nullptr);
return oat_class_offsets_pointer_[class_def_index];
}