forked from lix-project/lix
Avoid global counters
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
This commit is contained in:
parent
3bb8667a17
commit
c1c5dd7449
|
@ -854,39 +854,37 @@ Value * Expr::maybeThunk(EvalState & state, Env & env)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned long nrAvoided = 0;
|
|
||||||
|
|
||||||
Value * ExprVar::maybeThunk(EvalState & state, Env & env)
|
Value * ExprVar::maybeThunk(EvalState & state, Env & env)
|
||||||
{
|
{
|
||||||
Value * v = state.lookupVar(&env, *this, true);
|
Value * v = state.lookupVar(&env, *this, true);
|
||||||
/* The value might not be initialised in the environment yet.
|
/* The value might not be initialised in the environment yet.
|
||||||
In that case, ignore it. */
|
In that case, ignore it. */
|
||||||
if (v) { nrAvoided++; return v; }
|
if (v) { state.nrAvoided++; return v; }
|
||||||
return Expr::maybeThunk(state, env);
|
return Expr::maybeThunk(state, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Value * ExprString::maybeThunk(EvalState & state, Env & env)
|
Value * ExprString::maybeThunk(EvalState & state, Env & env)
|
||||||
{
|
{
|
||||||
nrAvoided++;
|
state.nrAvoided++;
|
||||||
return &v;
|
return &v;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value * ExprInt::maybeThunk(EvalState & state, Env & env)
|
Value * ExprInt::maybeThunk(EvalState & state, Env & env)
|
||||||
{
|
{
|
||||||
nrAvoided++;
|
state.nrAvoided++;
|
||||||
return &v;
|
return &v;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value * ExprFloat::maybeThunk(EvalState & state, Env & env)
|
Value * ExprFloat::maybeThunk(EvalState & state, Env & env)
|
||||||
{
|
{
|
||||||
nrAvoided++;
|
state.nrAvoided++;
|
||||||
return &v;
|
return &v;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value * ExprPath::maybeThunk(EvalState & state, Env & env)
|
Value * ExprPath::maybeThunk(EvalState & state, Env & env)
|
||||||
{
|
{
|
||||||
nrAvoided++;
|
state.nrAvoided++;
|
||||||
return &v;
|
return &v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1141,8 +1139,6 @@ static string showAttrPath(EvalState & state, Env & env, const AttrPath & attrPa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned long nrLookups = 0;
|
|
||||||
|
|
||||||
void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
||||||
{
|
{
|
||||||
Value vTmp;
|
Value vTmp;
|
||||||
|
@ -1154,7 +1150,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
||||||
try {
|
try {
|
||||||
|
|
||||||
for (auto & i : attrPath) {
|
for (auto & i : attrPath) {
|
||||||
nrLookups++;
|
state.nrLookups++;
|
||||||
Bindings::iterator j;
|
Bindings::iterator j;
|
||||||
Symbol name = getName(i, state, env);
|
Symbol name = getName(i, state, env);
|
||||||
if (def) {
|
if (def) {
|
||||||
|
|
|
@ -316,8 +316,10 @@ private:
|
||||||
unsigned long nrValuesInEnvs = 0;
|
unsigned long nrValuesInEnvs = 0;
|
||||||
unsigned long nrValues = 0;
|
unsigned long nrValues = 0;
|
||||||
unsigned long nrListElems = 0;
|
unsigned long nrListElems = 0;
|
||||||
|
unsigned long nrLookups = 0;
|
||||||
unsigned long nrAttrsets = 0;
|
unsigned long nrAttrsets = 0;
|
||||||
unsigned long nrAttrsInAttrsets = 0;
|
unsigned long nrAttrsInAttrsets = 0;
|
||||||
|
unsigned long nrAvoided = 0;
|
||||||
unsigned long nrOpUpdates = 0;
|
unsigned long nrOpUpdates = 0;
|
||||||
unsigned long nrOpUpdateValuesCopied = 0;
|
unsigned long nrOpUpdateValuesCopied = 0;
|
||||||
unsigned long nrListConcats = 0;
|
unsigned long nrListConcats = 0;
|
||||||
|
@ -339,6 +341,11 @@ private:
|
||||||
|
|
||||||
friend struct ExprOpUpdate;
|
friend struct ExprOpUpdate;
|
||||||
friend struct ExprOpConcatLists;
|
friend struct ExprOpConcatLists;
|
||||||
|
friend struct ExprVar;
|
||||||
|
friend struct ExprString;
|
||||||
|
friend struct ExprInt;
|
||||||
|
friend struct ExprFloat;
|
||||||
|
friend struct ExprPath;
|
||||||
friend struct ExprSelect;
|
friend struct ExprSelect;
|
||||||
friend void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
friend void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
||||||
friend void prim_match(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
friend void prim_match(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
||||||
|
|
Loading…
Reference in a new issue