diff options
| author | 2011-10-13 14:58:47 -0700 | |
|---|---|---|
| committer | 2011-10-14 00:24:28 -0700 | |
| commit | b7bbba49d88eae58223d9878da4069bf6d7140bf (patch) | |
| tree | 00d1a0758d762903e648bb550434320822228c46 /src/class_linker.cc | |
| parent | 30646836b4a1c6e5e80ddaea246cf9669eaa0628 (diff) | |
Add oatopt drop in replacement for dexopt
Change-Id: I094375230af2d9a88e30245b390cac71be7b50f4
Diffstat (limited to 'src/class_linker.cc')
| -rw-r--r-- | src/class_linker.cc | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/class_linker.cc b/src/class_linker.cc index f610f31e55..9fd8f0b249 100644 --- a/src/class_linker.cc +++ b/src/class_linker.cc @@ -573,16 +573,8 @@ OatFile* ClassLinker::OpenOat(const Space* space) { const OatFile* ClassLinker::FindOatFile(const DexFile& dex_file) { MutexLock mu(lock_); - std::string dex_file_location = dex_file.GetLocation(); - std::string location(dex_file_location); - CHECK(StringPiece(location).ends_with(".dex") - || StringPiece(location).ends_with(".zip") - || StringPiece(location).ends_with(".jar") - || StringPiece(location).ends_with(".apk")); - location.erase(location.size()-3); - location += "oat"; // TODO: check if dex_file matches an OatDexFile location and checksum - return FindOatFile(location); + return FindOatFile(OatFile::DexFileToOatFilename(dex_file)); } const OatFile* ClassLinker::FindOatFile(const std::string& location) { @@ -601,10 +593,7 @@ const OatFile* ClassLinker::FindOatFile(const std::string& location) { return NULL; } // not found in /foo/bar/baz.oat? try /data/art-cache/foo@bar@baz.oat - std::string art_cache = GetArtCacheOrDie(); - std::string cache_file(location, 1); // skip leading slash - std::replace(cache_file.begin(), cache_file.end(), '/', '@'); - std::string cache_location = art_cache + "/" + cache_file; + std::string cache_location = GetArtCacheOatFilenameOrDie(location); oat_file = OatFile::Open(cache_location, "", NULL); if (oat_file == NULL) { LOG(ERROR) << "Failed to open oat file from " << location << " or " << cache_location << "."; |