diff options
Diffstat (limited to 'tvix/eval/src/opcode.rs')
-rw-r--r-- | tvix/eval/src/opcode.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs index dadb2ecbf86f..220933f41ea9 100644 --- a/tvix/eval/src/opcode.rs +++ b/tvix/eval/src/opcode.rs @@ -1,12 +1,18 @@ //! This module implements the instruction set running on the abstract //! machine implemented by tvix. +#[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ConstantIdx(pub usize); +#[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct CodeIdx(pub usize); +#[repr(transparent)] +#[derive(Clone, Copy, Debug)] +pub struct JumpOffset(pub usize); + #[allow(clippy::enum_variant_names)] #[warn(variant_size_differences)] #[derive(Clone, Copy, Debug)] @@ -40,10 +46,10 @@ pub enum OpCode { OpMoreOrEq, // Logical operators & generic jumps - OpJump(usize), - OpJumpIfTrue(usize), - OpJumpIfFalse(usize), - OpJumpIfNotFound(usize), + OpJump(JumpOffset), + OpJumpIfTrue(JumpOffset), + OpJumpIfFalse(JumpOffset), + OpJumpIfNotFound(JumpOffset), // Attribute sets OpAttrs(usize), |