diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-05 20:44:36 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-05 20:44:36 +0000 |
commit | 950aefcb522aba8148e8075f59787bd06c790cb1 (patch) | |
tree | 47eae8c66bb84e11dc84fd66df8b869a38ad7347 | |
parent | 5af7eac28c8426a28e6f714d0d00c14e090a9aa5 (diff) | |
parent | 98ff3fb4dde267dc9c9f77f6c6c601e18011454b (diff) | |
download | art-android-mainline-12.0.0_r123.tar.gz |
Snap for 8408623 from 98ff3fb4dde267dc9c9f77f6c6c601e18011454b to mainline-permission-releaseandroid-mainline-12.0.0_r123
Change-Id: I84510f10b1a47ae941cc432531d8323c3aa5e460
-rw-r--r-- | dex2oat/dex2oat.cc | 6 | ||||
-rw-r--r-- | dex2oat/dex2oat_test.cc | 3 | ||||
-rw-r--r-- | dex2oat/linker/oat_writer.cc | 11 |
3 files changed, 10 insertions, 10 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index c323879c2b..f1ded6d448 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -2343,7 +2343,11 @@ class Dex2Oat final { } bool DoDexLayoutOptimizations() const { - return DoProfileGuidedOptimizations() || DoGenerateCompactDex(); + // Only run dexlayout when being asked to generate compact dex. We do this + // to avoid having multiple arguments being passed to dex2oat and the main + // user of dex2oat (installd) will have the same reasons for + // disabling/enabling compact dex and dex layout. + return DoGenerateCompactDex(); } bool DoOatLayoutOptimizations() const { diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc index cc29b0f3c8..39cbe60ca0 100644 --- a/dex2oat/dex2oat_test.cc +++ b/dex2oat/dex2oat_test.cc @@ -1206,7 +1206,8 @@ TEST_F(Dex2oatTest, LayoutSections) { oat_filename, CompilerFilter::Filter::kVerify, &error_msg, - {"--profile-file=" + profile_file.GetFilename()}); + {"--profile-file=" + profile_file.GetFilename(), + "--compact-dex-level=fast"}); EXPECT_EQ(res, 0); // Open our generated oat file. diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc index af2db2d701..d020b8a752 100644 --- a/dex2oat/linker/oat_writer.cc +++ b/dex2oat/linker/oat_writer.cc @@ -485,11 +485,6 @@ OatWriter::OatWriter(const CompilerOptions& compiler_options, relative_patcher_(nullptr), profile_compilation_info_(info), compact_dex_level_(compact_dex_level) { - // If we have a profile, always use at least the default compact dex level. The reason behind - // this is that CompactDex conversion is not more expensive than normal dexlayout. - if (info != nullptr && compact_dex_level_ == CompactDexLevel::kCompactDexLevelNone) { - compact_dex_level_ = kDefaultCompactDexLevel; - } } static bool ValidateDexFileHeader(const uint8_t* raw_header, const char* location) { @@ -3128,9 +3123,9 @@ bool OatWriter::WriteDexFiles(File* file, if (extract_dex_files_into_vdex_) { vdex_dex_files_offset_ = vdex_size_; - // Perform dexlayout if requested. - if (profile_compilation_info_ != nullptr || - compact_dex_level_ != CompactDexLevel::kCompactDexLevelNone) { + // Perform dexlayout if compact dex is enabled. Also see + // Dex2Oat::DoDexLayoutOptimizations. + if (compact_dex_level_ != CompactDexLevel::kCompactDexLevelNone) { for (OatDexFile& oat_dex_file : oat_dex_files_) { // update_input_vdex disables compact dex and layout. CHECK(!update_input_vdex) |