blob: 1ea05db2c361cc2a8cf346a953079bc79b858b06 [file] [log] [blame]
Jiakai Zhangd6c6e3a2022-11-16 11:52:00 +00001# ART configuration that has to be determined after product config is resolved.
2#
3# Inputs:
4# PRODUCT_ENABLE_UFFD_GC: See comments in build/make/core/product.mk.
5# OVERRIDE_ENABLE_UFFD_GC: Overrides PRODUCT_ENABLE_UFFD_GC. Can be passed from the commandline for
6# debugging purposes.
7# BOARD_API_LEVEL: See comments in build/make/core/main.mk.
8# BOARD_SHIPPING_API_LEVEL: See comments in build/make/core/main.mk.
9# PRODUCT_SHIPPING_API_LEVEL: See comments in build/make/core/product.mk.
10#
11# Outputs:
12# ENABLE_UFFD_GC: Whether to use userfaultfd GC.
13
14config_enable_uffd_gc := \
15 $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC))
16
17ifeq (,$(filter-out default,$(config_enable_uffd_gc)))
18 ENABLE_UFFD_GC := true
19
20 # Disable userfaultfd GC if the device doesn't support it (i.e., if
21 # `min(ro.board.api_level ?? ro.board.first_api_level ?? MAX_VALUE,
22 # ro.product.first_api_level ?? ro.build.version.sdk ?? MAX_VALUE) < 31`)
23 # This logic aligns with how `ro.vendor.api_level` is calculated in
24 # `system/core/init/property_service.cpp`.
25 # We omit the check on `ro.build.version.sdk` here because we are on the latest build system.
26 board_api_level := $(firstword $(BOARD_API_LEVEL) $(BOARD_SHIPPING_API_LEVEL))
27 ifneq (,$(board_api_level))
28 ifeq (true,$(call math_lt,$(board_api_level),31))
29 ENABLE_UFFD_GC := false
30 endif
31 endif
32
33 ifneq (,$(PRODUCT_SHIPPING_API_LEVEL))
34 ifeq (true,$(call math_lt,$(PRODUCT_SHIPPING_API_LEVEL),31))
35 ENABLE_UFFD_GC := false
36 endif
37 endif
38else ifeq (true,$(config_enable_uffd_gc))
39 ENABLE_UFFD_GC := true
40else ifeq (false,$(config_enable_uffd_gc))
41 ENABLE_UFFD_GC := false
42else
43 $(error Unknown PRODUCT_ENABLE_UFFD_GC value: $(config_enable_uffd_gc))
44endif
45
46ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(ENABLE_UFFD_GC)