about summary refs log tree commit diff
path: root/tvix/eval/src/opcode.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/opcode.rs')
-rw-r--r--tvix/eval/src/opcode.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs
index f265ef06d7f5..82b72952d698 100644
--- a/tvix/eval/src/opcode.rs
+++ b/tvix/eval/src/opcode.rs
@@ -11,6 +11,11 @@ pub struct ConstantIdx(pub usize);
 #[derive(Clone, Copy, Debug)]
 pub struct CodeIdx(pub usize);
 
+/// Index of a value in the runtime stack.
+#[repr(transparent)]
+#[derive(Clone, Copy, Debug)]
+pub struct StackIdx(pub usize);
+
 /// Offset by which an instruction pointer should change in a jump.
 #[repr(transparent)]
 #[derive(Clone, Copy, Debug)]
@@ -63,7 +68,7 @@ pub enum OpCode {
     OpAttrsIsSet,
 
     // `with`-handling
-    OpPushWith(usize),
+    OpPushWith(StackIdx),
     OpPopWith,
     OpResolveWith,
 
@@ -78,7 +83,7 @@ pub enum OpCode {
     OpAssertBool,
 
     // Access local identifiers with statically known positions.
-    OpGetLocal(usize),
+    OpGetLocal(StackIdx),
 
     // Close scopes while leaving their expression value around.
     OpCloseScope(usize), // number of locals to pop