Pass "-Xgc:CMC" to dex2oat when userfaultfd GC is enabled.

This change is a no-op change. It doesn't enable userfaultfd GC by
default. ENABLE_UFFD_GC=true can be passed to the build system to enable
userfaultfd GC for testing purposes.

Bug: 242553398
Test: -
  1. lunch aosp_oriole-userdebug
  2. ENABLE_UFFD_GC=true m
  3. See "--runtime-arg -Xgc:CMC" in .invocation files.
Change-Id: I789b49a71b9604fd41bf1ef77d0ac5bac4cbdf25
This commit is contained in:
Jiakai Zhang
2022-11-16 11:50:59 +00:00
parent ed9729727c
commit 616be0695e
3 changed files with 10 additions and 0 deletions

View File

@@ -96,6 +96,8 @@ type GlobalConfig struct {
// quickly silence build errors. This flag should be used with caution and only as a temporary // quickly silence build errors. This flag should be used with caution and only as a temporary
// measure, as it masks real errors and affects performance. // measure, as it masks real errors and affects performance.
RelaxUsesLibraryCheck bool RelaxUsesLibraryCheck bool
EnableUffdGc bool // preopt with the assumption that userfaultfd GC will be used on device.
} }
var allPlatformSystemServerJarsKey = android.NewOnceKey("allPlatformSystemServerJars") var allPlatformSystemServerJarsKey = android.NewOnceKey("allPlatformSystemServerJars")

View File

@@ -495,6 +495,10 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g
cmd.FlagWithInput("--profile-file=", profile) cmd.FlagWithInput("--profile-file=", profile)
} }
if global.EnableUffdGc {
cmd.Flag("--runtime-arg").Flag("-Xgc:CMC")
}
rule.Install(odexPath, odexInstallPath) rule.Install(odexPath, odexInstallPath)
rule.Install(vdexPath, vdexInstallPath) rule.Install(vdexPath, vdexInstallPath)
} }

View File

@@ -752,6 +752,10 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p
cmd.FlagWithArg("--instruction-set-features=", global.InstructionSetFeatures[arch]) cmd.FlagWithArg("--instruction-set-features=", global.InstructionSetFeatures[arch])
} }
if global.EnableUffdGc {
cmd.Flag("--runtime-arg").Flag("-Xgc:CMC")
}
if global.BootFlags != "" { if global.BootFlags != "" {
cmd.Flag(global.BootFlags) cmd.Flag(global.BootFlags)
} }