More performance improvements

Instead of using `x := $(x) foo`, make sure `x` is initialized first,
then use `x += foo`.

For a aosp-master/aosp_crosshatch-userdebug build, this takes the build
from 49s to 33s (no significant difference in peak memory)

Bug: 158488548
Test: build-aosp_crosshatch.ninja is the same before/after
Change-Id: I41fb7611030dd3ba824f896a9c9eadbdd218f464
Merged-In: I41fb7611030dd3ba824f896a9c9eadbdd218f464
(cherry picked from commit fd1e67b8ce)
This commit is contained in:
Dan Willemsen 2020-06-08 18:50:14 -07:00
parent e88ef9299a
commit 74a1a483fc
8 changed files with 17 additions and 8 deletions

View file

@ -1816,7 +1816,7 @@ export_include_deps += $(strip \
$(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
ifneq ($(strip $(my_export_c_include_dirs)$(export_include_deps)),)
EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
EXPORTS_LIST += $(intermediates)
EXPORTS.$(intermediates).FLAGS := $(foreach d,$(my_export_c_include_dirs),-I $(call clean-path,$(d)))
EXPORTS.$(intermediates).REEXPORT := $(export_include_deps)
EXPORTS.$(intermediates).DEPS := $(my_export_c_include_deps) $(my_generated_sources) $(LOCAL_EXPORT_C_INCLUDE_DEPS)

View file

@ -75,7 +75,7 @@ else # my_strip_module not true
built_module := $(LOCAL_BUILT_MODULE)
ifdef prebuilt_module_is_a_library
EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
EXPORTS_LIST += $(intermediates)
EXPORTS.$(intermediates).FLAGS := $(foreach d,$(LOCAL_EXPORT_C_INCLUDE_DIRS),-I $(d))
EXPORTS.$(intermediates).DEPS := $(LOCAL_EXPORT_C_INCLUDE_DEPS)

View file

@ -111,6 +111,15 @@ ALL_DISABLED_PRESUBMIT_TESTS :=
# All compatibility suites mentioned in LOCAL_COMPATIBILITY_SUITES
ALL_COMPATIBILITY_SUITES :=
# All LINK_TYPE entries
ALL_LINK_TYPES :=
# All exported/imported include entries
EXPORTS_LIST :=
# All modules already converted to Soong
SOONG_ALREADY_CONV :=
###########################################################
## Debugging; prints a variable list to stdout
###########################################################

View file

@ -12,7 +12,7 @@
my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross))$(if $(filter AUX,$(my_kind)),-$(AUX_OS_VARIANT)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_))
link_type := $(my_link_prefix):$(LOCAL_MODULE_CLASS):$(LOCAL_MODULE)
ALL_LINK_TYPES := $(ALL_LINK_TYPES) $(link_type)
ALL_LINK_TYPES += $(link_type)
$(link_type).TYPE := $(my_link_type)
$(link_type).MAKEFILE := $(LOCAL_MODULE_MAKEFILE)
$(link_type).WARN := $(my_warn_types)

View file

@ -31,4 +31,4 @@ LOCAL_POST_INSTALL_CMD := unzip -qo -j -d $(dir $(LOCAL_INSTALLED_MODULE)) \
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
SOONG_ALREADY_CONV += $(LOCAL_MODULE)

View file

@ -218,4 +218,4 @@ ifdef LOCAL_PREBUILT_COVERAGE_ARCHIVE
$(LOCAL_INSTALLED_MODULE): $(my_coverage_files)
endif
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
SOONG_ALREADY_CONV += $(LOCAL_MODULE)

View file

@ -51,7 +51,7 @@ include $(BUILD_SYSTEM)/base_rules.mk
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
# Soong module is a static or shared library
EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
EXPORTS_LIST += $(intermediates)
EXPORTS.$(intermediates).FLAGS := $(LOCAL_EXPORT_CFLAGS)
EXPORTS.$(intermediates).DEPS := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
@ -61,7 +61,7 @@ ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODUL
$(my_all_targets): $(LOCAL_BUILT_MODULE).toc
endif
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
SOONG_ALREADY_CONV += $(LOCAL_MODULE)
my_link_type := $(LOCAL_SOONG_LINK_TYPE)
my_warn_types :=

View file

@ -172,4 +172,4 @@ $(my_exported_sdk_libs_file):
$(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
$(hide) touch $@)
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
SOONG_ALREADY_CONV += $(LOCAL_MODULE)