From 6e30fbbf7b9bf7641e48692d94d9c215e148b239 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 15 Oct 2022 17:06:08 -0700 Subject: docs(tvix/eval) comments for various fields Change-Id: I8dcddf2b419761e475e71215c199eef2f7dc61dc Reviewed-on: https://cl.tvl.fyi/c/depot/+/7028 Autosubmit: Adam Joseph Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/eval/src/value/function.rs | 10 ++++++++++ tvix/eval/src/value/mod.rs | 5 +++++ 2 files changed, 15 insertions(+) (limited to 'tvix/eval/src/value') diff --git a/tvix/eval/src/value/function.rs b/tvix/eval/src/value/function.rs index 6287cf76b81d..0923e1b1cba9 100644 --- a/tvix/eval/src/value/function.rs +++ b/tvix/eval/src/value/function.rs @@ -9,10 +9,20 @@ use crate::{ upvalues::{UpvalueCarrier, Upvalues}, }; +/// The opcodes for a thunk or closure, plus the number of +/// non-executable opcodes which are allowed after an OpClosure or +/// OpThunk referencing it. At runtime `Lambda` is usually wrapped +/// in `Rc` to avoid copying the `Chunk` it holds (which can be +/// quite large). #[derive(Debug, PartialEq)] pub struct Lambda { // name: Option, pub(crate) chunk: Chunk, + + /// Number of upvalues which the code in this Lambda closes + /// over, and which need to be initialised at + /// runtime. Information about the variables is emitted using + /// data-carrying opcodes (see [`OpCode::DataLocalIdx`]). pub(crate) upvalue_count: usize, } diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 93e194e37940..a1216452fbb5 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -43,8 +43,13 @@ pub enum Value { // Internal values that, while they technically exist at runtime, // are never returned to or created directly by users. Thunk(Thunk), + + // See [`compiler::compile_select_or()`] for explanation AttrNotFound, + + // this can only occur in Chunk::Constants and nowhere else Blueprint(Rc), + DeferredUpvalue(StackIdx), UnresolvedPath(PathBuf), } -- cgit 1.4.1