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
This commit is contained in:
eldritch horrors 2024-08-30 19:01:30 +02:00
parent e55ec75619
commit c2b90d235f
2 changed files with 4 additions and 4 deletions

View file

@ -649,7 +649,7 @@ Goal::WorkResult DerivationGoal::inputsRealised(bool inBuildSlot)
slot to become available, since we don't need one if there is a slot to become available, since we don't need one if there is a
build hook. */ build hook. */
state = &DerivationGoal::tryToBuild; state = &DerivationGoal::tryToBuild;
return ContinueImmediately{}; return tryToBuild(inBuildSlot);
} }
void DerivationGoal::started() void DerivationGoal::started()
@ -772,7 +772,7 @@ Goal::WorkResult DerivationGoal::tryToBuild(bool inBuildSlot)
actLock.reset(); actLock.reset();
state = &DerivationGoal::tryLocalBuild; state = &DerivationGoal::tryLocalBuild;
return ContinueImmediately{}; return tryLocalBuild(inBuildSlot);
} }
Goal::WorkResult DerivationGoal::tryLocalBuild(bool inBuildSlot) { Goal::WorkResult DerivationGoal::tryLocalBuild(bool inBuildSlot) {

View file

@ -188,7 +188,7 @@ Goal::WorkResult PathSubstitutionGoal::referencesValid(bool inBuildSlot)
assert(worker.store.isValidPath(i)); assert(worker.store.isValidPath(i));
state = &PathSubstitutionGoal::tryToRun; state = &PathSubstitutionGoal::tryToRun;
return ContinueImmediately{}; return tryToRun(inBuildSlot);
} }
@ -256,7 +256,7 @@ Goal::WorkResult PathSubstitutionGoal::finished(bool inBuildSlot)
/* Try the next substitute. */ /* Try the next substitute. */
state = &PathSubstitutionGoal::tryNext; state = &PathSubstitutionGoal::tryNext;
return ContinueImmediately{}; return tryNext(inBuildSlot);
} }
worker.markContentsGood(storePath); worker.markContentsGood(storePath);