refactor(tvix/eval): Construct globals in EvaluationBuilder::build

Construct the Rc<GlobalsMap> for the evaluation as part of
EvaluiationBuilder::build, rather than deferring it until we actually
compile. This changes nothing functionally, but gets us one step closer
to sharing this globals map across evaluations.

Change-Id: Id92e9fb88d974d763056d4f15ce61962ab776e84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11957
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Aspen Smith 2024-07-05 20:50:56 -04:00 committed by clbot
parent dfe137786c
commit 3a79f93795
2 changed files with 47 additions and 58 deletions

View file

@ -44,11 +44,6 @@ pub struct CompilationOutput {
pub lambda: Rc<Lambda>,
pub warnings: Vec<EvalWarning>,
pub errors: Vec<Error>,
// This field must outlive the rc::Weak reference which breaks the
// builtins -> import -> builtins reference cycle. For this
// reason, it must be passed to the VM.
pub globals: Rc<GlobalsMap>,
}
/// Represents the lambda currently being compiled.
@ -1689,6 +1684,5 @@ pub fn compile(
lambda,
warnings: c.warnings,
errors: c.errors,
globals,
})
}