aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tiny_vm
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2024-03-18 22:02:54 +0000
committerjohannst <johannst@users.noreply.github.com>2024-03-18 22:02:54 +0000
commit52a0308e18fbbec25f0e9f31ec8f11589a35f351 (patch)
tree522424f6d94aeb9c3fff16a109c5f85efb97d66c /src/tiny_vm
parent596eaec7fa9678939031eb1a434735c51f3ecec2 (diff)
downloadjuicebox-asm-52a0308e18fbbec25f0e9f31ec8f11589a35f351.tar.gz
juicebox-asm-52a0308e18fbbec25f0e9f31ec8f11589a35f351.zip
deploy: 7653ced7e8ce18b9ada2b666c63832007f8becf2
Diffstat (limited to 'src/tiny_vm')
-rw-r--r--src/tiny_vm/tiny_vm.rs.html14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tiny_vm/tiny_vm.rs.html b/src/tiny_vm/tiny_vm.rs.html
index 938bc61..e8937f6 100644
--- a/src/tiny_vm/tiny_vm.rs.html
+++ b/src/tiny_vm/tiny_vm.rs.html
@@ -744,7 +744,7 @@
</span><span class="kw">use </span>juicebox_asm::insn::<span class="kw-2">*</span>;
<span class="kw">use </span>juicebox_asm::Runtime;
-<span class="kw">use </span>juicebox_asm::{Asm, Imm16, Imm64, Label, MemOp, Reg16, Reg64};
+<span class="kw">use </span>juicebox_asm::{Asm, Imm16, Imm64, MemOp, Reg16, Reg64};
<span class="doccomment">/// A guest physical address.
</span><span class="kw">pub struct </span>PhysAddr(<span class="kw">pub </span>u16);
@@ -1036,13 +1036,13 @@
TinyInsn::BranchZero(a, disp) =&gt; {
bb.cmp(reg_op(a), Imm16::from(<span class="number">0u16</span>));
bb.mov(Reg64::rax, Imm64::from(bb_icnt()));
- bb.mov(Reg64::rdx, Imm64::from(reenter_pc(disp)));
+ <span class="comment">// Default fall-through PC (branch not taken).
+ </span>bb.mov(Reg64::rdx, Imm64::from(reenter_pc(pc)));
+
+ <span class="comment">// Conditionally update PC if condition is ZERO (branch taken).
+ </span>bb.mov(Reg64::r11, Imm64::from(reenter_pc(disp)));
+ bb.cmovz(Reg64::rdx, Reg64::r11);
- <span class="kw">let </span><span class="kw-2">mut </span>skip_next_pc = Label::new();
- <span class="comment">// If register is zero, skip setting next pc as reenter pc.
- </span>bb.jz(<span class="kw-2">&amp;mut </span>skip_next_pc);
- bb.mov(Reg64::rdx, Imm64::from(reenter_pc(pc)));
- bb.bind(<span class="kw-2">&amp;mut </span>skip_next_pc);
bb.ret();
<span class="kw">break </span><span class="lifetime">'outer</span>;
}