Add a new option compilerFilter
to bootImageConfig
.
After this change, the compiler filter can be specified by the option, and profiles will not be used if the compiler filter is not a profile-guided one. This change also allows preloadedClassesFile to be empty. Bug: 269230245 Test: m Change-Id: I65e6b7209d2f0510bcc784a62623ab402b7f96bb
This commit is contained in:
@@ -1291,7 +1291,7 @@ func (module *PrebuiltBootclasspathFragmentModule) produceBootImageFiles(ctx and
|
|||||||
}
|
}
|
||||||
return bootImageFiles
|
return bootImageFiles
|
||||||
} else {
|
} else {
|
||||||
if profile == nil {
|
if profile == nil && imageConfig.isProfileGuided() {
|
||||||
ctx.ModuleErrorf("Unable to produce boot image files: neither boot image files nor profiles exists in the prebuilt apex")
|
ctx.ModuleErrorf("Unable to produce boot image files: neither boot image files nor profiles exists in the prebuilt apex")
|
||||||
return bootImageOutputs{}
|
return bootImageOutputs{}
|
||||||
}
|
}
|
||||||
|
@@ -287,6 +287,9 @@ type bootImageConfig struct {
|
|||||||
|
|
||||||
// Path of the preloaded classes file.
|
// Path of the preloaded classes file.
|
||||||
preloadedClassesFile string
|
preloadedClassesFile string
|
||||||
|
|
||||||
|
// The "--compiler-filter" argument.
|
||||||
|
compilerFilter string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Target-dependent description of a boot image.
|
// Target-dependent description of a boot image.
|
||||||
@@ -443,6 +446,10 @@ func (image *bootImageVariant) imageLocations() (imageLocationsOnHost []string,
|
|||||||
append(imageLocationsOnDevice, dexpreopt.PathStringToLocation(image.imagePathOnDevice, image.target.Arch.ArchType))
|
append(imageLocationsOnDevice, dexpreopt.PathStringToLocation(image.imagePathOnDevice, image.target.Arch.ArchType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (image *bootImageConfig) isProfileGuided() bool {
|
||||||
|
return image.compilerFilter == "speed-profile"
|
||||||
|
}
|
||||||
|
|
||||||
func dexpreoptBootJarsFactory() android.SingletonModule {
|
func dexpreoptBootJarsFactory() android.SingletonModule {
|
||||||
m := &dexpreoptBootJars{}
|
m := &dexpreoptBootJars{}
|
||||||
android.InitAndroidModule(m)
|
android.InitAndroidModule(m)
|
||||||
@@ -721,11 +728,13 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p
|
|||||||
cmd.FlagWithArg("--base=", ctx.Config().LibartImgDeviceBaseAddress())
|
cmd.FlagWithArg("--base=", ctx.Config().LibartImgDeviceBaseAddress())
|
||||||
}
|
}
|
||||||
|
|
||||||
// We always expect a preloaded classes file to be available. However, if we cannot find it, it's
|
if len(image.preloadedClassesFile) > 0 {
|
||||||
// OK to not pass the flag to dex2oat.
|
// We always expect a preloaded classes file to be available. However, if we cannot find it, it's
|
||||||
preloadedClassesPath := android.ExistentPathForSource(ctx, image.preloadedClassesFile)
|
// OK to not pass the flag to dex2oat.
|
||||||
if preloadedClassesPath.Valid() {
|
preloadedClassesPath := android.ExistentPathForSource(ctx, image.preloadedClassesFile)
|
||||||
cmd.FlagWithInput("--preloaded-classes=", preloadedClassesPath.Path())
|
if preloadedClassesPath.Valid() {
|
||||||
|
cmd.FlagWithInput("--preloaded-classes=", preloadedClassesPath.Path())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.
|
cmd.
|
||||||
@@ -743,7 +752,8 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p
|
|||||||
FlagWithArg("--android-root=", global.EmptyDirectory).
|
FlagWithArg("--android-root=", global.EmptyDirectory).
|
||||||
FlagWithArg("--no-inline-from=", "core-oj.jar").
|
FlagWithArg("--no-inline-from=", "core-oj.jar").
|
||||||
Flag("--force-determinism").
|
Flag("--force-determinism").
|
||||||
Flag("--abort-on-hard-verifier-error")
|
Flag("--abort-on-hard-verifier-error").
|
||||||
|
FlagWithArg("--compiler-filter=", image.compilerFilter)
|
||||||
|
|
||||||
// Use the default variant/features for host builds.
|
// Use the default variant/features for host builds.
|
||||||
// The map below contains only device CPU info (which might be x86 on some devices).
|
// The map below contains only device CPU info (which might be x86 on some devices).
|
||||||
@@ -828,6 +838,10 @@ It is likely that the boot classpath is inconsistent.
|
|||||||
Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.`
|
Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.`
|
||||||
|
|
||||||
func bootImageProfileRule(ctx android.ModuleContext, image *bootImageConfig) android.WritablePath {
|
func bootImageProfileRule(ctx android.ModuleContext, image *bootImageConfig) android.WritablePath {
|
||||||
|
if !image.isProfileGuided() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
globalSoong := dexpreopt.GetGlobalSoongConfig(ctx)
|
globalSoong := dexpreopt.GetGlobalSoongConfig(ctx)
|
||||||
global := dexpreopt.GetGlobalConfig(ctx)
|
global := dexpreopt.GetGlobalConfig(ctx)
|
||||||
|
|
||||||
|
@@ -63,6 +63,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
|
|||||||
profileInstallPathInApex: "etc/boot-image.prof",
|
profileInstallPathInApex: "etc/boot-image.prof",
|
||||||
modules: artModules,
|
modules: artModules,
|
||||||
preloadedClassesFile: "art/build/boot/preloaded-classes",
|
preloadedClassesFile: "art/build/boot/preloaded-classes",
|
||||||
|
compilerFilter: "speed-profile",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Framework config for the boot image extension.
|
// Framework config for the boot image extension.
|
||||||
@@ -76,6 +77,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
|
|||||||
installDirOnDevice: frameworkSubdir,
|
installDirOnDevice: frameworkSubdir,
|
||||||
modules: frameworkModules,
|
modules: frameworkModules,
|
||||||
preloadedClassesFile: "frameworks/base/config/preloaded-classes",
|
preloadedClassesFile: "frameworks/base/config/preloaded-classes",
|
||||||
|
compilerFilter: "speed-profile",
|
||||||
}
|
}
|
||||||
|
|
||||||
return map[string]*bootImageConfig{
|
return map[string]*bootImageConfig{
|
||||||
|
Reference in New Issue
Block a user