feat(tvix/eval): implement compilation of upvalue access

This adds a new upvalue tracking structure in the compiler to resolve
upvalues and track their positions within a function when compiling a
closure.

The compiler will emit runtime upvalue access instructions after this
commit, but the creation of the runtime closure object etc. is not yet
wired up.

Change-Id: Ib0c2c25f686bfd45f797c528753068858e3a770d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6289
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-26 21:48:51 +03:00 committed by tazjin
parent 2f93ed297e
commit 1163ef3e41
4 changed files with 66 additions and 4 deletions

View file

@ -7,6 +7,7 @@ use crate::chunk::Chunk;
pub struct Lambda {
// name: Option<NixString>,
pub(crate) chunk: Rc<Chunk>,
pub(crate) upvalue_count: usize,
}
impl Lambda {
@ -14,6 +15,7 @@ impl Lambda {
Lambda {
// name: None,
chunk: Default::default(),
upvalue_count: 0,
}
}