Jiakai Zhang | d6c6e3a | 2022-11-16 11:52:00 +0000 | [diff] [blame^] | 1 | # 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 | |
| 14 | config_enable_uffd_gc := \ |
| 15 | $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC)) |
| 16 | |
| 17 | ifeq (,$(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 |
| 38 | else ifeq (true,$(config_enable_uffd_gc)) |
| 39 | ENABLE_UFFD_GC := true |
| 40 | else ifeq (false,$(config_enable_uffd_gc)) |
| 41 | ENABLE_UFFD_GC := false |
| 42 | else |
| 43 | $(error Unknown PRODUCT_ENABLE_UFFD_GC value: $(config_enable_uffd_gc)) |
| 44 | endif |
| 45 | |
| 46 | ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(ENABLE_UFFD_GC) |