Use boot image extension in the JIT-zygote experiment.

Test: temporarily enable JIT-zygote configuration, build, boot the
  device and ensure that the JIT-zygote specific boot image
  apex-framework.art is mapped in the zygote address space:

  1. enable Jit zygote in the product device config (in my 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. lunch aosp_walleye-userdebug \
    && m \
    && adb reboot bootloader \
    && fastboot flashall -w

  3. adb shell cat /proc/`adb shell ps | grep zygote64 | awk {'print $2'}`/maps | grep apex-framework.art
  6fe44000-7025c000 rw-p 00000000 fc:02 1179718                            /data/dalvik-cache/arm64/apex@com.android.art@javalib@apex-framework.art
  70571000-70696000 rw-p 0072d000 fc:02 1179718                            /data/dalvik-cache/arm64/apex@com.android.art@javalib@apex-framework.art
  75a339f000-75a33ac000 r--p 00852000 fc:02 1179718                        /data/dalvik-cache/arm64/apex@com.android.art@javalib@apex-framework.art

Change-Id: I5493e575ebf90bad1d5ad2850004d54590bbc079
This commit is contained in:
Ulya Trafimovich
2019-12-09 15:40:17 +00:00
parent a773c39bfc
commit 57547452cf
3 changed files with 41 additions and 24 deletions

View File

@@ -121,10 +121,11 @@ func getJarsFromApexJarPairs(apexJarPairs []string) []string {
}
var (
bootImageConfigKey = android.NewOnceKey("bootImageConfig")
artBootImageName = "art"
frameworkBootImageName = "boot"
apexBootImageName = "apex"
bootImageConfigKey = android.NewOnceKey("bootImageConfig")
artBootImageName = "art"
frameworkBootImageName = "boot"
artJZBootImageName = "jitzygote-art"
frameworkJZBootImageName = "jitzygote-boot"
)
// Construct the global boot image configs.
@@ -178,22 +179,33 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
dexLocationsDeps: append(artLocations, frameworkLocations...),
}
// Apex config for the boot image used in the JIT-zygote experiment.
// It includes both the Core libraries and framework.
apexCfg := bootImageConfig{
// ART config for JIT-zygote boot image.
artJZCfg := bootImageConfig{
extension: false,
name: apexBootImageName,
name: artJZBootImageName,
stem: "apex",
installSubdir: artSubdir,
modules: artModules,
dexLocations: artLocations,
dexLocationsDeps: artLocations,
}
// Framework config for JIT-zygote boot image extension.
frameworkJZCfg := bootImageConfig{
extension: true,
name: frameworkJZBootImageName,
stem: "apex",
installSubdir: frameworkSubdir,
modules: concat(artModules, frameworkModules),
dexLocations: concat(artLocations, frameworkLocations),
dexLocationsDeps: concat(artLocations, frameworkLocations),
modules: frameworkModules,
dexLocations: frameworkLocations,
dexLocationsDeps: append(artLocations, frameworkLocations...),
}
configs := map[string]*bootImageConfig{
artBootImageName: &artCfg,
frameworkBootImageName: &frameworkCfg,
apexBootImageName: &apexCfg,
artBootImageName: &artCfg,
frameworkBootImageName: &frameworkCfg,
artJZBootImageName: &artJZCfg,
frameworkJZBootImageName: &frameworkJZCfg,
}
// common to all configs
@@ -235,6 +247,10 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...)
frameworkCfg.imageLocations = append(artCfg.imageLocations, frameworkCfg.imageLocations...)
// specific to the jitzygote-framework config
frameworkJZCfg.dexPathsDeps = append(artJZCfg.dexPathsDeps, frameworkJZCfg.dexPathsDeps...)
frameworkJZCfg.imageLocations = append(artJZCfg.imageLocations, frameworkJZCfg.imageLocations...)
return configs
}).(map[string]*bootImageConfig)
}
@@ -247,8 +263,12 @@ func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[frameworkBootImageName]
}
func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[apexBootImageName]
func artJZBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[artJZBootImageName]
}
func frameworkJZBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[frameworkJZBootImageName]
}
func defaultBootclasspath(ctx android.PathContext) []string {