summaryrefslogtreecommitdiff
path: root/build/art.go
diff options
context:
space:
mode:
author Lokesh Gidra <lokeshgidra@google.com> 2022-04-20 01:39:28 +0000
committer Lokesh Gidra <lokeshgidra@google.com> 2022-08-10 18:06:05 +0000
commitca5ed9f281a5758814d2495da80178de56945720 (patch)
tree3633a7ace321b10dd2ae6ffadd69d525c7a530e5 /build/art.go
parent1325bb173c3160b8ff2ecfc2d1aefd185c773ee4 (diff)
Convert kUseReadBarrier to static const from constexpr
This CL would compile both CC and userfaultfd GC in the art library, enabling us to choose either of the two during boot time depending on whether the device has userfaultfd kernel feature or not. The CC GC is still chosen unless we use ART_USE_READ_BARRIER=false during build time. This behavior will later be changed to choosing CC *only* if ART_USE_READ_BARRIER=true is used. In other cases, if the device has userfaultfd support then that GC will be chosen. Bug: 160737021 Bug: 230021033 Test: art/test/testrunner/testrunner.py Change-Id: I370f1a9f6b8cdff8c2ce3cf7aa936bccd7ed675f
Diffstat (limited to 'build/art.go')
-rw-r--r--build/art.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/build/art.go b/build/art.go
index c39b7e3f38..56df14239f 100644
--- a/build/art.go
+++ b/build/art.go
@@ -38,19 +38,13 @@ func globalFlags(ctx android.LoadHookContext) ([]string, []string) {
opt := ctx.Config().GetenvWithDefault("ART_NDEBUG_OPT_FLAG", "-O3")
cflags = append(cflags, opt)
- tlab := false
-
- gcType := ctx.Config().GetenvWithDefault("ART_DEFAULT_GC_TYPE", "CMS")
+ gcType := ctx.Config().GetenvWithDefault("ART_DEFAULT_GC_TYPE", "CMC")
if ctx.Config().IsEnvTrue("ART_TEST_DEBUG_GC") {
gcType = "SS"
- tlab = true
}
cflags = append(cflags, "-DART_DEFAULT_GC_TYPE_IS_"+gcType)
- if tlab {
- cflags = append(cflags, "-DART_USE_TLAB=1")
- }
if ctx.Config().IsEnvTrue("ART_HEAP_POISONING") {
cflags = append(cflags, "-DART_HEAP_POISONING=1")
@@ -70,11 +64,18 @@ func globalFlags(ctx android.LoadHookContext) ([]string, []string) {
asflags = append(asflags,
"-DART_USE_READ_BARRIER=1",
"-DART_READ_BARRIER_TYPE_IS_"+barrierType+"=1")
- }
- if !ctx.Config().IsEnvFalse("ART_USE_GENERATIONAL_CC") {
- cflags = append(cflags, "-DART_USE_GENERATIONAL_CC=1")
+ if !ctx.Config().IsEnvFalse("ART_USE_GENERATIONAL_CC") {
+ cflags = append(cflags, "-DART_USE_GENERATIONAL_CC=1")
+ }
+ // For now force CC as we don't want to make userfaultfd GC the default.
+ // Eventually, make it such that we force CC only if ART_USE_READ_BARRIER
+ // was set to true explicitly during build time.
+ cflags = append(cflags, "-DART_FORCE_USE_READ_BARRIER=1")
}
+ // The only GC which does not want ART_USE_TLAB set is CMS, which isn't actually used.
+ // When read-barrier is not set, we use userfaultfd GC.
+ cflags = append(cflags, "-DART_USE_TLAB=1")
cdexLevel := ctx.Config().GetenvWithDefault("ART_DEFAULT_COMPACT_DEX_LEVEL", "fast")
cflags = append(cflags, "-DART_DEFAULT_COMPACT_DEX_LEVEL="+cdexLevel)