Merge changes Ieb738670,I2e2f9da1,I13c6b389

* changes:
  Pass --dex-location when processing prebuilt profiles
  Fix speed-profile compilation for prebuilds
  Update profile rules to support binary profiles
This commit is contained in:
Calin Juravle 2018-04-30 21:13:33 +00:00 committed by Gerrit Code Review
commit 12f1850261

View file

@ -91,23 +91,32 @@ installed_art :=
built_installed_odex :=
built_installed_vdex :=
built_installed_art :=
my_process_profile :=
my_profile_is_text_listing :=
ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
endif
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.
LOCAL_DEX_PREOPT_GENERATE_PROFILE := true
LOCAL_DEX_PREOPT_PROFILE := $(my_classes_directory)/$(LOCAL_MODULE).prof
ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE)))
my_process_profile := true
my_profile_is_text_listing := false
endif
else
my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE)
my_profile_is_text_listing := true
LOCAL_DEX_PREOPT_PROFILE := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
endif
ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
ifeq (true,$(my_process_profile))
ifdef LOCAL_VENDOR_MODULE
$(call pretty-error, Internal error: profiles are not supported for vendor modules)
@ -117,8 +126,8 @@ LOCAL_DEX_PREOPT_APP_IMAGE := true
endif
endif
ifndef LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING
$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING))
ifndef LOCAL_DEX_PREOPT_PROFILE
$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE))
endif
ifeq (,$(dex_preopt_profile_src_file))
$(call pretty-error, Internal error: dex_preopt_profile_src_file must be set)
@ -129,18 +138,36 @@ my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
my_dex_location := $(patsubst %.gz,%,$(my_dex_location))
$(my_built_profile): PRIVATE_BUILT_MODULE := $(dex_preopt_profile_src_file)
$(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
$(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
$(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
$(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE)
$(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE)
$(my_built_profile): $(PROFMAN)
$(my_built_profile): $(dex_preopt_profile_src_file)
$(my_built_profile):
ifeq (true,$(my_profile_is_text_listing))
# The profile is a test listing of classes (used for framework jars).
# We need to generate the actual binary profile before being able to compile.
$(hide) mkdir -p $(dir $@)
ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
--create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
--apk=$(PRIVATE_BUILT_MODULE) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
--reference-profile-file=$@
dex_preopt_profile_src_file:=
else
# The profile is binary profile (used for apps). Run it through profman to
# ensure the profile keys match the apk.
$(my_built_profile):
$(hide) mkdir -p $(dir $@)
touch $@
ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
--copy-and-update-profile-key \
--profile-file=$(PRIVATE_SOURCE_CLASSES) \
--apk=$(PRIVATE_BUILT_MODULE) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
--reference-profile-file=$@ \
|| echo "Profile out of date for $(PRIVATE_BUILT_MODULE)"
endif
my_profile_is_text_listing :=
dex_preopt_profile_src_file :=
# Remove compressed APK extension.
my_installed_profile := $(patsubst %.gz,%,$(LOCAL_INSTALLED_MODULE)).prof
@ -209,7 +236,7 @@ installed_vdex := $(strip $(installed_vdex))
installed_art := $(strip $(installed_art))
ifdef built_odex
ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
ifeq (true,$(my_process_profile))
$(built_odex): $(my_built_profile)
$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
else
@ -244,7 +271,7 @@ ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
# 'speed' compiler filter.
LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
else
ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
ifeq (true,$(my_process_profile))
# For non system server jars, use speed-profile when we have a profile.
LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
else
@ -364,4 +391,6 @@ endif # LOCAL_DEX_PREOPT
ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
my_process_profile :=
$(my_all_targets): $(my_installed_profile)