diff options
author | Brian Carlstrom <bdc@google.com> | 2011-10-07 17:15:04 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2011-10-10 12:51:28 -0700 |
commit | aded5f7ab991f3c1132851599d3bc60ff6707eed (patch) | |
tree | 7fb5e92c224adf98cadd67b7df99cc2d2851cbcb /src/oat_file.cc | |
parent | bcbaaf3df56178263dbc110dcb0d1cf6c9d167c3 (diff) | |
download | art-aded5f7ab991f3c1132851599d3bc60ff6707eed.zip art-aded5f7ab991f3c1132851599d3bc60ff6707eed.tar.gz art-aded5f7ab991f3c1132851599d3bc60ff6707eed.tar.bz2 |
Working ClassLoader
Change-Id: Ia1122165e47f846a1d4506111849f830d9f14c1b
Diffstat (limited to 'src/oat_file.cc')
-rw-r--r-- | src/oat_file.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/oat_file.cc b/src/oat_file.cc index 95ef64c..8a4aa9a 100644 --- a/src/oat_file.cc +++ b/src/oat_file.cc @@ -123,12 +123,21 @@ const byte* OatFile::GetLimit() const { return mem_map_->GetLimit(); } -const OatFile::OatDexFile& OatFile::GetOatDexFile(const std::string& dex_file_location) { +const OatFile::OatDexFile* OatFile::GetOatDexFile(const std::string& dex_file_location) const { Table::const_iterator it = oat_dex_files_.find(dex_file_location); if (it == oat_dex_files_.end()) { - LOG(FATAL) << "Failed to find OatDexFile for DexFile " << dex_file_location; + LOG(WARNING) << "Failed to find OatDexFile for DexFile " << dex_file_location; + return NULL; + } + return it->second; +} + +std::vector<const OatFile::OatDexFile*> OatFile::GetOatDexFiles() const { + std::vector<const OatFile::OatDexFile*> result; + for (Table::const_iterator it = oat_dex_files_.begin(); it != oat_dex_files_.end(); ++it ) { + result.push_back(it->second); } - return *it->second; + return result; } OatFile::OatDexFile::OatDexFile(const OatFile* oat_file, @@ -142,11 +151,11 @@ OatFile::OatDexFile::OatDexFile(const OatFile* oat_file, OatFile::OatDexFile::~OatDexFile() {} -const OatFile::OatClass OatFile::OatDexFile::GetOatClass(uint32_t class_def_index) const { +const OatFile::OatClass* OatFile::OatDexFile::GetOatClass(uint32_t class_def_index) const { uint32_t methods_offset = classes_pointer_[class_def_index]; const byte* methods_pointer = oat_file_->GetBase() + methods_offset; CHECK_LT(methods_pointer, oat_file_->GetLimit()); - return OatClass(oat_file_, reinterpret_cast<const OatMethodOffsets*>(methods_pointer)); + return new OatClass(oat_file_, reinterpret_cast<const OatMethodOffsets*>(methods_pointer)); } OatFile::OatClass::OatClass(const OatFile* oat_file, const OatMethodOffsets* methods_pointer) @@ -186,7 +195,7 @@ OatFile::OatMethod::OatMethod(const void* code, OatFile::OatMethod::~OatMethod() {} -void OatFile::OatMethod::LinkMethod(Method* method) { +void OatFile::OatMethod::LinkMethod(Method* method) const { CHECK(method != NULL); method->SetCode(code_); method->SetFrameSizeInBytes(frame_size_in_bytes_); |