summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2018-01-24 08:56:59 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-01-24 08:56:59 +0000
commitb95eb37a04874a57046fba7fc09a8b197691e9a2 (patch)
tree547fb453899b546223dde08238e25cba3dc5fb0a /compiler/driver/compiler_driver.cc
parentf60b4c80e01b21da2228d35bc20309913065565d (diff)
parentf30752709e1131ae1a4c16f22cc7a0960c198e77 (diff)
Merge "Revert "Revert "Don't embed the dex code in the oat file if dex is uncompressed."""
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r--compiler/driver/compiler_driver.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 70cbb01569..3720dda0f8 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -384,6 +384,12 @@ static optimizer::DexToDexCompiler::CompilationLevel GetDexToDexCompilationLevel
Thread* self, const CompilerDriver& driver, Handle<mirror::ClassLoader> class_loader,
const DexFile& dex_file, const DexFile::ClassDef& class_def)
REQUIRES_SHARED(Locks::mutator_lock_) {
+ // When the dex file is uncompressed in the APK, we do not generate a copy in the .vdex
+ // file. As a result, dex2oat will map the dex file read-only, and we only need to check
+ // that to know if we can do quickening.
+ if (dex_file.GetContainer() != nullptr && dex_file.GetContainer()->IsReadOnly()) {
+ return optimizer::DexToDexCompiler::CompilationLevel::kDontDexToDexCompile;
+ }
auto* const runtime = Runtime::Current();
DCHECK(driver.GetCompilerOptions().IsQuickeningCompilationEnabled());
const char* descriptor = dex_file.GetClassDescriptor(class_def);