From c94a65c993f5da6a86bd1e6d23e359ba2052f836 Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 13 Dec 2024 00:18:53 +0000 Subject: deploy: 758f014afb8ec5c20ef2fc862fc12e80f65d3d25 --- src/bf/bf.rs.html | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/bf/bf.rs.html') diff --git a/src/bf/bf.rs.html b/src/bf/bf.rs.html index 9bd6202..b29403b 100644 --- a/src/bf/bf.rs.html +++ b/src/bf/bf.rs.html @@ -333,7 +333,11 @@ 332 333 334 -335
//! Brainfuck VM.
+335
+336
+337
+338
+339
//! Brainfuck VM.
 //!
 //! This example implements a simple
 //! [brainfuck](https://en.wikipedia.org/wiki/Brainfuck) interpreter
@@ -354,7 +358,7 @@
 
 use juicebox_asm::insn::*;
 use juicebox_asm::Runtime;
-use juicebox_asm::{Asm, Imm64, Imm8, Label, MemOp, MemOp8, Reg64, Reg8};
+use juicebox_asm::{Asm, Imm64, Imm8, Label, Mem8, Reg64, Reg8};
 
 // -- BRAINFUCK INTERPRETER ----------------------------------------------------
 
@@ -539,12 +543,14 @@
                 // single add instruction during compile time.
 
                 match vm.imem[pc..].iter().take_while(|&&i| i.eq(&'+')).count() {
-                    1 => asm.inc(MemOp8::from(MemOp::IndirectBaseIndex(dmem_base, dmem_idx))),
+                    1 => {
+                        asm.inc(Mem8::indirect_base_index(dmem_base, dmem_idx));
+                    }
                     cnt if cnt <= i8::MAX as usize => {
                         // For add m64, imm8, the immediate is sign-extend and
                         // hence treated as signed.
                         asm.add(
-                            MemOp::IndirectBaseIndex(dmem_base, dmem_idx),
+                            Mem8::indirect_base_index(dmem_base, dmem_idx),
                             Imm8::from(cnt as u8),
                         );
 
@@ -560,12 +566,14 @@
                 // single sub instruction during compile time.
 
                 match vm.imem[pc..].iter().take_while(|&&i| i.eq(&'-')).count() {
-                    1 => asm.dec(MemOp8::from(MemOp::IndirectBaseIndex(dmem_base, dmem_idx))),
+                    1 => {
+                        asm.dec(Mem8::indirect_base_index(dmem_base, dmem_idx));
+                    }
                     cnt if cnt <= i8::MAX as usize => {
                         // For sub m64, imm8, the immediate is sign-extend and
                         // hence treated as signed.
                         asm.sub(
-                            MemOp::IndirectBaseIndex(dmem_base, dmem_idx),
+                            Mem8::indirect_base_index(dmem_base, dmem_idx),
                             Imm8::from(cnt as u8),
                         );
 
@@ -582,7 +590,7 @@
                 // then call into putchar. Since we stored all out vm state in
                 // callee saved registers we don't need to save any registers
                 // before the call.
-                asm.mov(Reg8::dil, MemOp::IndirectBaseIndex(dmem_base, dmem_idx));
+                asm.mov(Reg8::dil, Mem8::indirect_base_index(dmem_base, dmem_idx));
                 asm.mov(Reg64::rax, Imm64::from(putchar as usize));
                 asm.call(Reg64::rax);
             }
@@ -598,7 +606,7 @@
                 // Goto label_pair.0 if data memory at active cell is 0.
                 //   if vm.dmem[vm.dptr] == 0 goto label_pair.0
                 asm.cmp(
-                    MemOp::IndirectBaseIndex(dmem_base, dmem_idx),
+                    Mem8::indirect_base_index(dmem_base, dmem_idx),
                     Imm8::from(0u8),
                 );
                 asm.jz(&mut label_pair.0);
@@ -615,7 +623,7 @@
                 // Goto label_pair.1 if data memory at active cell is not 0.
                 //   if vm.dmem[vm.dptr] != 0 goto label_pair.1
                 asm.cmp(
-                    MemOp::IndirectBaseIndex(dmem_base, dmem_idx),
+                    Mem8::indirect_base_index(dmem_base, dmem_idx),
                     Imm8::from(0u8),
                 );
                 asm.jnz(&mut label_pair.1);
-- 
cgit v1.2.3