Skip to content

Commit fcf3bdc

Browse files
committed
move ExprAttrs data into Exprs::alloc
1 parent 4b97f11 commit fcf3bdc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/libexpr/nixexpr.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,17 @@ ExprAttrs::bindInheritSources(EvalState & es, const std::shared_ptr<const Static
401401

402402
void ExprAttrs::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env)
403403
{
404+
// Move storage into the Exprs arena
405+
{
406+
auto arena = es.mem.exprs.alloc;
407+
AttrDefs newAttrs{std::move(*attrs), arena};
408+
attrs.emplace(std::move(newAttrs), arena);
409+
DynamicAttrDefs newDynamicAttrs{std::move(*dynamicAttrs), arena};
410+
dynamicAttrs.emplace(std::move(newDynamicAttrs), arena);
411+
if (inheritFromExprs)
412+
inheritFromExprs = std::make_unique<std::pmr::vector<Expr *>>(std::move(*inheritFromExprs), arena);
413+
}
414+
404415
if (es.debugRepl)
405416
es.exprEnvs.insert(std::make_pair(this, env));
406417

0 commit comments

Comments
 (0)