feat(tvix/eval): add initial opcode representation
Change-Id: Ibc7685a6b0b92e08f0b6c82cf7d9b04fbb593a4e Reviewed-on: https://cl.tvl.fyi/c/depot/+/6068 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
		
							parent
							
								
									8b7d2fd59e
								
							
						
					
					
						commit
						48a7449834
					
				
					 2 changed files with 20 additions and 0 deletions
				
			
		| 
						 | 
					@ -6,6 +6,7 @@ use std::{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mod errors;
 | 
					mod errors;
 | 
				
			||||||
mod eval;
 | 
					mod eval;
 | 
				
			||||||
 | 
					mod opcode;
 | 
				
			||||||
mod value;
 | 
					mod value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										19
									
								
								tvix/eval/src/opcode.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tvix/eval/src/opcode.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -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,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue