summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-07 11:01:04 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-07 11:01:04 +0000
commitb82694a2ef9be8b0a6331157b0154eebf8cc9e1b (patch)
tree47eae8c66bb84e11dc84fd66df8b869a38ad7347
parentf043505461f65d7f18c1eec65772a631f73eee0e (diff)
parent98ff3fb4dde267dc9c9f77f6c6c601e18011454b (diff)
downloadart-android12-mainline-tethering-release.tar.gz
Snap for 8417617 from 98ff3fb4dde267dc9c9f77f6c6c601e18011454b to mainline-tethering-releaseandroid-mainline-12.0.0_r125aml_tet_311811050android12-mainline-tethering-release
Change-Id: I3bface91014d8ec2dc35ea8a8436f8b2e15a7ebc
-rw-r--r--dex2oat/dex2oat.cc6
-rw-r--r--dex2oat/dex2oat_test.cc3
-rw-r--r--dex2oat/linker/oat_writer.cc11
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)