forked from lix-project/lix
libexpr: move thunk counter into eval state
this is relative to the current state. why was it made global?
Change-Id: I58b3ce0213e791a05ce9fd7a2cb2394b9454c653
This commit is contained in:
parent
ea931d4d03
commit
276a771210
2 changed files with 8 additions and 12 deletions
|
@ -779,18 +779,10 @@ Value EvalMemory::newList(size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned long nrThunks = 0;
|
|
||||||
|
|
||||||
static inline void mkThunk(Value & v, Env & env, Expr & expr)
|
|
||||||
{
|
|
||||||
v.mkThunk(&env, expr);
|
|
||||||
nrThunks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EvalState::evalLazily(Expr & e, Value & v)
|
void EvalState::evalLazily(Expr & e, Value & v)
|
||||||
{
|
{
|
||||||
mkThunk(v, builtins.env, e);
|
v.mkThunk(&builtins.env, e);
|
||||||
|
nrThunks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -889,7 +881,8 @@ void EvalState::mkSingleDerivedPathString(
|
||||||
Value * Expr::maybeThunk(EvalState & state, Env & env)
|
Value * Expr::maybeThunk(EvalState & state, Env & env)
|
||||||
{
|
{
|
||||||
Value * v = state.mem.allocValue();
|
Value * v = state.mem.allocValue();
|
||||||
mkThunk(*v, env, *this);
|
v->mkThunk(&env, *this);
|
||||||
|
state.nrThunks++;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,7 +1081,8 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v)
|
||||||
Value * vAttr;
|
Value * vAttr;
|
||||||
if (hasOverrides && i.second.kind != AttrDef::Kind::Inherited) {
|
if (hasOverrides && i.second.kind != AttrDef::Kind::Inherited) {
|
||||||
vAttr = state.mem.allocValue();
|
vAttr = state.mem.allocValue();
|
||||||
mkThunk(*vAttr, *i.second.chooseByKind(&env2, &env, inheritEnv), *i.second.e);
|
vAttr->mkThunk(i.second.chooseByKind(&env2, &env, inheritEnv), *i.second.e);
|
||||||
|
state.nrThunks++;
|
||||||
} else
|
} else
|
||||||
vAttr = i.second.e->maybeThunk(state, *i.second.chooseByKind(&env2, &env, inheritEnv));
|
vAttr = i.second.e->maybeThunk(state, *i.second.chooseByKind(&env2, &env, inheritEnv));
|
||||||
env2.values[displ++] = vAttr;
|
env2.values[displ++] = vAttr;
|
||||||
|
|
|
@ -780,6 +780,7 @@ private:
|
||||||
unsigned long nrListConcats = 0;
|
unsigned long nrListConcats = 0;
|
||||||
unsigned long nrPrimOpCalls = 0;
|
unsigned long nrPrimOpCalls = 0;
|
||||||
unsigned long nrFunctionCalls = 0;
|
unsigned long nrFunctionCalls = 0;
|
||||||
|
unsigned long nrThunks = 0;
|
||||||
|
|
||||||
bool countCalls;
|
bool countCalls;
|
||||||
|
|
||||||
|
@ -794,6 +795,7 @@ private:
|
||||||
using AttrSelects = std::map<PosIdx, size_t>;
|
using AttrSelects = std::map<PosIdx, size_t>;
|
||||||
AttrSelects attrSelects;
|
AttrSelects attrSelects;
|
||||||
|
|
||||||
|
friend struct Expr;
|
||||||
friend struct ExprOpUpdate;
|
friend struct ExprOpUpdate;
|
||||||
friend struct ExprOpConcatLists;
|
friend struct ExprOpConcatLists;
|
||||||
friend struct ExprVar;
|
friend struct ExprVar;
|
||||||
|
|
Loading…
Reference in a new issue