Skip to content

Commit

Permalink
determinePos: remove from critical path
Browse files Browse the repository at this point in the history
  • Loading branch information
kamadorueda committed Jan 21, 2022
1 parent f1268a7 commit 60f3bed
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/libexpr/attr-path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attr
Value * vNew = state.allocValue();
state.autoCallFunction(autoArgs, *v, *vNew);
v = vNew;
state.forceValue(*v, v->determinePos(vIn.determinePos(noPos)));
state.forceValue(*v, noPos);

/* It should evaluate to either a set or an expression,
according to what is specified in the attrPath. */
Expand Down
4 changes: 2 additions & 2 deletions src/libexpr/eval-cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ Value & AttrCursor::getValue()
if (!_value) {
if (parent) {
auto & vParent = parent->first->getValue();
root->state.forceAttrs(vParent, vParent.determinePos(noPos));
root->state.forceAttrs(vParent, noPos);
auto attr = vParent.attrs->get(parent->second);
if (!attr)
throw Error("attribute '%s' is unexpectedly missing", getAttrPathStr());
Expand Down Expand Up @@ -381,7 +381,7 @@ Value & AttrCursor::forceValue()
auto & v = getValue();

try {
root->state.forceValue(v, v.determinePos(noPos));
root->state.forceValue(v, noPos);
} catch (EvalError &) {
debug("setting '%s' to failed", getAttrPathStr());
if (root->db)
Expand Down
6 changes: 3 additions & 3 deletions src/libexpr/eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ void ExprOpHasAttr::eval(EvalState & state, Env & env, Value & v)
e->eval(state, env, vTmp);

for (auto & i : attrPath) {
state.forceValue(*vAttrs, vAttrs->determinePos(noPos));
state.forceValue(*vAttrs, noPos);
Bindings::iterator j;
Symbol name = getName(i, state, env);
if (vAttrs->type() != nAttrs ||
Expand Down Expand Up @@ -2037,8 +2037,8 @@ Path EvalState::coerceToPath(const Pos & pos, Value & v, PathSet & context)

bool EvalState::eqValues(Value & v1, Value & v2)
{
forceValue(v1, v1.determinePos(noPos));
forceValue(v2, v2.determinePos(noPos));
forceValue(v1, noPos);
forceValue(v2, noPos);

/* !!! Hack to support some old broken code that relies on pointer
equality tests between sets. (Specifically, builderDefs calls
Expand Down

0 comments on commit 60f3bed

Please sign in to comment.