about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-07T20·40+0300
committertazjin <tazjin@tvl.su>2022-08-12T13·05+0000
commit48a7449834246ad967301f2dc011b019171a5bbc (patch)
treeaeda763ba39cb48f3bdaed1d483d554eeff93925 /tvix
parent8b7d2fd59e12da150c69cb3ee7bb26a55355e439 (diff)
feat(tvix/eval): add initial opcode representation r/4404
Change-Id: Ibc7685a6b0b92e08f0b6c82cf7d9b04fbb593a4e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6068
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/eval/src/main.rs1
-rw-r--r--tvix/eval/src/opcode.rs19
2 files changed, 20 insertions, 0 deletions
diff --git a/tvix/eval/src/main.rs b/tvix/eval/src/main.rs
index 7cc5a380e525..fc366961b536 100644
--- a/tvix/eval/src/main.rs
+++ b/tvix/eval/src/main.rs
@@ -6,6 +6,7 @@ use std::{
 
 mod errors;
 mod eval;
+mod opcode;
 mod value;
 
 fn main() {
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs
new file mode 100644
index 000000000000..b43f75efaa8f
--- /dev/null
+++ b/tvix/eval/src/opcode.rs
@@ -0,0 +1,19 @@
+//! This module implements the instruction set running on the abstract
+//! machine implemented by tvix.
+
+#[derive(Clone, Copy, Debug)]
+pub struct ConstantIdx(pub usize);
+
+#[derive(Clone, Copy, Debug)]
+pub struct CodeIdx(pub usize);
+
+#[derive(Clone, Copy, Debug)]
+pub enum OpCode {
+    // Push a constant onto the stack.
+    OpConstant(ConstantIdx),
+
+    // Push a literal value.
+    OpNull,
+    OpTrue,
+    OpFalse,
+}