diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-01 16:07:06 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-01 16:07:24 +0000 |
commit | 612c4a773755d9be9738a0011791bf22d686ee2f (patch) | |
tree | ac19f929ec8d28b0f8a6f060cbde5f2665a7c5f3 | |
parent | d4695fc547211208ac4b880c76ecd5f569585da2 (diff) | |
parent | 75e9a6de119eb769f1fd7201756f105845d73470 (diff) | |
download | art-612c4a773755d9be9738a0011791bf22d686ee2f.tar.gz |
Make change and version bump to aml_art_341311050 for mainline module file: build/apex/manifest-art.json
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25518079', 'googleplex-android-review.googlesource.com/25525571', 'googleplex-android-review.googlesource.com/25528379', 'googleplex-android-review.googlesource.com/25528677'] into sparse-11150270-L12000030000611359.
SPARSE_CHANGE: I8aa35606a83ddb3a8d6fcc040523db4329801a77
SPARSE_CHANGE: I5195495eaf5303cb46657a24c173277e6e23372c
SPARSE_CHANGE: I8e140220df37c325bd10222a1b016ac8ad328879
SPARSE_CHANGE: I2f0e3847fc704270dd94212811b50d4cb2852cf5
Change-Id: I7b90f7227f9a704f790a6a9607eaada2da8be6d9
-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 | ||||
-rw-r--r-- | runtime/gc/space/image_space.cc | 12 | ||||
-rw-r--r-- | runtime/image.cc | 9 | ||||
-rw-r--r-- | runtime/runtime.cc | 3 |
10 files changed, 54 insertions, 40 deletions
diff --git a/build/apex/manifest-art.json b/build/apex/manifest-art.json index 7206121e29..3e67c2568b 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": 341311030, + "version": 341311050, "provideNativeLibs": [ "libjdwp.so" diff --git a/build/art.go b/build/art.go index dd2106ea88..f03a528f5d 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 f4c3e2a094..98acff62a4 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1116,17 +1116,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_); @@ -2981,7 +2973,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 ca76254fc1..511fdfaab8 100644 --- a/dex2oat/dex2oat_test.cc +++ b/dex2oat/dex2oat_test.cc @@ -1242,6 +1242,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; @@ -1392,10 +1395,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"; @@ -1451,6 +1458,7 @@ TEST_F(Dex2oatTest, GenerateCompactDex) { } } } +#endif // 0 } class Dex2oatVerifierAbort : public Dex2oatTest {}; @@ -1689,8 +1697,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) { @@ -1869,11 +1876,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_; } @@ -1911,14 +1915,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 diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index 56efcabb7c..f4606018b2 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -1052,6 +1052,7 @@ class ImageSpace::Loader { Thread* const self = Thread::Current(); static constexpr size_t kMinBlocks = 2u; const bool use_parallel = pool != nullptr && image_header.GetBlockCount() >= kMinBlocks; + bool failed_decompression = false; for (const ImageHeader::Block& block : image_header.GetBlocks(temp_map.Begin())) { auto function = [&](Thread*) { const uint64_t start2 = NanoTime(); @@ -1059,8 +1060,11 @@ class ImageSpace::Loader { bool result = block.Decompress(/*out_ptr=*/map.Begin(), /*in_ptr=*/temp_map.Begin(), error_msg); - if (!result && error_msg != nullptr) { - *error_msg = "Failed to decompress image block " + *error_msg; + if (!result) { + failed_decompression = true; + if (error_msg != nullptr) { + *error_msg = "Failed to decompress image block " + *error_msg; + } } VLOG(image) << "Decompress block " << block.GetDataSize() << " -> " << block.GetImageSize() << " in " << PrettyDuration(NanoTime() - start2); @@ -1082,6 +1086,10 @@ class ImageSpace::Loader { VLOG(image) << "Decompressing image took " << PrettyDuration(time) << " (" << PrettySize(static_cast<uint64_t>(map.Size()) * MsToNs(1000) / (time + 1)) << "/s)"; + if (failed_decompression) { + DCHECK(error_msg == nullptr || !error_msg->empty()); + return MemMap::Invalid(); + } } else { DCHECK(!allow_direct_mapping); // We do not allow direct mapping for boot image extensions compiled to a memfd. diff --git a/runtime/image.cc b/runtime/image.cc index c8021f82e2..37437b4b86 100644 --- a/runtime/image.cc +++ b/runtime/image.cc @@ -219,7 +219,14 @@ bool ImageHeader::Block::Decompress(uint8_t* out_ptr, if (!ok) { return false; } - CHECK_EQ(decompressed_size, image_size_); + if (decompressed_size != image_size_) { + if (error_msg != nullptr) { + // Maybe some disk / memory corruption, just bail. + *error_msg = (std::ostringstream() << "Decompressed size different than image size: " + << decompressed_size << ", and " << image_size_).str(); + } + return false; + } break; } default: { diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 93a8bd0f91..7eff246d12 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -956,7 +956,8 @@ static jobject CreateSystemClassLoader(Runtime* runtime) { CHECK(getSystemClassLoader->IsStatic()); ObjPtr<mirror::Object> system_class_loader = getSystemClassLoader->InvokeStatic<'L'>(soa.Self()); - CHECK(system_class_loader != nullptr); + CHECK(system_class_loader != nullptr) + << (soa.Self()->IsExceptionPending() ? soa.Self()->GetException()->Dump() : "<null>"); ScopedAssertNoThreadSuspension sants(__FUNCTION__); jobject g_system_class_loader = |