From f10be65c39c18668df31c8680569a6417ef3ae06 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Feb 2018 08:29:30 +0200 Subject: Increment targe_count for inner operations only --- build2/algorithm.cxx | 1 + build2/algorithm.ixx | 15 ++++++++++----- 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 ()); 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; -- cgit v1.1