* Fallback didn't work for subderivations of an unnormalised the main

derivation, since NormalisationGoal would first run a
  NormalisationGoal on the subderivation (a no-op, since in a
  situation where we need fallback the successor is known), and then
  runs a RealisationGoal on the normal form, which then cannot do a
  fallback because it doesn't know the derivation expression for which
  it is a normal form.

  Tossed out the 2-phase normalisation/realisation in
  NormalisationGoal and SubstitutionGoal since it's no longer needed -
  a RealisationGoal will run a NormalisationGoal if necessary.
This commit is contained in:
Eelco Dolstra 2004-09-12 19:08:57 +00:00
parent dcc433de47
commit b357284a32

View file

@ -357,7 +357,6 @@ private:
/* The states. */ /* The states. */
void init(); void init();
void haveStoreExpr(); void haveStoreExpr();
void inputNormalised();
void inputRealised(); void inputRealised();
void tryToBuild(); void tryToBuild();
void buildDone(); void buildDone();
@ -474,32 +473,10 @@ void NormalisationGoal::haveStoreExpr()
} }
assert(expr.type == StoreExpr::neDerivation); assert(expr.type == StoreExpr::neDerivation);
/* Inputs must be normalised before we can build this goal. */ /* Inputs must be realised before we can build this goal. */
for (PathSet::iterator i = expr.derivation.inputs.begin(); for (PathSet::iterator i = expr.derivation.inputs.begin();
i != expr.derivation.inputs.end(); ++i) i != expr.derivation.inputs.end(); ++i)
addWaitee(worker.makeNormalisationGoal(*i)); addWaitee(worker.makeRealisationGoal(*i));
state = &NormalisationGoal::inputNormalised;
}
void NormalisationGoal::inputNormalised()
{
trace("all inputs normalised");
if (nrFailed != 0) {
printMsg(lvlError,
format("cannot normalise derivation `%1%': "
"%2% closure element(s) could not be normalised")
% nePath % nrFailed);
amDone(false);
return;
}
/* Inputs must also be realised before we can build this goal. */
for (PathSet::iterator i = expr.derivation.inputs.begin();
i != expr.derivation.inputs.end(); ++i)
addWaitee(worker.makeRealisationGoal(queryNormalForm(*i)));
state = &NormalisationGoal::inputRealised; state = &NormalisationGoal::inputRealised;
} }
@ -1474,26 +1451,9 @@ void SubstitutionGoal::tryNext()
sub = subs.front(); sub = subs.front();
subs.pop_front(); subs.pop_front();
/* Normalise the substitute store expression. */
nrFailed = 0;
addWaitee(worker.makeNormalisationGoal(sub.storeExpr));
state = &SubstitutionGoal::exprNormalised;
}
void SubstitutionGoal::exprNormalised()
{
trace("substitute store expression normalised");
if (nrFailed != 0) {
tryNext();
return;
}
/* Realise the substitute store expression. */ /* Realise the substitute store expression. */
nfSub = queryNormalForm(sub.storeExpr); nrFailed = 0;
addWaitee(worker.makeRealisationGoal(nfSub)); addWaitee(worker.makeRealisationGoal(sub.storeExpr));
state = &SubstitutionGoal::exprRealised; state = &SubstitutionGoal::exprRealised;
} }
@ -1508,6 +1468,9 @@ void SubstitutionGoal::exprRealised()
return; return;
} }
/* !!! the storeExpr doesn't have to be a derivation, right? */
nfSub = queryNormalForm(sub.storeExpr);
state = &SubstitutionGoal::tryToRun; state = &SubstitutionGoal::tryToRun;
worker.waitForBuildSlot(shared_from_this()); worker.waitForBuildSlot(shared_from_this());
} }