test(tvix/eval): Add proof-of-concept test for Chunk
This is pretty boring at the moment, but mostly serves as a foot in the door in the direction of writing more tests Change-Id: Id88eb4ec7e53ebb2d5b5c254c8f45ff750238811 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6637 Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
bb47baf638
commit
221d3b9485
4 changed files with 28 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ use std::ops::{AddAssign, Sub};
|
|||
|
||||
/// Index of a constant in the current code chunk.
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct ConstantIdx(pub usize);
|
||||
|
||||
/// Index of an instruction in the current code chunk.
|
||||
|
|
@ -39,17 +39,17 @@ pub struct UpvalueIdx(pub usize);
|
|||
|
||||
/// Offset by which an instruction pointer should change in a jump.
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct JumpOffset(pub usize);
|
||||
|
||||
/// Provided count for an instruction (could represent e.g. a number
|
||||
/// of elements).
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct Count(pub usize);
|
||||
|
||||
#[warn(variant_size_differences)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum OpCode {
|
||||
/// Push a constant onto the stack.
|
||||
OpConstant(ConstantIdx),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue