diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-28 17:15:50 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-28 17:16:01 +0000 |
commit | d4695fc547211208ac4b880c76ecd5f569585da2 (patch) | |
tree | 9fa08156c90dd7c4c691d2577c64017a55208664 | |
parent | 04ca607c0c3e5a8d0eca632faf2d9e3bf3835fd9 (diff) | |
parent | 3329394cc924c353a283078f4429f0a6d0ad6174 (diff) | |
download | art-d4695fc547211208ac4b880c76ecd5f569585da2.tar.gz |
Make change and version bump to aml_art_341311030 for mainline module file: build/apex/manifest-art.json
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25492113'] into sparse-11133968-L45900030000498441.
SPARSE_CHANGE: Ie8fee165bae8ee57b7b2dcb3fb756f33867862e5
Change-Id: I44d1afe019ec7097b1cb918e1ae5baf332b49194
-rw-r--r-- | build/apex/manifest-art.json | 2 | ||||
-rw-r--r-- | build/art.go | 3 | ||||
-rw-r--r-- | dex2oat/dex2oat.cc | 16 | ||||
-rw-r--r-- | dex2oat/dex2oat_options.cc | 4 | ||||
-rw-r--r-- | dex2oat/dex2oat_test.cc | 22 | ||||
-rw-r--r-- | dexlayout/dexlayout_test.cc | 15 | ||||
-rw-r--r-- | libdexfile/dex/compact_dex_level.h | 8 |
7 files changed, 36 insertions, 34 deletions
diff --git a/build/apex/manifest-art.json b/build/apex/manifest-art.json index e30953f63d..7206121e29 100644 --- a/build/apex/manifest-art.json +++ b/build/apex/manifest-art.json @@ -3,7 +3,7 @@ // Placeholder module version to be replaced during build. // Do not change! - "version": 341311020, + "version": 341311030, "provideNativeLibs": [ "libjdwp.so" diff --git a/build/art.go b/build/art.go index f03a528f5d..dd2106ea88 100644 --- a/build/art.go +++ b/build/art.go @@ -84,6 +84,9 @@ func globalFlags(ctx android.LoadHookContext) ([]string, []string) { cflags = append(cflags, "-DART_USE_TLAB=1") } + cdexLevel := ctx.Config().GetenvWithDefault("ART_DEFAULT_COMPACT_DEX_LEVEL", "fast") + cflags = append(cflags, "-DART_DEFAULT_COMPACT_DEX_LEVEL="+cdexLevel) + // We need larger stack overflow guards for ASAN, as the compiled code will have // larger frame sizes. For simplicity, just use global not-target-specific cflags. // Note: We increase this for both debug and non-debug, as the overflow gap will diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 98acff62a4..f4c3e2a094 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1116,9 +1116,17 @@ class Dex2Oat final { AssignIfExists(args, M::PublicSdk, &public_sdk_); AssignIfExists(args, M::ApexVersions, &apex_versions_argument_); + // Check for phenotype flag to override compact_dex_level_, if it isn't "none" already. + // TODO(b/256664509): Clean this up. if (compact_dex_level_ != CompactDexLevel::kCompactDexLevelNone) { - LOG(WARNING) << "Obsolete flag --compact-dex-level ignored"; - compact_dex_level_ = CompactDexLevel::kCompactDexLevelNone; + std::string ph_disable_compact_dex = + android::base::GetProperty(kPhDisableCompactDex, "false"); + if (ph_disable_compact_dex == "true") { + LOG(WARNING) + << "Overriding --compact-dex-level due to " + "persist.device_config.runtime_native_boot.disable_compact_dex set to `true`"; + compact_dex_level_ = CompactDexLevel::kCompactDexLevelNone; + } } AssignIfExists(args, M::Backend, &compiler_kind_); @@ -2973,9 +2981,7 @@ class Dex2Oat final { std::string android_root_; std::string no_inline_from_string_; bool force_allow_oj_inlines_ = false; - - // TODO(b/256664509): Clean this up. - CompactDexLevel compact_dex_level_ = CompactDexLevel::kCompactDexLevelNone; + CompactDexLevel compact_dex_level_ = kDefaultCompactDexLevel; std::vector<std::unique_ptr<linker::ElfWriter>> elf_writers_; std::vector<std::unique_ptr<linker::OatWriter>> oat_writers_; diff --git a/dex2oat/dex2oat_options.cc b/dex2oat/dex2oat_options.cc index 1c46d1373f..4da219897b 100644 --- a/dex2oat/dex2oat_options.cc +++ b/dex2oat/dex2oat_options.cc @@ -427,7 +427,9 @@ Parser CreateDex2oatArgumentParser() { .WithType<CompactDexLevel>() .WithValueMap({{"none", CompactDexLevel::kCompactDexLevelNone}, {"fast", CompactDexLevel::kCompactDexLevelFast}}) - .WithHelp("This flag is obsolete and does nothing.") + .WithHelp("None avoids generating compact dex, fast generates compact dex with low\n" + "compile time. If speed-profile is specified as the compiler filter and the\n" + "profile is not empty, the default compact dex level is always used.") .IntoKey(M::CompactDexLevel) .Define("--runtime-arg _") .WithType<std::vector<std::string>>().AppendValues() diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc index 511fdfaab8..ca76254fc1 100644 --- a/dex2oat/dex2oat_test.cc +++ b/dex2oat/dex2oat_test.cc @@ -1242,9 +1242,6 @@ TEST_F(Dex2oatDeterminism, UnloadCompile) { // Test that dexlayout section info is correctly written to the oat file for profile based // compilation. TEST_F(Dex2oatTest, LayoutSections) { - // TODO(b/256664509): Clean this up. - GTEST_SKIP() << "Compact dex is disabled"; -#if 0 using Hotness = ProfileCompilationInfo::MethodHotness; std::unique_ptr<const DexFile> dex(OpenTestDexFile("ManyMethods")); ScratchFile profile_file; @@ -1395,14 +1392,10 @@ TEST_F(Dex2oatTest, LayoutSections) { EXPECT_GT(startup_count, 0u); EXPECT_GT(unused_count, 0u); } -#endif // 0 } // Test that generating compact dex works. TEST_F(Dex2oatTest, GenerateCompactDex) { - // TODO(b/256664509): Clean this up. - GTEST_SKIP() << "Compact dex is disabled"; -#if 0 // Generate a compact dex based odex. const std::string dir = GetScratchDir(); const std::string oat_filename = dir + "/base.oat"; @@ -1458,7 +1451,6 @@ TEST_F(Dex2oatTest, GenerateCompactDex) { } } } -#endif // 0 } class Dex2oatVerifierAbort : public Dex2oatTest {}; @@ -1697,7 +1689,8 @@ TEST_F(Dex2oatTest, CompactDexGenerationFailureMultiDex) { } const std::string& dex_location = apk_file.GetFilename(); const std::string odex_location = GetOdexDir() + "/output.odex"; - ASSERT_TRUE(GenerateOdexForTest(dex_location, odex_location, CompilerFilter::kVerify, {}, true)); + ASSERT_TRUE(GenerateOdexForTest( + dex_location, odex_location, CompilerFilter::kVerify, {"--compact-dex-level=fast"}, true)); } TEST_F(Dex2oatTest, StderrLoggerOutput) { @@ -1876,8 +1869,11 @@ TEST_F(Dex2oatTest, CompactDexInvalidSource) { const std::string& dex_location = invalid_dex.GetFilename(); const std::string odex_location = GetOdexDir() + "/output.odex"; std::string error_msg; - int status = GenerateOdexForTestWithStatus( - {dex_location}, odex_location, CompilerFilter::kVerify, &error_msg, {}); + int status = GenerateOdexForTestWithStatus({dex_location}, + odex_location, + CompilerFilter::kVerify, + &error_msg, + {"--compact-dex-level=fast"}); ASSERT_TRUE(WIFEXITED(status) && WEXITSTATUS(status) != 0) << status << " " << output_; } @@ -1915,14 +1911,14 @@ TEST_F(Dex2oatTest, CompactDexInZip) { GetOdexDir() + "/output_apk.odex", CompilerFilter::kVerify, &error_msg, - {}); + {"--compact-dex-level=fast"}); ASSERT_TRUE(WIFEXITED(status) && WEXITSTATUS(status) != 0) << status << " " << output_; status = GenerateOdexForTestWithStatus({invalid_dex.GetFilename()}, GetOdexDir() + "/output.odex", CompilerFilter::kVerify, &error_msg, - {}); + {"--compact-dex-level=fast"}); ASSERT_TRUE(WIFEXITED(status) && WEXITSTATUS(status) != 0) << status << " " << output_; } diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc index 4e4811ffa5..03df258f04 100644 --- a/dexlayout/dexlayout_test.cc +++ b/dexlayout/dexlayout_test.cc @@ -225,8 +225,11 @@ static const char kDuplicateCodeItemInputDex[] = "AHAAAAACAAAAAwAAAIwAAAADAAAAAQAAAJgAAAAFAAAABAAAAKQAAAAGAAAAAQAAAMQAAAABIAAA" "AwAAAOQAAAACIAAABwAAACQBAAADIAAAAwAAAFYBAAAAIAAAAQAAAGUBAAAAEAAAAQAAAHgBAAA="; -// Returns the default compact dex option for dexlayout. -static std::vector<std::string> DefaultCompactDexOption() { return {"-x", "none"}; } +// Returns the default compact dex option for dexlayout based on kDefaultCompactDexLevel. +static std::vector<std::string> DefaultCompactDexOption() { + return (kDefaultCompactDexLevel == CompactDexLevel::kCompactDexLevelFast) ? + std::vector<std::string>{"-x", "fast"} : std::vector<std::string>{"-x", "none"}; +} static void WriteBase64ToFile(const char* base64, File* file) { // Decode base64. @@ -546,25 +549,17 @@ class DexLayoutTest : public CommonArtTest { TEST_F(DexLayoutTest, FullPlainOutput) { - // TODO(b/256664509): Clean this up. - GTEST_SKIP() << "Compact dex is disabled"; -#if 0 // Disable test on target. TEST_DISABLED_FOR_TARGET(); std::string error_msg; ASSERT_TRUE(FullPlainOutputExec(&error_msg)) << error_msg; -#endif } TEST_F(DexLayoutTest, DexFileOutput) { - // TODO(b/256664509): Clean this up. - GTEST_SKIP() << "Compact dex is disabled"; -#if 0 // Disable test on target. TEST_DISABLED_FOR_TARGET(); std::string error_msg; ASSERT_TRUE(DexFileOutputExec(&error_msg)) << error_msg; -#endif } TEST_F(DexLayoutTest, DexFileLayout) { diff --git a/libdexfile/dex/compact_dex_level.h b/libdexfile/dex/compact_dex_level.h index 2f06688e8e..599ec4db19 100644 --- a/libdexfile/dex/compact_dex_level.h +++ b/libdexfile/dex/compact_dex_level.h @@ -24,7 +24,6 @@ namespace art { // Optimization level for compact dex generation. -// TODO(b/256664509): Clean this up. enum class CompactDexLevel { // Level none means not generated. kCompactDexLevelNone, @@ -32,7 +31,9 @@ enum class CompactDexLevel { kCompactDexLevelFast, }; -#ifdef ART_DEFAULT_COMPACT_DEX_LEVEL +#ifndef ART_DEFAULT_COMPACT_DEX_LEVEL +#error ART_DEFAULT_COMPACT_DEX_LEVEL not specified. +#else #define ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_fast CompactDexLevel::kCompactDexLevelFast #define ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_none CompactDexLevel::kCompactDexLevelNone @@ -40,8 +41,7 @@ enum class CompactDexLevel { ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_, \ ART_DEFAULT_COMPACT_DEX_LEVEL) -static_assert(ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT == CompactDexLevel::kCompactDexLevelNone, - "ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT != none is no longer supported"); +static constexpr CompactDexLevel kDefaultCompactDexLevel = ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT; #endif } // namespace art |