From c2b90d235fb5dd721898d8d41d73a51607654890 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Fri, 30 Aug 2024 19:01:30 +0200 Subject: [PATCH] libstore: don't ContinueImmediately where we can tail call there's no reason to go through the event loop in these cases. returning ContinueImmediately here is just a very convoluted way of jumping to the state we've just set after unwinding one frame of the stack, which never matters in the cases changed here because there are no live RAII guards. Change-Id: I7c00948c22e3caf35e934c1a14ffd2d40efc5547 --- src/libstore/build/derivation-goal.cc | 4 ++-- src/libstore/build/substitution-goal.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index a75a674d1..1dda1b1b4 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -649,7 +649,7 @@ Goal::WorkResult DerivationGoal::inputsRealised(bool inBuildSlot) slot to become available, since we don't need one if there is a build hook. */ state = &DerivationGoal::tryToBuild; - return ContinueImmediately{}; + return tryToBuild(inBuildSlot); } void DerivationGoal::started() @@ -772,7 +772,7 @@ Goal::WorkResult DerivationGoal::tryToBuild(bool inBuildSlot) actLock.reset(); state = &DerivationGoal::tryLocalBuild; - return ContinueImmediately{}; + return tryLocalBuild(inBuildSlot); } Goal::WorkResult DerivationGoal::tryLocalBuild(bool inBuildSlot) { diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc index 673b3c503..1d24938e5 100644 --- a/src/libstore/build/substitution-goal.cc +++ b/src/libstore/build/substitution-goal.cc @@ -188,7 +188,7 @@ Goal::WorkResult PathSubstitutionGoal::referencesValid(bool inBuildSlot) assert(worker.store.isValidPath(i)); state = &PathSubstitutionGoal::tryToRun; - return ContinueImmediately{}; + return tryToRun(inBuildSlot); } @@ -256,7 +256,7 @@ Goal::WorkResult PathSubstitutionGoal::finished(bool inBuildSlot) /* Try the next substitute. */ state = &PathSubstitutionGoal::tryNext; - return ContinueImmediately{}; + return tryNext(inBuildSlot); } worker.markContentsGood(storePath);