From 4a13acb07d254aba1a3143ca0c27ead1905b863c Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Tue, 2 Mar 2021 12:25:02 +0000 Subject: [PATCH] Use compiler filter "verify" for dexpreopt w/o class loader context. In cases when class loader context cannot be computed at build time and verify_uses_libraries check is relaxed (RELAX_USES_LIBRARY_CHECK=true) dexpreopt uses a special compiler filter that suppresses AOT-compilation to native code and applies only those optimizations that do not require class loader context. Previously the "extract" filter was used. Now ART supports using "verify" filter in this configuration. Bug: 132357300 Test: lunch cf_x86_64_phone-userdebug && m && launch_cvd \ adb wait-for-device && adb root && adb logcat \ | grep -E 'ClassLoaderContext [a-z ]+ mismatch' # empty grep output, no errors Change-Id: Id4933aa94ea96894278355283383c16d103e98c9 --- dexpreopt/config.go | 2 +- dexpreopt/dexpreopt.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dexpreopt/config.go b/dexpreopt/config.go index 36a5e2aa2..888466a2f 100644 --- a/dexpreopt/config.go +++ b/dexpreopt/config.go @@ -85,7 +85,7 @@ type GlobalConfig struct { Dex2oatImageXmx string // max heap size for dex2oat for the boot image Dex2oatImageXms string // initial heap size for dex2oat for the boot image - // If true, downgrade the compiler filter of dexpreopt to "extract" when verify_uses_libraries + // If true, downgrade the compiler filter of dexpreopt to "verify" when verify_uses_libraries // check fails, instead of failing the build. This will disable any AOT-compilation. // // The intended use case for this flag is to have a smoother migration path for the Java diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go index 6e0fe01f9..737773fcb 100644 --- a/dexpreopt/dexpreopt.go +++ b/dexpreopt/dexpreopt.go @@ -369,11 +369,11 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g } if module.EnforceUsesLibraries { // If the verify_uses_libraries check failed (in this case status file contains a - // non-empty error message), then use "extract" compiler filter to avoid compiling any + // non-empty error message), then use "verify" compiler filter to avoid compiling any // code (it would be rejected on device because of a class loader context mismatch). cmd.Text("--compiler-filter=$(if test -s "). Input(module.EnforceUsesLibrariesStatusFile). - Text(" ; then echo extract ; else echo " + compilerFilter + " ; fi)") + Text(" ; then echo verify ; else echo " + compilerFilter + " ; fi)") } else { cmd.FlagWithArg("--compiler-filter=", compilerFilter) }