ART: Finish old move of OatDexFile
The class has been made standalone so it can be forward-declared,
but not all nested references had been updated.
Test: mmma art
Change-Id: Idc5f0af24af17dcae286dee290f729ba61693a11
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 5b4dcb7..80b6921 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -550,7 +550,7 @@
ArrayRef<const uint8_t> ArtMethod::GetQuickenedInfo() {
const DexFile& dex_file = GetDeclaringClass()->GetDexFile();
- const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+ const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
if (oat_dex_file == nullptr || (oat_dex_file->GetOatFile() == nullptr)) {
return ArrayRef<const uint8_t>();
}
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 7b92ba4..c219d3d 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1338,7 +1338,7 @@
REQUIRES_SHARED(Locks::mutator_lock_) {
DCHECK(error_msg != nullptr);
std::unique_ptr<const DexFile> dex_file;
- const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(location, nullptr, error_msg);
+ const OatDexFile* oat_dex_file = oat_file->GetOatDexFile(location, nullptr, error_msg);
if (oat_dex_file == nullptr) {
return std::unique_ptr<const DexFile>();
}
@@ -4181,7 +4181,7 @@
}
}
- const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+ const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
// In case we run without an image there won't be a backing oat file.
if (oat_dex_file == nullptr || oat_dex_file->GetOatFile() == nullptr) {
return false;
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index e754fbc..cbce940 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -1875,7 +1875,7 @@
bool ImageSpace::ValidateOatFile(const OatFile& oat_file, std::string* error_msg) {
const ArtDexFileLoader dex_file_loader;
- for (const OatFile::OatDexFile* oat_dex_file : oat_file.GetOatDexFiles()) {
+ for (const OatDexFile* oat_dex_file : oat_file.GetOatDexFiles()) {
const std::string& dex_file_location = oat_dex_file->GetDexFileLocation();
// Skip multidex locations - These will be checked when we visit their
@@ -1909,9 +1909,9 @@
std::string multi_dex_location = DexFileLoader::GetMultiDexLocation(
i,
dex_file_location.c_str());
- const OatFile::OatDexFile* multi_dex = oat_file.GetOatDexFile(multi_dex_location.c_str(),
- nullptr,
- error_msg);
+ const OatDexFile* multi_dex = oat_file.GetOatDexFile(multi_dex_location.c_str(),
+ nullptr,
+ error_msg);
if (multi_dex == nullptr) {
*error_msg = StringPrintf("ValidateOatFile oat file '%s' is missing entry '%s'",
oat_file.GetLocation().c_str(),
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 9355ae7..8842942 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -1598,9 +1598,9 @@
}
}
-const OatFile::OatDexFile* OatFile::GetOatDexFile(const char* dex_location,
- const uint32_t* dex_location_checksum,
- std::string* error_msg) const {
+const OatDexFile* OatFile::GetOatDexFile(const char* dex_location,
+ const uint32_t* dex_location_checksum,
+ std::string* error_msg) const {
// NOTE: We assume here that the canonical location for a given dex_location never
// changes. If it does (i.e. some symlink used by the filename changes) we may return
// an incorrect OatDexFile. As long as we have a checksum to check, we shall return
@@ -1609,7 +1609,7 @@
// TODO: Additional analysis of usage patterns to see if this can be simplified
// without any performance loss, for example by not doing the first lock-free lookup.
- const OatFile::OatDexFile* oat_dex_file = nullptr;
+ const OatDexFile* oat_dex_file = nullptr;
StringPiece key(dex_location);
// Try to find the key cheaply in the oat_dex_files_ map which holds dex locations
// directly mentioned in the oat file and doesn't require locking.
@@ -1667,17 +1667,17 @@
return oat_dex_file;
}
-OatFile::OatDexFile::OatDexFile(const OatFile* oat_file,
- const std::string& dex_file_location,
- const std::string& canonical_dex_file_location,
- uint32_t dex_file_location_checksum,
- const uint8_t* dex_file_pointer,
- const uint8_t* lookup_table_data,
- const IndexBssMapping* method_bss_mapping_data,
- const IndexBssMapping* type_bss_mapping_data,
- const IndexBssMapping* string_bss_mapping_data,
- const uint32_t* oat_class_offsets_pointer,
- const DexLayoutSections* dex_layout_sections)
+OatDexFile::OatDexFile(const OatFile* oat_file,
+ const std::string& dex_file_location,
+ const std::string& canonical_dex_file_location,
+ uint32_t dex_file_location_checksum,
+ const uint8_t* dex_file_pointer,
+ const uint8_t* lookup_table_data,
+ const IndexBssMapping* method_bss_mapping_data,
+ const IndexBssMapping* type_bss_mapping_data,
+ const IndexBssMapping* string_bss_mapping_data,
+ const uint32_t* oat_class_offsets_pointer,
+ const DexLayoutSections* dex_layout_sections)
: oat_file_(oat_file),
dex_file_location_(dex_file_location),
canonical_dex_file_location_(canonical_dex_file_location),
@@ -1708,16 +1708,15 @@
}
}
-OatFile::OatDexFile::OatDexFile(TypeLookupTable&& lookup_table)
- : lookup_table_(std::move(lookup_table)) {}
+OatDexFile::OatDexFile(TypeLookupTable&& lookup_table) : lookup_table_(std::move(lookup_table)) {}
-OatFile::OatDexFile::~OatDexFile() {}
+OatDexFile::~OatDexFile() {}
-size_t OatFile::OatDexFile::FileSize() const {
+size_t OatDexFile::FileSize() const {
return reinterpret_cast<const DexFile::Header*>(dex_file_pointer_)->file_size_;
}
-std::unique_ptr<const DexFile> OatFile::OatDexFile::OpenDexFile(std::string* error_msg) const {
+std::unique_ptr<const DexFile> OatDexFile::OpenDexFile(std::string* error_msg) const {
ScopedTrace trace(__PRETTY_FUNCTION__);
static constexpr bool kVerify = false;
static constexpr bool kVerifyChecksum = false;
@@ -1732,11 +1731,11 @@
error_msg);
}
-uint32_t OatFile::OatDexFile::GetOatClassOffset(uint16_t class_def_index) const {
+uint32_t OatDexFile::GetOatClassOffset(uint16_t class_def_index) const {
return oat_class_offsets_pointer_[class_def_index];
}
-OatFile::OatClass OatFile::OatDexFile::GetOatClass(uint16_t class_def_index) const {
+OatFile::OatClass OatDexFile::GetOatClass(uint16_t class_def_index) const {
uint32_t oat_class_offset = GetOatClassOffset(class_def_index);
const uint8_t* oat_class_pointer = oat_file_->Begin() + oat_class_offset;
@@ -1778,10 +1777,10 @@
reinterpret_cast<const OatMethodOffsets*>(methods_pointer));
}
-const DexFile::ClassDef* OatFile::OatDexFile::FindClassDef(const DexFile& dex_file,
- const char* descriptor,
- size_t hash) {
- const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+const DexFile::ClassDef* OatDexFile::FindClassDef(const DexFile& dex_file,
+ const char* descriptor,
+ size_t hash) {
+ const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
DCHECK_EQ(ComputeModifiedUtf8Hash(descriptor), hash);
bool used_lookup_table = false;
const DexFile::ClassDef* lookup_table_classdef = nullptr;
@@ -1829,7 +1828,7 @@
dex_file.Begin() + dex_file.Size(),
MADV_RANDOM);
}
- const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+ const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
if (oat_dex_file != nullptr) {
// Should always be there.
const DexLayoutSections* const sections = oat_dex_file->GetDexLayoutSections();
@@ -1947,7 +1946,7 @@
uint16_t class_def_idx,
bool* found) {
DCHECK_NE(class_def_idx, DexFile::kDexNoIndex16);
- const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+ const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
if (oat_dex_file == nullptr || oat_dex_file->GetOatFile() == nullptr) {
*found = false;
return OatFile::OatClass::Invalid();
@@ -1956,7 +1955,7 @@
return oat_dex_file->GetOatClass(class_def_idx);
}
-void OatFile::OatDexFile::AssertAotCompiler() {
+void OatDexFile::AssertAotCompiler() {
CHECK(Runtime::Current()->IsAotCompiler());
}
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index d72b6a8..5f87bf0 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -70,8 +70,6 @@
// Special classpath that skips shared library check.
static constexpr const char* kSpecialSharedLibrary = "&";
- typedef art::OatDexFile OatDexFile;
-
// Opens an oat file contained within the given elf file. This is always opened as
// non-executable at the moment.
static OatFile* OpenWithElfFile(int zip_fd,
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 6c869ca..f7c74cc 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -354,7 +354,7 @@
std::vector<std::unique_ptr<const DexFile>>* out_dex_files) {
// Load the main dex file.
std::string error_msg;
- const OatFile::OatDexFile* oat_dex_file = oat_file.GetOatDexFile(
+ const OatDexFile* oat_dex_file = oat_file.GetOatDexFile(
dex_location.c_str(), nullptr, &error_msg);
if (oat_dex_file == nullptr) {
LOG(WARNING) << error_msg;
@@ -453,7 +453,7 @@
for (uint32_t i = 0; i < number_of_dex_files; i++) {
std::string dex = DexFileLoader::GetMultiDexLocation(i, dex_location_.c_str());
uint32_t expected_checksum = (*required_dex_checksums)[i];
- const OatFile::OatDexFile* oat_dex_file = file.GetOatDexFile(dex.c_str(), nullptr);
+ const OatDexFile* oat_dex_file = file.GetOatDexFile(dex.c_str(), nullptr);
if (oat_dex_file == nullptr) {
*error_msg = StringPrintf("failed to find %s in %s", dex.c_str(), file.GetLocation().c_str());
return false;
@@ -921,7 +921,7 @@
required_dex_checksums_found_ = true;
for (size_t i = 0; i < odex_file->GetOatHeader().GetDexFileCount(); i++) {
std::string dex = DexFileLoader::GetMultiDexLocation(i, dex_location_.c_str());
- const OatFile::OatDexFile* odex_dex_file = odex_file->GetOatDexFile(dex.c_str(), nullptr);
+ const OatDexFile* odex_dex_file = odex_file->GetOatDexFile(dex.c_str(), nullptr);
if (odex_dex_file == nullptr) {
required_dex_checksums_found_ = false;
break;
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 3b4d177..f7674c8 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1020,7 +1020,7 @@
return false;
}
- for (const OatFile::OatDexFile* oat_dex_file : oat_file->GetOatDexFiles()) {
+ for (const OatDexFile* oat_dex_file : oat_file->GetOatDexFiles()) {
if (oat_dex_file == nullptr) {
*failures += 1;
continue;