summaryrefslogtreecommitdiff
path: root/android/override_module.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-10-05 15:25:09 -0700
committer Colin Cross <ccross@android.com> 2024-10-07 20:13:00 -0700
commitb8533a82cdbccb86e268bd3df9319f4cf6c9193b (patch)
tree39be5b15ffef558eaf0b3cbe882d594d7b467754 /android/override_module.go
parentb2388e3e3d67ab20292ada184bfbeb32d65d7d4c (diff)
Annotate mutators that use methods that prevent mutator coalescing
Mutator coalescing reduces the overhead of visiting every module for every mutator by calling a series of mutator methods on a a single module in a row. This is only valid for well-behaved mutators. Add methods on MutatorHandle that allow annotating mutators that are not well behaved, and use that to prevent coalescing mutators. Bug: 372076859 Test: all soong tests pass with race detector on Flag: EXEMPT refactor Change-Id: Id9b005f05227e5558cac6d488030a7398af13fb8
Diffstat (limited to 'android/override_module.go')
-rw-r--r--android/override_module.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/android/override_module.go b/android/override_module.go
index f69f96309..d844da616 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -234,8 +234,9 @@ func (b *OverridableModuleBase) OverridablePropertiesDepsMutator(ctx BottomUpMut
// Mutators for override/overridable modules. All the fun happens in these functions. It is critical
// to keep them in this order and not put any order mutators between them.
func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel()
+ ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel().MutatesDependencies() // modifies deps via addOverride
ctx.Transition("override", &overrideTransitionMutator{})
+ ctx.BottomUp("override_apply", overrideApplyMutator).Parallel().MutatesDependencies()
// overridableModuleDepsMutator calls OverridablePropertiesDepsMutator so that overridable modules can
// add deps from overridable properties.
ctx.BottomUp("overridable_deps", overridableModuleDepsMutator).Parallel()
@@ -243,8 +244,8 @@ func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) {
// prebuilt's ReplaceDependencies doesn't affect to those deps added by overridable properties.
// By running PrebuiltPostDepsMutator again after overridableModuleDepsMutator, deps via overridable properties
// can be replaced with prebuilts.
- ctx.BottomUp("replace_deps_on_prebuilts_for_overridable_deps_again", PrebuiltPostDepsMutator).Parallel()
- ctx.BottomUp("replace_deps_on_override", replaceDepsOnOverridingModuleMutator).Parallel()
+ ctx.BottomUp("replace_deps_on_prebuilts_for_overridable_deps_again", PrebuiltPostDepsMutator).Parallel().UsesReplaceDependencies()
+ ctx.BottomUp("replace_deps_on_override", replaceDepsOnOverridingModuleMutator).Parallel().UsesReplaceDependencies()
}
type overrideBaseDependencyTag struct {
@@ -330,6 +331,9 @@ func (overrideTransitionMutator) IncomingTransition(ctx IncomingTransitionContex
}
func (overrideTransitionMutator) Mutate(ctx BottomUpMutatorContext, variation string) {
+}
+
+func overrideApplyMutator(ctx BottomUpMutatorContext) {
if o, ok := ctx.Module().(OverrideModule); ok {
overridableDeps := ctx.GetDirectDepsWithTag(overrideBaseDepTag)
if len(overridableDeps) > 1 {