summaryrefslogtreecommitdiff
path: root/runtime/class_loader_context.cc
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2020-12-11 18:26:14 -0800
committer Calin Juravle <calin@google.com> 2020-12-14 19:00:35 +0000
commit5ff2393e1fb6e61fc74f20c66f80f4b8656987d1 (patch)
treee94b8cfc92379678b4f2e6446aa6d28a6408222f /runtime/class_loader_context.cc
parent99459f3bdd8d569ec7054920cbc32e6915d1e125 (diff)
Remove stripped-apk related logic from CLC
Stripped-apks are no longer supported by the runtime and the current logic prevents bug fixes and code evolution. Bug: 111442216 Test: test-art-host Change-Id: I30d5825e4f6453981ca9165bebafe67557c28b93
Diffstat (limited to 'runtime/class_loader_context.cc')
-rw-r--r--runtime/class_loader_context.cc48
1 files changed, 10 insertions, 38 deletions
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 74f464c0bd..34a1722adf 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -399,10 +399,8 @@ ClassLoaderContext::ClassLoaderInfo* ClassLoaderContext::ParseInternal(
return first.release();
}
-// Opens requested class path files and appends them to opened_dex_files. If the dex files have
-// been stripped, this opens them from their oat files (which get added to opened_oat_files).
-bool ClassLoaderContext::OpenDexFiles(InstructionSet isa,
- const std::string& classpath_dir,
+// Opens requested class path files and appends them to opened_dex_files.
+bool ClassLoaderContext::OpenDexFiles(const std::string& classpath_dir,
const std::vector<int>& fds) {
if (dex_files_open_attempted_) {
// Do not attempt to re-open the files if we already tried.
@@ -460,40 +458,14 @@ bool ClassLoaderContext::OpenDexFiles(InstructionSet isa,
// contents. So pass true to verify_checksum.
// We don't need to do structural dex file verification, we only need to
// check the checksum, so pass false to verify.
- if (fd < 0) {
- if (!dex_file_loader.Open(location.c_str(),
- location.c_str(),
- /*verify=*/ false,
- /*verify_checksum=*/ true,
- &error_msg,
- &info->opened_dex_files)) {
- // If we fail to open the dex file because it's been stripped, try to
- // open the dex file from its corresponding oat file.
- // This could happen when we need to recompile a pre-build whose dex
- // code has been stripped (for example, if the pre-build is only
- // quicken and we want to re-compile it speed-profile).
- // TODO(calin): Use the vdex directly instead of going through the oat file.
- OatFileAssistant oat_file_assistant(location.c_str(), isa, false);
- std::unique_ptr<OatFile> oat_file(oat_file_assistant.GetBestOatFile());
- std::vector<std::unique_ptr<const DexFile>> oat_dex_files;
- if (oat_file != nullptr &&
- OatFileAssistant::LoadDexFiles(*oat_file, location, &oat_dex_files)) {
- info->opened_oat_files.push_back(std::move(oat_file));
- info->opened_dex_files.insert(info->opened_dex_files.end(),
- std::make_move_iterator(oat_dex_files.begin()),
- std::make_move_iterator(oat_dex_files.end()));
- } else {
- LOG(WARNING) << "Could not open dex files from location: " << location;
- dex_files_open_result_ = false;
- }
- }
- } else if (!dex_file_loader.Open(fd,
- location.c_str(),
- /*verify=*/ false,
- /*verify_checksum=*/ true,
- &error_msg,
- &info->opened_dex_files)) {
- LOG(WARNING) << "Could not open dex files from fd " << fd << " for location: " << location;
+ if (!dex_file_loader.Open(location.c_str(),
+ fd,
+ location.c_str(),
+ /*verify=*/ false,
+ /*verify_checksum=*/ true,
+ &error_msg,
+ &info->opened_dex_files)) {
+ LOG(WARNING) << "Could not open dex files for location " << location << ", fd=" << fd;
dex_files_open_result_ = false;
}
}