diff options
| author | 2017-11-20 15:10:28 +0000 | |
|---|---|---|
| committer | 2017-12-13 22:23:12 +0000 | |
| commit | ae7e83817e546848ef6b2949dd9065b153e14316 (patch) | |
| tree | e46ea86e925c4b2a4237f5ebba0c7ba3d61b0359 /compiler/driver/compiler_driver.cc | |
| parent | dc93cac66f1db225474cec5bf0350fd7a148085e (diff) | |
Don't embed the dex code in the oat file if dex is uncompressed.
Take uncompressed dex code as a signal that the app wants to
opt into b/63920015.
bug: 63920015
Test: dex2oat_test, 071-dexfile-clean-map
Change-Id: I878e7bb80fc895a2d9aafe81aa7666b86af1f808
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 0ca3c8f613..d1cb175430 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -401,6 +401,12 @@ static optimizer::DexToDexCompilationLevel 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::DexToDexCompilationLevel::kDontDexToDexCompile; + } auto* const runtime = Runtime::Current(); DCHECK(driver.GetCompilerOptions().IsQuickeningCompilationEnabled()); const char* descriptor = dex_file.GetClassDescriptor(class_def); |