forked from lix-project/lix
* Removed nrWaitees field. It was redundant with waitees.size() and
could get out of sync if multiple input derivations mapped to the same closure expression (since waitees is a set).
This commit is contained in:
parent
eb233e728f
commit
fe122c5a15
|
@ -53,10 +53,7 @@ protected:
|
||||||
here to prevent cycles. */
|
here to prevent cycles. */
|
||||||
WeakGoals waiters;
|
WeakGoals waiters;
|
||||||
|
|
||||||
/* Number of goals we are waiting for. */
|
/* Number of goals we are/were waiting for that have failed. */
|
||||||
unsigned int nrWaitees;
|
|
||||||
|
|
||||||
/* Number of goals we were waiting for that have failed. */
|
|
||||||
unsigned int nrFailed;
|
unsigned int nrFailed;
|
||||||
|
|
||||||
/* Whether amDone() has been called. */
|
/* Whether amDone() has been called. */
|
||||||
|
@ -66,6 +63,7 @@ protected:
|
||||||
Goal(Worker & _worker) : worker(_worker)
|
Goal(Worker & _worker) : worker(_worker)
|
||||||
{
|
{
|
||||||
done = false;
|
done = false;
|
||||||
|
nrFailed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Goal()
|
virtual ~Goal()
|
||||||
|
@ -73,12 +71,6 @@ protected:
|
||||||
printMsg(lvlVomit, "goal destroyed");
|
printMsg(lvlVomit, "goal destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetWaitees(int nrWaitees)
|
|
||||||
{
|
|
||||||
this->nrWaitees = nrWaitees;
|
|
||||||
nrFailed = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void work() = 0;
|
virtual void work() = 0;
|
||||||
|
|
||||||
|
@ -210,8 +202,7 @@ void Goal::waiteeDone(GoalPtr waitee, bool success)
|
||||||
|
|
||||||
if (!success) ++nrFailed;
|
if (!success) ++nrFailed;
|
||||||
|
|
||||||
assert(nrWaitees > 0);
|
if (waitees.empty() || (!success && !keepGoing)) {
|
||||||
if (!--nrWaitees || (!success && !keepGoing)) {
|
|
||||||
|
|
||||||
/* If we failed and keepGoing is not set, we remove all
|
/* If we failed and keepGoing is not set, we remove all
|
||||||
remaining waitees. */
|
remaining waitees. */
|
||||||
|
@ -453,7 +444,6 @@ void NormalisationGoal::init()
|
||||||
/* The first thing to do is to make sure that the store expression
|
/* The first thing to do is to make sure that the store expression
|
||||||
exists. If it doesn't, it may be created through a
|
exists. If it doesn't, it may be created through a
|
||||||
substitute. */
|
substitute. */
|
||||||
resetWaitees(1);
|
|
||||||
addWaitee(worker.makeSubstitutionGoal(nePath));
|
addWaitee(worker.makeSubstitutionGoal(nePath));
|
||||||
|
|
||||||
state = &NormalisationGoal::haveStoreExpr;
|
state = &NormalisationGoal::haveStoreExpr;
|
||||||
|
@ -489,8 +479,6 @@ void NormalisationGoal::haveStoreExpr()
|
||||||
i != expr.derivation.inputs.end(); ++i)
|
i != expr.derivation.inputs.end(); ++i)
|
||||||
addWaitee(worker.makeNormalisationGoal(*i));
|
addWaitee(worker.makeNormalisationGoal(*i));
|
||||||
|
|
||||||
resetWaitees(expr.derivation.inputs.size());
|
|
||||||
|
|
||||||
state = &NormalisationGoal::inputNormalised;
|
state = &NormalisationGoal::inputNormalised;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,8 +501,6 @@ void NormalisationGoal::inputNormalised()
|
||||||
i != expr.derivation.inputs.end(); ++i)
|
i != expr.derivation.inputs.end(); ++i)
|
||||||
addWaitee(worker.makeRealisationGoal(queryNormalForm(*i)));
|
addWaitee(worker.makeRealisationGoal(queryNormalForm(*i)));
|
||||||
|
|
||||||
resetWaitees(expr.derivation.inputs.size());
|
|
||||||
|
|
||||||
state = &NormalisationGoal::inputRealised;
|
state = &NormalisationGoal::inputRealised;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1284,7 +1270,6 @@ void RealisationGoal::init()
|
||||||
|
|
||||||
/* First normalise the expression (which is a no-op if the
|
/* First normalise the expression (which is a no-op if the
|
||||||
expression is already a closure). */
|
expression is already a closure). */
|
||||||
resetWaitees(1);
|
|
||||||
addWaitee(worker.makeNormalisationGoal(nePath));
|
addWaitee(worker.makeNormalisationGoal(nePath));
|
||||||
|
|
||||||
/* Since there is no successor right now, the normalisation goal
|
/* Since there is no successor right now, the normalisation goal
|
||||||
|
@ -1310,7 +1295,6 @@ void RealisationGoal::isNormalised()
|
||||||
|
|
||||||
/* Now make sure that the store expression exists. If it doesn't,
|
/* Now make sure that the store expression exists. If it doesn't,
|
||||||
it may be created through a substitute. */
|
it may be created through a substitute. */
|
||||||
resetWaitees(1);
|
|
||||||
addWaitee(worker.makeSubstitutionGoal(nfPath));
|
addWaitee(worker.makeSubstitutionGoal(nfPath));
|
||||||
|
|
||||||
state = &RealisationGoal::haveStoreExpr;
|
state = &RealisationGoal::haveStoreExpr;
|
||||||
|
@ -1341,8 +1325,6 @@ void RealisationGoal::haveStoreExpr()
|
||||||
i != expr.closure.elems.end(); ++i)
|
i != expr.closure.elems.end(); ++i)
|
||||||
addWaitee(worker.makeSubstitutionGoal(i->first));
|
addWaitee(worker.makeSubstitutionGoal(i->first));
|
||||||
|
|
||||||
resetWaitees(expr.closure.elems.size());
|
|
||||||
|
|
||||||
state = &RealisationGoal::elemFinished;
|
state = &RealisationGoal::elemFinished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1371,6 +1353,7 @@ void RealisationGoal::fallBack(const format & error)
|
||||||
% error);
|
% error);
|
||||||
tryFallback = false;
|
tryFallback = false;
|
||||||
unregisterSuccessor(nePath);
|
unregisterSuccessor(nePath);
|
||||||
|
nrFailed = 0;
|
||||||
init();
|
init();
|
||||||
} else {
|
} else {
|
||||||
printMsg(lvlError, format("%1%; maybe `--fallback' will help") % error);
|
printMsg(lvlError, format("%1%; maybe `--fallback' will help") % error);
|
||||||
|
@ -1492,8 +1475,8 @@ void SubstitutionGoal::tryNext()
|
||||||
subs.pop_front();
|
subs.pop_front();
|
||||||
|
|
||||||
/* Normalise the substitute store expression. */
|
/* Normalise the substitute store expression. */
|
||||||
|
nrFailed = 0;
|
||||||
addWaitee(worker.makeNormalisationGoal(sub.storeExpr));
|
addWaitee(worker.makeNormalisationGoal(sub.storeExpr));
|
||||||
resetWaitees(1);
|
|
||||||
|
|
||||||
state = &SubstitutionGoal::exprNormalised;
|
state = &SubstitutionGoal::exprNormalised;
|
||||||
}
|
}
|
||||||
|
@ -1512,8 +1495,6 @@ void SubstitutionGoal::exprNormalised()
|
||||||
nfSub = queryNormalForm(sub.storeExpr);
|
nfSub = queryNormalForm(sub.storeExpr);
|
||||||
addWaitee(worker.makeRealisationGoal(nfSub));
|
addWaitee(worker.makeRealisationGoal(nfSub));
|
||||||
|
|
||||||
resetWaitees(1);
|
|
||||||
|
|
||||||
state = &SubstitutionGoal::exprRealised;
|
state = &SubstitutionGoal::exprRealised;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue