From b0a2d37dcb8c2a8acf92ed4794cfb8f6bd8311f1 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Tue, 28 Jan 2020 14:42:41 +0000 Subject: [PATCH] Fix --boot-image argument in dex2oat command for boot image extension. The primary image name should be "boot.art" in case of "boot-framework.art", and "apex.art" in case of "apex-framework.art". Although "boot.art" and "apex.art" are identical binaries, dex2oat has hard-coded logic based on the image name. This has been broken since boot image extension has been enabled for JIT-zygote config in CL I5493e575ebf90bad1d5ad2850004d54590bbc079. Test: compare boot-framework.art and apex-framework.art, they were identical before this CL, and differ after this CL. Test: JIT-zygote config boots, steps 1-2: 1. Temporarily enable Jit zygote in the product device config (in this case device/google/muskie/aosp_walleye.mk): +# System server should not contain compiled code. +PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := verify + +# Use the apex image for preopting. +DEXPREOPT_USE_APEX_IMAGE := true + +# Have the runtime pick up the apex image. +PRODUCT_PROPERTY_OVERRIDES += \ + dalvik.vm.boot-image=/apex/com.android.art/javalib/apex.art:/system/framework/apex-framework.art 2. Build and flash: $ lunch aosp_walleye-userdebug && m \ && adb reboot bootloader && fastboot flashall -w Change-Id: I98de271852ecc33feb9fd4c9b0addf0feba01856 --- java/dexpreopt_bootjars.go | 5 ++++- java/dexpreopt_config.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index c6aa7fe0d..87f6d5e33 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -88,6 +88,9 @@ type bootImageConfig struct { images map[android.ArchType]android.OutputPath // first image file imagesDeps map[android.ArchType]android.OutputPaths // all files + // Only for extensions, paths to the primary boot images (grouped by target). + primaryImages map[android.ArchType]android.OutputPath + // File path to a zip archive with all image files (or nil, if not needed). zip android.WritablePath } @@ -355,7 +358,7 @@ func buildBootImageRuleForArch(ctx android.SingletonContext, image *bootImage, } if image.extension { - artImage := artBootImageConfig(ctx).images[arch] + artImage := image.primaryImages[arch] cmd. Flag("--runtime-arg").FlagWithInputList("-Xbootclasspath:", image.dexPathsDeps.Paths(), ":"). Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", image.dexLocationsDeps, ":"). diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go index 31bec93eb..637a32f0a 100644 --- a/java/dexpreopt_config.go +++ b/java/dexpreopt_config.go @@ -246,10 +246,12 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig { // specific to the framework config frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...) + frameworkCfg.primaryImages = artCfg.images frameworkCfg.imageLocations = append(artCfg.imageLocations, frameworkCfg.imageLocations...) // specific to the jitzygote-framework config frameworkJZCfg.dexPathsDeps = append(artJZCfg.dexPathsDeps, frameworkJZCfg.dexPathsDeps...) + frameworkJZCfg.primaryImages = artJZCfg.images frameworkJZCfg.imageLocations = append(artJZCfg.imageLocations, frameworkJZCfg.imageLocations...) return configs