diff options
author | 2023-08-31 21:59:41 +0100 | |
---|---|---|
committer | 2023-09-01 17:16:00 +0000 | |
commit | fa41df028f28e8f71f0e06ccc6b97c6a099b5bba (patch) | |
tree | 17c09a42dabae009bfcce82beedd448a5e26a773 | |
parent | 302834e635f2f6ba8f55350c2b9af40b7d7ddc07 (diff) |
Disable cdex at build time.
Code cleanup will come later.
Test: banchan com.android.art && m
Test: atest art_dexlayout_tests art_dexdiag_tests \
art_standalone_dex2oat_tests art_standalone_dex2oat_cts_tests
Bug: 256664509
Change-Id: I3079ba4d4d09ca5edbd30593210451eebf98b924
-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 |
6 files changed, 33 insertions, 35 deletions
diff --git a/build/art.go b/build/art.go index 0e5c055d26..848b1a4056 100644 --- a/build/art.go +++ b/build/art.go @@ -84,9 +84,6 @@ 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 515148dbca..a109ac7f09 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1110,17 +1110,9 @@ 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) { - 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; - } + LOG(WARNING) << "Obsolete flag --compact-dex-level ignored"; + compact_dex_level_ = CompactDexLevel::kCompactDexLevelNone; } AssignIfExists(args, M::Backend, &compiler_kind_); @@ -2975,7 +2967,9 @@ class Dex2Oat final { std::string android_root_; std::string no_inline_from_string_; bool force_allow_oj_inlines_ = false; - CompactDexLevel compact_dex_level_ = kDefaultCompactDexLevel; + + // TODO(b/256664509): Clean this up. + CompactDexLevel compact_dex_level_ = CompactDexLevel::kCompactDexLevelNone; 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 4da219897b..1c46d1373f 100644 --- a/dex2oat/dex2oat_options.cc +++ b/dex2oat/dex2oat_options.cc @@ -427,9 +427,7 @@ Parser CreateDex2oatArgumentParser() { .WithType<CompactDexLevel>() .WithValueMap({{"none", CompactDexLevel::kCompactDexLevelNone}, {"fast", CompactDexLevel::kCompactDexLevelFast}}) - .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.") + .WithHelp("This flag is obsolete and does nothing.") .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 84b133b9a2..ed57dc316c 100644 --- a/dex2oat/dex2oat_test.cc +++ b/dex2oat/dex2oat_test.cc @@ -1245,6 +1245,9 @@ 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,10 +1398,14 @@ 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"; @@ -1454,6 +1461,7 @@ TEST_F(Dex2oatTest, GenerateCompactDex) { } } } +#endif // 0 } class Dex2oatVerifierAbort : public Dex2oatTest {}; @@ -1693,8 +1701,7 @@ 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, {"--compact-dex-level=fast"}, true)); + ASSERT_TRUE(GenerateOdexForTest(dex_location, odex_location, CompilerFilter::kVerify, {}, true)); } TEST_F(Dex2oatTest, StderrLoggerOutput) { @@ -1873,11 +1880,8 @@ 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, - {"--compact-dex-level=fast"}); + int status = GenerateOdexForTestWithStatus( + {dex_location}, odex_location, CompilerFilter::kVerify, &error_msg, {}); ASSERT_TRUE(WIFEXITED(status) && WEXITSTATUS(status) != 0) << status << " " << output_; } @@ -1915,14 +1919,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 03df258f04..4e4811ffa5 100644 --- a/dexlayout/dexlayout_test.cc +++ b/dexlayout/dexlayout_test.cc @@ -225,11 +225,8 @@ static const char kDuplicateCodeItemInputDex[] = "AHAAAAACAAAAAwAAAIwAAAADAAAAAQAAAJgAAAAFAAAABAAAAKQAAAAGAAAAAQAAAMQAAAABIAAA" "AwAAAOQAAAACIAAABwAAACQBAAADIAAAAwAAAFYBAAAAIAAAAQAAAGUBAAAAEAAAAQAAAHgBAAA="; -// 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"}; -} +// Returns the default compact dex option for dexlayout. +static std::vector<std::string> DefaultCompactDexOption() { return {"-x", "none"}; } static void WriteBase64ToFile(const char* base64, File* file) { // Decode base64. @@ -549,17 +546,25 @@ 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 599ec4db19..2f06688e8e 100644 --- a/libdexfile/dex/compact_dex_level.h +++ b/libdexfile/dex/compact_dex_level.h @@ -24,6 +24,7 @@ namespace art { // Optimization level for compact dex generation. +// TODO(b/256664509): Clean this up. enum class CompactDexLevel { // Level none means not generated. kCompactDexLevelNone, @@ -31,9 +32,7 @@ enum class CompactDexLevel { kCompactDexLevelFast, }; -#ifndef ART_DEFAULT_COMPACT_DEX_LEVEL -#error ART_DEFAULT_COMPACT_DEX_LEVEL not specified. -#else +#ifdef ART_DEFAULT_COMPACT_DEX_LEVEL #define ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_fast CompactDexLevel::kCompactDexLevelFast #define ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_none CompactDexLevel::kCompactDexLevelNone @@ -41,7 +40,8 @@ enum class CompactDexLevel { ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_, \ ART_DEFAULT_COMPACT_DEX_LEVEL) -static constexpr CompactDexLevel kDefaultCompactDexLevel = ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT; +static_assert(ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT == CompactDexLevel::kCompactDexLevelNone, + "ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT != none is no longer supported"); #endif } // namespace art |