diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 0f2bb866b..aa11d1587 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -25,6 +25,10 @@ PRELOADED_CLASSES := $(call word-colon,1,$(firstword \ COMPILED_CLASSES := $(call word-colon,1,$(firstword \ $(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES)))) +# Use the first dirty-image-objects file in PRODUCT_COPY_FILES. +DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \ + $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES)))) + define get-product-default-property $(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)))) endef diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk index 6e49f64ac..d7281185b 100644 --- a/core/dex_preopt_libart_boot.mk +++ b/core/dex_preopt_libart_boot.mk @@ -37,6 +37,12 @@ ifneq ($(COMPILED_CLASSES),) COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES) endif +# If we have a dirty-image-objects file, create a parameter. +DIRTY_IMAGE_OBJECTS_FLAGS := +ifneq ($(DIRTY_IMAGE_OBJECTS),) + DIRTY_IMAGE_OBJECTS_FLAGS := --dirty-image-objects=$(DIRTY_IMAGE_OBJECTS) +endif + # The rule to install boot.art # Depends on installed boot.oat, boot-*.art, boot-*.oat $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES) @@ -53,6 +59,7 @@ $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES) : $($(my_2n ifeq (,$(my_out_boot_image_profile_location)) my_boot_image_flags := $(COMPILED_CLASSES_FLAGS) my_boot_image_flags += --image-classes=$(PRELOADED_CLASSES) +my_boot_image_flags += $(DIRTY_IMAGE_OBJECTS_FLAGS) else my_boot_image_flags := --compiler-filter=speed-profile my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location) @@ -61,7 +68,7 @@ endif $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags) $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix) # Use dex2oat debug version for better error reporting -$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DEX2OAT_DEPENDENCY) $(my_out_profile_location) +$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_profile_location) @echo "target dex2oat: $@" @mkdir -p $(dir $@) @mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) diff --git a/target/product/base.mk b/target/product/base.mk index 392f432ff..5c6efd471 100644 --- a/target/product/base.mk +++ b/target/product/base.mk @@ -159,5 +159,9 @@ PRODUCT_COPY_FILES := $(call add-to-product-copy-files-if-exists,\ PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ frameworks/base/compiled-classes:system/etc/compiled-classes) +# Note: it is acceptable to not have a dirty-image-objects file. In that case, the special bin +# for known dirty objects in the image will be empty. +PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ + frameworks/base/dirty-image-objects:system/etc/dirty-image-objects) $(call inherit-product, $(SRC_TARGET_DIR)/product/embedded.mk) diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk index c93925302..6b3766b97 100644 --- a/target/product/core_minimal.mk +++ b/target/product/core_minimal.mk @@ -145,6 +145,10 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ frameworks/base/compiled-classes-phone:system/etc/compiled-classes) +# Enable dirty image object binning to reduce dirty pages in the image. +PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ + frameworks/base/dirty-image-objects-phone:system/etc/dirty-image-objects) + # On userdebug builds, collect more tombstones by default. ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \