Merge "Use boot image extension in the JIT-zygote experiment."

This commit is contained in:
Ulyana Trafimovich
2020-01-13 10:38:01 +00:00
committed by Gerrit Code Review
3 changed files with 41 additions and 24 deletions

View File

@@ -106,9 +106,8 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
global := dexpreoptGlobalConfig(ctx) global := dexpreoptGlobalConfig(ctx)
bootImage := defaultBootImageConfig(ctx) bootImage := defaultBootImageConfig(ctx)
defaultBootImage := bootImage
if global.UseApexImage { if global.UseApexImage {
bootImage = apexBootImageConfig(ctx) bootImage = frameworkJZBootImageConfig(ctx)
} }
var archs []android.ArchType var archs []android.ArchType
@@ -179,11 +178,8 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
DexPreoptImagesDeps: imagesDeps, DexPreoptImagesDeps: imagesDeps,
DexPreoptImageLocations: bootImage.imageLocations, DexPreoptImageLocations: bootImage.imageLocations,
// We use the dex paths and dex locations of the default boot image, as it PreoptBootClassPathDexFiles: bootImage.dexPathsDeps.Paths(),
// contains the full dexpreopt boot classpath. Other images may just contain a subset of PreoptBootClassPathDexLocations: bootImage.dexLocationsDeps,
// the dexpreopt boot classpath.
PreoptBootClassPathDexFiles: defaultBootImage.dexPathsDeps.Paths(),
PreoptBootClassPathDexLocations: defaultBootImage.dexLocationsDeps,
PreoptExtractedApk: false, PreoptExtractedApk: false,

View File

@@ -220,7 +220,8 @@ func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) {
d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx))) d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
if global.GenerateApexImage { if global.GenerateApexImage {
// Create boot images for the JIT-zygote experiment. // Create boot images for the JIT-zygote experiment.
d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx))) d.otherImages = append(d.otherImages, buildBootImage(ctx, artJZBootImageConfig(ctx)))
d.otherImages = append(d.otherImages, buildBootImage(ctx, frameworkJZBootImageConfig(ctx)))
} }
dumpOatRules(ctx, d.defaultBootImage) dumpOatRules(ctx, d.defaultBootImage)

View File

@@ -125,7 +125,8 @@ var (
bootImageConfigKey = android.NewOnceKey("bootImageConfig") bootImageConfigKey = android.NewOnceKey("bootImageConfig")
artBootImageName = "art" artBootImageName = "art"
frameworkBootImageName = "boot" frameworkBootImageName = "boot"
apexBootImageName = "apex" artJZBootImageName = "jitzygote-art"
frameworkJZBootImageName = "jitzygote-boot"
) )
// Construct the global boot image configs. // Construct the global boot image configs.
@@ -179,22 +180,33 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
dexLocationsDeps: append(artLocations, frameworkLocations...), dexLocationsDeps: append(artLocations, frameworkLocations...),
} }
// Apex config for the boot image used in the JIT-zygote experiment. // ART config for JIT-zygote boot image.
// It includes both the Core libraries and framework. artJZCfg := bootImageConfig{
apexCfg := bootImageConfig{
extension: false, 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", stem: "apex",
installSubdir: frameworkSubdir, installSubdir: frameworkSubdir,
modules: concat(artModules, frameworkModules), modules: frameworkModules,
dexLocations: concat(artLocations, frameworkLocations), dexLocations: frameworkLocations,
dexLocationsDeps: concat(artLocations, frameworkLocations), dexLocationsDeps: append(artLocations, frameworkLocations...),
} }
configs := map[string]*bootImageConfig{ configs := map[string]*bootImageConfig{
artBootImageName: &artCfg, artBootImageName: &artCfg,
frameworkBootImageName: &frameworkCfg, frameworkBootImageName: &frameworkCfg,
apexBootImageName: &apexCfg, artJZBootImageName: &artJZCfg,
frameworkJZBootImageName: &frameworkJZCfg,
} }
// common to all configs // common to all configs
@@ -236,6 +248,10 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...) frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...)
frameworkCfg.imageLocations = append(artCfg.imageLocations, frameworkCfg.imageLocations...) 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 return configs
}).(map[string]*bootImageConfig) }).(map[string]*bootImageConfig)
} }
@@ -248,8 +264,12 @@ func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[frameworkBootImageName] return *genBootImageConfigs(ctx)[frameworkBootImageName]
} }
func apexBootImageConfig(ctx android.PathContext) bootImageConfig { func artJZBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[apexBootImageName] return *genBootImageConfigs(ctx)[artJZBootImageName]
}
func frameworkJZBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[frameworkJZBootImageName]
} }
func defaultBootclasspath(ctx android.PathContext) []string { func defaultBootclasspath(ctx android.PathContext) []string {