diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-06 08:29:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-06 08:29:30 +0200 |
commit | f10be65c39c18668df31c8680569a6417ef3ae06 (patch) | |
tree | 11d0f2887d1dd3b3b35f039f4b7bd39835dcaba5 | |
parent | 1d738c03d8cd7eae151f9e4ba4fded986373e6bb (diff) |
Increment targe_count for inner operations only
-rw-r--r-- | build2/algorithm.cxx | 1 | ||||
-rw-r--r-- | build2/algorithm.ixx | 15 | ||||
-rw-r--r-- | build2/context.hxx | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 0e57c08..4e76e4a 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -879,6 +879,7 @@ namespace build2 // Decrement the target count (see set_recipe() for details). // + if (a.inner ()) { recipe_function** f (s.recipe.target<recipe_function*> ()); if (f == nullptr || *f != &group_action) diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index 9baa650..7cad7ff 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -306,13 +306,18 @@ namespace build2 // (which are not executed). Plus, group action means real recipe is in // the group so this also feels right conceptually. // - // Note that we will increment this count twice for the same target if - // we have non-noop recipes for both inner and outer operations. While - // not ideal, the alternative (trying to "merge" the count keeping track + // We also avoid increment this count twice for the same target if we + // have both the inner and outer operations. In our model the outer + // operation is either noop or it must delegate to the inner. While it's + // possible the inner is noop while the outer is not, it is not very + // likely. The alternative (trying to "merge" the count keeping track of // whether inner and/or outer is noop) gets hairy rather quickly. // - if (f == nullptr || *f != &group_action) - target_count.fetch_add (1, memory_order_relaxed); + if (l.action.inner ()) + { + if (f == nullptr || *f != &group_action) + target_count.fetch_add (1, memory_order_relaxed); + } } } diff --git a/build2/context.hxx b/build2/context.hxx index 71035ad..97ba285 100644 --- a/build2/context.hxx +++ b/build2/context.hxx @@ -305,7 +305,7 @@ namespace build2 // // The target count is incremented after a non-noop recipe is matched and // decremented after such recipe has been executed. If such a recipe has - // skipped updating the target, then it should increment the skip count. + // skipped executing the operation, then it should increment the skip count. // These two counters are used for progress monitoring and diagnostics. // extern atomic_count dependency_count; |