aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-07-29 00:01:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-07-29 00:01:09 +0000
commitdce396a70f230773bfec7edd0471d91c2814fdd9 (patch)
treefa12f4099472bec494e601c66881d09e4c949ae1
parent1d9689b3e76a694a8e415c76544ea93943af8274 (diff)
parenta61acf62c95adba6b6aeea6fdb4d24fe8ba5fb1a (diff)
downloadbuild-dce396a70f230773bfec7edd0471d91c2814fdd9.tar.gz
Merge changes Ic89cc4c0,I189cd144,Id51726ae,I8b777c88,Ia4573464, ...
* changes: Add support for using profiles for boot images Add PRODUCT_SYSTEM_SERVER_DEBUG_INFO property Add product system server compiler filter property Allow custom compiler filters for system server jars Install preopted profiles on device Default profile usage based on the existence of the profile Use speed-profile instead of quicken for the profile case
-rw-r--r--core/dex_preopt_libart.mk36
-rw-r--r--core/dex_preopt_libart_boot.mk17
-rw-r--r--core/dex_preopt_odex_install.mk87
-rw-r--r--core/main.mk5
-rw-r--r--core/product.mk5
-rw-r--r--core/product_config.mk14
6 files changed, 144 insertions, 20 deletions
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 9db5dbfb47..47fdba610d 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -88,6 +88,42 @@ LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call
LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).oat boot-$(jar).vdex)
LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat boot.vdex
+# If we use a boot image profile.
+my_use_profile_for_boot_image := $(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE)
+ifeq (,$(my_use_profile_for_boot_image))
+# If not set, use the default.
+my_use_profile_for_boot_image := false
+endif
+
+ifeq (true,$(my_use_profile_for_boot_image))
+
+# Location of text based profile for the boot image.
+my_boot_image_profile_location := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)
+ifeq (,$(my_boot_image_profile_location))
+# If not set, use the default.
+my_boot_image_profile_location := frameworks/base/boot-image-profile.txt
+endif
+
+# Code to create the boot image profile, not in dex_preopt_libart_boot.mk since the profile is the same for all archs.
+my_out_boot_image_profile_location := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.prof
+$(my_out_boot_image_profile_location): PRIVATE_PROFILE_INPUT_LOCATION := $(my_boot_image_profile_location)
+$(my_out_boot_image_profile_location): $(PROFMAN) $(LIBART_TARGET_BOOT_DEX_FILES) $(my_boot_image_profile_location)
+ @echo "target profman: $@"
+ @mkdir -p $(dir $@)
+ ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
+ --create-profile-from=$(PRIVATE_PROFILE_INPUT_LOCATION) \
+ $(addprefix --apk=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
+ $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
+ --reference-profile-file=$@
+
+# We want to install the profile even if we are not using preopt since it is required to generate
+# the image on the device.
+my_installed_profile := $(TARGET_OUT)/etc/boot-image.prof
+$(eval $(call copy-one-file,$(my_out_boot_image_profile_location),$(my_installed_profile)))
+ALL_DEFAULT_INSTALLED_MODULES += $(my_installed_profile)
+
+endif
+
my_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 860a66adb9..6e49f64acf 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -50,18 +50,27 @@ $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES) : $($(my_2n
@mkdir -p $(dir $@)
$(hide) $(ACP) -fp $(dir $<)$(notdir $@) $@
+ifeq (,$(my_out_boot_image_profile_location))
+my_boot_image_flags := $(COMPILED_CLASSES_FLAGS)
+my_boot_image_flags += --image-classes=$(PRELOADED_CLASSES)
+else
+my_boot_image_flags := --compiler-filter=speed-profile
+my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location)
+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_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(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))
@rm -f $(dir $@)/*.art $(dir $@)/*.oat
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat
- $(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
+ $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
- --image-classes=$(PRELOADED_CLASSES) \
+ $(PRIVATE_BOOT_IMAGE_FLAGS) \
$(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
$(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
--oat-symbols=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \
@@ -75,4 +84,4 @@ $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGE
--runtime-arg -Xnorelocate --compile-pic \
--no-generate-debug-info --generate-build-id \
--multi-image --no-inline-from=core-oj.jar \
- $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(COMPILED_CLASSES_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
+ $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index b9c0fc60b1..136def470a 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -59,6 +59,31 @@ built_installed_vdex :=
built_installed_art :=
ifdef LOCAL_DEX_PREOPT
+
+ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
+LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
+endif
+
+ifdef LOCAL_VENDOR_MODULE
+ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
+$(error profiles are not supported for vendor modules)
+endif
+else
+ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
+# If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
+# profile class listing. TODO: Use product specific directory here.
+my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
+LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING := $(my_classes_directory)/$(LOCAL_MODULE).prof.txt
+ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)))
+# Profile listing exists, use it to generate the profile.
+ifeq ($(LOCAL_DEX_PREOPT_APP_IMAGE),)
+LOCAL_DEX_PREOPT_APP_IMAGE := true
+endif
+LOCAL_DEX_PREOPT_GENERATE_PROFILE := true
+endif
+endif
+endif
+
dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
ifdef dexpreopt_boot_jar_module
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
@@ -113,13 +138,6 @@ installed_vdex := $(strip $(installed_vdex))
installed_art := $(strip $(installed_art))
ifdef built_odex
-
-ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
-ifeq (true,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
- LOCAL_DEX_PREOPT_GENERATE_PROFILE := true
-endif
-endif
-
ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
ifndef LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING
$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING))
@@ -141,7 +159,12 @@ $(my_built_profile):
--apk=$(PRIVATE_BUILT_MODULE) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
--reference-profile-file=$@
+my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
+$(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
+build_installed_profile:=$(my_built_profile):$(my_installed_profile)
else
+build_installed_profile:=
+my_installed_profile :=
$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
endif
@@ -152,14 +175,44 @@ LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
endif
endif
-ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
- # Jars of system server, apps loaded into system server, and apps the product wants to be
- # compiled with the 'speed' compiler filter.
- LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
-else
- # If no compiler filter is specified, default to 'quicken' to save on storage.
- ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
- LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken
+my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
+ifeq (,$(my_system_server_compiler_filter))
+my_system_server_compiler_filter := speed
+endif
+
+ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
+ ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
+ # Jars of system server, use the product option if it is set, speed otherwise.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter)
+ else
+ ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
+ # Apps loaded into system server, and apps the product default to being compiled with the
+ # 'speed' compiler filter.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
+ else
+ ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
+ # For non system server jars, use speed-profile when we have a profile.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
+ else
+ # If no compiler filter is specified, default to 'quicken' to save on storage.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken
+ endif
+ endif
+ endif
+endif
+
+# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
+my_system_server_debug_info := $(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)
+ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
+# Only enable for non-eng builds.
+ifeq (,$(my_system_server_debug_info))
+my_system_server_debug_info := true
+endif
+endif
+
+ifeq (true, $(my_system_server_debug_info))
+ ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
+ LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
endif
endif
@@ -172,9 +225,11 @@ endif
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
+ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
+ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
# Record dex-preopt config.
DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
@@ -190,6 +245,6 @@ DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
# Make sure to install the .odex and .vdex when you run "make <module_name>"
-$(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
+$(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art) $(my_installed_profile)
endif # LOCAL_DEX_PREOPT
diff --git a/core/main.mk b/core/main.mk
index d14d64baeb..3161cc7d7e 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -214,6 +214,11 @@ ifdef TARGET_2ND_ARCH
endif
endif
+# Add the system server compiler filter if they are specified for the product.
+ifneq (,$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
+ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.systemservercompilerfilter=$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
+endif
+
## user/userdebug ##
user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
diff --git a/core/product.mk b/core/product.mk
index c5ddf817a2..6722526c80 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -120,9 +120,14 @@ _product_var_list := \
PRODUCT_VERITY_SIGNING_KEY \
PRODUCT_SYSTEM_VERITY_PARTITION \
PRODUCT_VENDOR_VERITY_PARTITION \
+ PRODUCT_SYSTEM_SERVER_DEBUG_INFO \
PRODUCT_DEX_PREOPT_MODULE_CONFIGS \
PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \
PRODUCT_DEX_PREOPT_BOOT_FLAGS \
+ PRODUCT_DEX_PREOPT_PROFILE_DIR \
+ PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION \
+ PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \
+ PRODUCT_SYSTEM_SERVER_COMPILER_FILTER \
PRODUCT_SANITIZER_MODULE_CONFIGS \
PRODUCT_SYSTEM_BASE_FS_PATH \
PRODUCT_VENDOR_BASE_FS_PATH \
diff --git a/core/product_config.mk b/core/product_config.mk
index 36f473ff04..6812b05d48 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -380,6 +380,20 @@ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_DEFAULT_FLAGS))
PRODUCT_DEX_PREOPT_BOOT_FLAGS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_FLAGS))
+PRODUCT_DEX_PREOPT_PROFILE_DIR := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_PROFILE_DIR))
+
+# Boot image options.
+PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE))
+PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION))
+
+PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
+PRODUCT_SYSTEM_SERVER_DEBUG_INFO := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
+
# Resolve and setup per-module dex-preopt configs.
PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_MODULE_CONFIGS))