From d3e1eff9593501ff8677b9399e1f0625f415ec78 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 7 Dec 2023 23:53:44 +0000 Subject: deploy: b5aea3fb5fcce31599e3d7397d5413a934132231 --- fib/index.html | 2 +- help.html | 2 +- implementors/core/clone/trait.Clone.js | 2 +- implementors/core/convert/trait.From.js | 2 +- implementors/core/marker/trait.Copy.js | 2 +- implementors/core/marker/trait.Freeze.js | 2 +- implementors/core/marker/trait.Send.js | 2 +- implementors/core/marker/trait.Sync.js | 2 +- implementors/core/marker/trait.Unpin.js | 2 +- implementors/core/ops/drop/trait.Drop.js | 2 +- .../core/panic/unwind_safe/trait.RefUnwindSafe.js | 2 +- .../core/panic/unwind_safe/trait.UnwindSafe.js | 2 +- juicebox_asm/all.html | 2 +- juicebox_asm/asm/struct.Asm.html | 11 + juicebox_asm/enum.MemOp.html | 12 +- juicebox_asm/enum.Reg16.html | 2 +- juicebox_asm/enum.Reg32.html | 2 +- juicebox_asm/enum.Reg64.html | 2 +- juicebox_asm/enum.Reg8.html | 2 +- juicebox_asm/imm/struct.Imm16.html | 6 +- juicebox_asm/imm/struct.Imm32.html | 6 +- juicebox_asm/imm/struct.Imm64.html | 6 +- juicebox_asm/imm/struct.Imm8.html | 6 +- juicebox_asm/index.html | 7 +- juicebox_asm/insn/index.html | 2 + juicebox_asm/insn/sidebar-items.js | 1 + juicebox_asm/insn/trait.Add.html | 17 +- juicebox_asm/insn/trait.Call.html | 17 +- juicebox_asm/insn/trait.Cmp.html | 19 +- juicebox_asm/insn/trait.Dec.html | 17 +- juicebox_asm/insn/trait.Jmp.html | 17 +- juicebox_asm/insn/trait.Jnz.html | 17 +- juicebox_asm/insn/trait.Jz.html | 17 +- juicebox_asm/insn/trait.Mov.html | 17 +- juicebox_asm/insn/trait.Test.html | 19 +- juicebox_asm/label/struct.Label.html | 6 +- juicebox_asm/prelude/enum.Reg16.html | 30 - juicebox_asm/prelude/enum.Reg32.html | 30 - juicebox_asm/prelude/enum.Reg64.html | 30 - juicebox_asm/prelude/enum.Reg8.html | 34 - juicebox_asm/prelude/index.html | 2 - juicebox_asm/prelude/sidebar-items.js | 1 - juicebox_asm/prelude/struct.Imm16.html | 12 - juicebox_asm/prelude/struct.Imm32.html | 12 - juicebox_asm/prelude/struct.Imm64.html | 12 - juicebox_asm/prelude/struct.Imm8.html | 12 - juicebox_asm/prelude/struct.Label.html | 26 - juicebox_asm/prelude/trait.Add.html | 5 - juicebox_asm/prelude/trait.Call.html | 5 - juicebox_asm/prelude/trait.Cmp.html | 5 - juicebox_asm/prelude/trait.Dec.html | 5 - juicebox_asm/prelude/trait.Jmp.html | 5 - juicebox_asm/prelude/trait.Jnz.html | 5 - juicebox_asm/prelude/trait.Jz.html | 5 - juicebox_asm/prelude/trait.Mov.html | 5 - juicebox_asm/prelude/trait.Test.html | 7 - juicebox_asm/reg/enum.Reg16.html | 6 +- juicebox_asm/reg/enum.Reg32.html | 6 +- juicebox_asm/reg/enum.Reg64.html | 6 +- juicebox_asm/reg/enum.Reg8.html | 6 +- juicebox_asm/sidebar-items.js | 2 +- juicebox_asm/struct.Asm.html | 13 +- juicebox_asm/struct.Imm16.html | 2 +- juicebox_asm/struct.Imm32.html | 2 +- juicebox_asm/struct.Imm64.html | 6 +- juicebox_asm/struct.Imm8.html | 2 +- juicebox_asm/struct.Label.html | 9 +- juicebox_asm/struct.Runtime.html | 34 +- search-index.js | 2 +- settings.html | 2 +- src-files.js | 2 +- src/add/add.rs.html | 8 +- src/fib/fib.rs.html | 4 +- src/juicebox_asm/asm.rs.html | 689 +++++++++++++++++++ src/juicebox_asm/imm.rs.html | 28 +- src/juicebox_asm/insn.rs.html | 44 +- src/juicebox_asm/insn/add.rs.html | 4 +- src/juicebox_asm/insn/call.rs.html | 4 +- src/juicebox_asm/insn/cmp.rs.html | 4 +- src/juicebox_asm/insn/dec.rs.html | 4 +- src/juicebox_asm/insn/jmp.rs.html | 4 +- src/juicebox_asm/insn/jnz.rs.html | 4 +- src/juicebox_asm/insn/jz.rs.html | 4 +- src/juicebox_asm/insn/mov.rs.html | 4 +- src/juicebox_asm/insn/nop.rs.html | 4 +- src/juicebox_asm/insn/ret.rs.html | 4 +- src/juicebox_asm/insn/test.rs.html | 4 +- src/juicebox_asm/label.rs.html | 4 +- src/juicebox_asm/lib.rs.html | 736 +-------------------- src/juicebox_asm/prelude.rs.html | 21 - src/juicebox_asm/reg.rs.html | 98 +-- src/juicebox_asm/rt.rs.html | 290 +++++++- src/tiny_vm/tiny_vm.rs.html | 4 +- tiny_vm/enum.TinyInsn.html | 6 +- tiny_vm/enum.TinyReg.html | 6 +- tiny_vm/fn.make_tinyvm_fib.html | 2 +- tiny_vm/fn.make_tinyvm_jit_perf.html | 2 +- tiny_vm/fn.make_tinyvm_jit_test.html | 2 +- tiny_vm/index.html | 2 +- tiny_vm/struct.Fixup.html | 6 +- tiny_vm/struct.PhysAddr.html | 4 +- tiny_vm/struct.TinyVm.html | 18 +- 102 files changed, 1279 insertions(+), 1341 deletions(-) create mode 100644 juicebox_asm/asm/struct.Asm.html create mode 100644 juicebox_asm/insn/index.html create mode 100644 juicebox_asm/insn/sidebar-items.js delete mode 100644 juicebox_asm/prelude/enum.Reg16.html delete mode 100644 juicebox_asm/prelude/enum.Reg32.html delete mode 100644 juicebox_asm/prelude/enum.Reg64.html delete mode 100644 juicebox_asm/prelude/enum.Reg8.html delete mode 100644 juicebox_asm/prelude/index.html delete mode 100644 juicebox_asm/prelude/sidebar-items.js delete mode 100644 juicebox_asm/prelude/struct.Imm16.html delete mode 100644 juicebox_asm/prelude/struct.Imm32.html delete mode 100644 juicebox_asm/prelude/struct.Imm64.html delete mode 100644 juicebox_asm/prelude/struct.Imm8.html delete mode 100644 juicebox_asm/prelude/struct.Label.html delete mode 100644 juicebox_asm/prelude/trait.Add.html delete mode 100644 juicebox_asm/prelude/trait.Call.html delete mode 100644 juicebox_asm/prelude/trait.Cmp.html delete mode 100644 juicebox_asm/prelude/trait.Dec.html delete mode 100644 juicebox_asm/prelude/trait.Jmp.html delete mode 100644 juicebox_asm/prelude/trait.Jnz.html delete mode 100644 juicebox_asm/prelude/trait.Jz.html delete mode 100644 juicebox_asm/prelude/trait.Mov.html delete mode 100644 juicebox_asm/prelude/trait.Test.html create mode 100644 src/juicebox_asm/asm.rs.html delete mode 100644 src/juicebox_asm/prelude.rs.html diff --git a/fib/index.html b/fib/index.html index 6d09b7f..5447c2b 100644 --- a/fib/index.html +++ b/fib/index.html @@ -1,4 +1,4 @@ -fib - Rust

Crate fib

source ·
Expand description

Fibonacci example.

+fib - Rust

Crate fib

source ·
Expand description

Fibonacci example.

Jit compile a function at runtime (generate native host code) to compute the fibonacci sequence to demonstrate the juicebox_asm crate.

\ No newline at end of file diff --git a/help.html b/help.html index 2f2501a..9b2ceb3 100644 --- a/help.html +++ b/help.html @@ -1 +1 @@ -Rustdoc help

Rustdoc help

Back
\ No newline at end of file +Rustdoc help

Rustdoc help

Back
\ No newline at end of file diff --git a/implementors/core/clone/trait.Clone.js b/implementors/core/clone/trait.Clone.js index 3d5056c..905201f 100644 --- a/implementors/core/clone/trait.Clone.js +++ b/implementors/core/clone/trait.Clone.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl Clone for Reg32"],["impl Clone for Reg8"],["impl Clone for Reg64"],["impl Clone for Reg16"]], +"juicebox_asm":[["impl Clone for Reg32"],["impl Clone for Reg8"],["impl Clone for Reg64"],["impl Clone for Reg16"]], "tiny_vm":[["impl Clone for TinyReg"],["impl Clone for TinyInsn"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/convert/trait.From.js b/implementors/core/convert/trait.From.js index 99058f2..9e4dad6 100644 --- a/implementors/core/convert/trait.From.js +++ b/implementors/core/convert/trait.From.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"juicebox_asm":[["impl From<i32> for Imm32"],["impl From<u16> for Imm32"],["impl From<i8> for Imm8"],["impl From<u8> for Imm8"],["impl From<i16> for Imm64"],["impl From<i16> for Imm16"],["impl From<u16> for Imm16"],["impl From<i64> for Imm64"],["impl From<u32> for Imm64"],["impl From<i8> for Imm64"],["impl From<u8> for Imm64"],["impl From<i8> for Imm32"],["impl From<u32> for Imm32"],["impl From<u16> for Imm64"],["impl From<i8> for Imm16"],["impl From<u64> for Imm64"],["impl From<i32> for Imm64"],["impl From<u8> for Imm32"],["impl From<u8> for Imm16"],["impl From<i16> for Imm32"]] +"juicebox_asm":[["impl From<i32> for Imm32"],["impl From<u16> for Imm32"],["impl From<i8> for Imm8"],["impl From<u8> for Imm8"],["impl From<usize> for Imm64"],["impl From<i16> for Imm64"],["impl From<i16> for Imm16"],["impl From<u16> for Imm16"],["impl From<i64> for Imm64"],["impl From<u32> for Imm64"],["impl From<i8> for Imm64"],["impl From<u8> for Imm64"],["impl From<i8> for Imm32"],["impl From<u32> for Imm32"],["impl From<u16> for Imm64"],["impl From<i8> for Imm16"],["impl From<u64> for Imm64"],["impl From<i32> for Imm64"],["impl From<isize> for Imm64"],["impl From<u8> for Imm32"],["impl From<u8> for Imm16"],["impl From<i16> for Imm32"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Copy.js b/implementors/core/marker/trait.Copy.js index 7220462..f3c8d33 100644 --- a/implementors/core/marker/trait.Copy.js +++ b/implementors/core/marker/trait.Copy.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl Copy for Reg64"],["impl Copy for Reg32"],["impl Copy for Reg16"],["impl Copy for Reg8"]], +"juicebox_asm":[["impl Copy for Reg64"],["impl Copy for Reg32"],["impl Copy for Reg16"],["impl Copy for Reg8"]], "tiny_vm":[["impl Copy for TinyInsn"],["impl Copy for TinyReg"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Freeze.js b/implementors/core/marker/trait.Freeze.js index a20eabc..13b78cd 100644 --- a/implementors/core/marker/trait.Freeze.js +++ b/implementors/core/marker/trait.Freeze.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl Freeze for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Freeze for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Freeze for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Freeze for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Freeze for Label",1,["juicebox_asm::label::Label"]],["impl Freeze for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Freeze for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Freeze for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Freeze for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl Freeze for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Freeze for MemOp",1,["juicebox_asm::MemOp"]],["impl Freeze for Asm",1,["juicebox_asm::Asm"]]], +"juicebox_asm":[["impl Freeze for Asm",1,["juicebox_asm::asm::Asm"]],["impl Freeze for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Freeze for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Freeze for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Freeze for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Freeze for Label",1,["juicebox_asm::label::Label"]],["impl Freeze for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Freeze for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Freeze for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Freeze for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl Freeze for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Freeze for MemOp",1,["juicebox_asm::MemOp"]]], "tiny_vm":[["impl Freeze for PhysAddr",1,["tiny_vm::PhysAddr"]],["impl Freeze for TinyReg",1,["tiny_vm::TinyReg"]],["impl Freeze for TinyInsn",1,["tiny_vm::TinyInsn"]],["impl Freeze for TinyVm",1,["tiny_vm::TinyVm"]],["impl Freeze for Fixup",1,["tiny_vm::Fixup"]]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Send.js b/implementors/core/marker/trait.Send.js index 448e624..2839e60 100644 --- a/implementors/core/marker/trait.Send.js +++ b/implementors/core/marker/trait.Send.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl Send for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Send for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Send for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Send for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Send for Label",1,["juicebox_asm::label::Label"]],["impl Send for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Send for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Send for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Send for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl !Send for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Send for MemOp",1,["juicebox_asm::MemOp"]],["impl Send for Asm",1,["juicebox_asm::Asm"]]], +"juicebox_asm":[["impl Send for Asm",1,["juicebox_asm::asm::Asm"]],["impl Send for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Send for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Send for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Send for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Send for Label",1,["juicebox_asm::label::Label"]],["impl Send for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Send for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Send for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Send for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl !Send for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Send for MemOp",1,["juicebox_asm::MemOp"]]], "tiny_vm":[["impl Send for PhysAddr",1,["tiny_vm::PhysAddr"]],["impl Send for TinyReg",1,["tiny_vm::TinyReg"]],["impl Send for TinyInsn",1,["tiny_vm::TinyInsn"]],["impl !Send for TinyVm",1,["tiny_vm::TinyVm"]],["impl Send for Fixup",1,["tiny_vm::Fixup"]]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Sync.js b/implementors/core/marker/trait.Sync.js index 507e5cb..b641c3b 100644 --- a/implementors/core/marker/trait.Sync.js +++ b/implementors/core/marker/trait.Sync.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl Sync for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Sync for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Sync for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Sync for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Sync for Label",1,["juicebox_asm::label::Label"]],["impl Sync for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Sync for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Sync for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Sync for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl !Sync for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Sync for MemOp",1,["juicebox_asm::MemOp"]],["impl Sync for Asm",1,["juicebox_asm::Asm"]]], +"juicebox_asm":[["impl Sync for Asm",1,["juicebox_asm::asm::Asm"]],["impl Sync for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Sync for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Sync for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Sync for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Sync for Label",1,["juicebox_asm::label::Label"]],["impl Sync for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Sync for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Sync for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Sync for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl !Sync for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Sync for MemOp",1,["juicebox_asm::MemOp"]]], "tiny_vm":[["impl Sync for PhysAddr",1,["tiny_vm::PhysAddr"]],["impl Sync for TinyReg",1,["tiny_vm::TinyReg"]],["impl Sync for TinyInsn",1,["tiny_vm::TinyInsn"]],["impl !Sync for TinyVm",1,["tiny_vm::TinyVm"]],["impl Sync for Fixup",1,["tiny_vm::Fixup"]]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Unpin.js b/implementors/core/marker/trait.Unpin.js index 2515ec9..5dc3918 100644 --- a/implementors/core/marker/trait.Unpin.js +++ b/implementors/core/marker/trait.Unpin.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl Unpin for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Unpin for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Unpin for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Unpin for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Unpin for Label",1,["juicebox_asm::label::Label"]],["impl Unpin for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Unpin for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Unpin for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Unpin for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl Unpin for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Unpin for MemOp",1,["juicebox_asm::MemOp"]],["impl Unpin for Asm",1,["juicebox_asm::Asm"]]], +"juicebox_asm":[["impl Unpin for Asm",1,["juicebox_asm::asm::Asm"]],["impl Unpin for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl Unpin for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl Unpin for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl Unpin for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl Unpin for Label",1,["juicebox_asm::label::Label"]],["impl Unpin for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl Unpin for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl Unpin for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl Unpin for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl Unpin for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl Unpin for MemOp",1,["juicebox_asm::MemOp"]]], "tiny_vm":[["impl Unpin for PhysAddr",1,["tiny_vm::PhysAddr"]],["impl Unpin for TinyReg",1,["tiny_vm::TinyReg"]],["impl Unpin for TinyInsn",1,["tiny_vm::TinyInsn"]],["impl Unpin for TinyVm",1,["tiny_vm::TinyVm"]],["impl Unpin for Fixup",1,["tiny_vm::Fixup"]]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/ops/drop/trait.Drop.js b/implementors/core/ops/drop/trait.Drop.js index 2868c93..b6aa53b 100644 --- a/implementors/core/ops/drop/trait.Drop.js +++ b/implementors/core/ops/drop/trait.Drop.js @@ -1,3 +1,3 @@ (function() {var implementors = { -"juicebox_asm":[["impl Drop for Label"],["impl Drop for Runtime"]] +"juicebox_asm":[["impl Drop for Label"],["impl Drop for Runtime"]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js index 09f6fae..f644b0d 100644 --- a/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js +++ b/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl RefUnwindSafe for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl RefUnwindSafe for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl RefUnwindSafe for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl RefUnwindSafe for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl RefUnwindSafe for Label",1,["juicebox_asm::label::Label"]],["impl RefUnwindSafe for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl RefUnwindSafe for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl RefUnwindSafe for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl RefUnwindSafe for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl RefUnwindSafe for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl RefUnwindSafe for MemOp",1,["juicebox_asm::MemOp"]],["impl RefUnwindSafe for Asm",1,["juicebox_asm::Asm"]]], +"juicebox_asm":[["impl RefUnwindSafe for Asm",1,["juicebox_asm::asm::Asm"]],["impl RefUnwindSafe for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl RefUnwindSafe for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl RefUnwindSafe for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl RefUnwindSafe for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl RefUnwindSafe for Label",1,["juicebox_asm::label::Label"]],["impl RefUnwindSafe for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl RefUnwindSafe for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl RefUnwindSafe for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl RefUnwindSafe for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl RefUnwindSafe for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl RefUnwindSafe for MemOp",1,["juicebox_asm::MemOp"]]], "tiny_vm":[["impl RefUnwindSafe for PhysAddr",1,["tiny_vm::PhysAddr"]],["impl RefUnwindSafe for TinyReg",1,["tiny_vm::TinyReg"]],["impl RefUnwindSafe for TinyInsn",1,["tiny_vm::TinyInsn"]],["impl RefUnwindSafe for TinyVm",1,["tiny_vm::TinyVm"]],["impl RefUnwindSafe for Fixup",1,["tiny_vm::Fixup"]]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/implementors/core/panic/unwind_safe/trait.UnwindSafe.js index e9552a2..80030bf 100644 --- a/implementors/core/panic/unwind_safe/trait.UnwindSafe.js +++ b/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -1,4 +1,4 @@ (function() {var implementors = { -"juicebox_asm":[["impl UnwindSafe for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl UnwindSafe for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl UnwindSafe for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl UnwindSafe for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl UnwindSafe for Label",1,["juicebox_asm::label::Label"]],["impl UnwindSafe for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl UnwindSafe for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl UnwindSafe for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl UnwindSafe for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl UnwindSafe for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl UnwindSafe for MemOp",1,["juicebox_asm::MemOp"]],["impl UnwindSafe for Asm",1,["juicebox_asm::Asm"]]], +"juicebox_asm":[["impl UnwindSafe for Asm",1,["juicebox_asm::asm::Asm"]],["impl UnwindSafe for Imm8",1,["juicebox_asm::imm::Imm8"]],["impl UnwindSafe for Imm16",1,["juicebox_asm::imm::Imm16"]],["impl UnwindSafe for Imm32",1,["juicebox_asm::imm::Imm32"]],["impl UnwindSafe for Imm64",1,["juicebox_asm::imm::Imm64"]],["impl UnwindSafe for Label",1,["juicebox_asm::label::Label"]],["impl UnwindSafe for Reg64",1,["juicebox_asm::reg::Reg64"]],["impl UnwindSafe for Reg32",1,["juicebox_asm::reg::Reg32"]],["impl UnwindSafe for Reg16",1,["juicebox_asm::reg::Reg16"]],["impl UnwindSafe for Reg8",1,["juicebox_asm::reg::Reg8"]],["impl UnwindSafe for Runtime",1,["juicebox_asm::rt::Runtime"]],["impl UnwindSafe for MemOp",1,["juicebox_asm::MemOp"]]], "tiny_vm":[["impl UnwindSafe for PhysAddr",1,["tiny_vm::PhysAddr"]],["impl UnwindSafe for TinyReg",1,["tiny_vm::TinyReg"]],["impl UnwindSafe for TinyInsn",1,["tiny_vm::TinyInsn"]],["impl UnwindSafe for TinyVm",1,["tiny_vm::TinyVm"]],["impl UnwindSafe for Fixup",1,["tiny_vm::Fixup"]]] };if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/juicebox_asm/all.html b/juicebox_asm/all.html index fd61c52..b58db88 100644 --- a/juicebox_asm/all.html +++ b/juicebox_asm/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/juicebox_asm/asm/struct.Asm.html b/juicebox_asm/asm/struct.Asm.html new file mode 100644 index 0000000..efe1767 --- /dev/null +++ b/juicebox_asm/asm/struct.Asm.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../juicebox_asm/struct.Asm.html...

+ + + \ No newline at end of file diff --git a/juicebox_asm/enum.MemOp.html b/juicebox_asm/enum.MemOp.html index f00cfc3..aec71c8 100644 --- a/juicebox_asm/enum.MemOp.html +++ b/juicebox_asm/enum.MemOp.html @@ -1,10 +1,10 @@ -MemOp in juicebox_asm - Rust

Enum juicebox_asm::MemOp

source ·
pub enum MemOp {
-    Indirect(Reg64),
-    IndirectDisp(Reg64, i32),
+MemOp in juicebox_asm - Rust

Enum juicebox_asm::MemOp

source ·
pub enum MemOp {
+    Indirect(Reg64),
+    IndirectDisp(Reg64, i32),
 }
Expand description

Type representing a memory operand.

-

Variants§

§

Indirect(Reg64)

An indirect memory operand, eg mov [rax], rcx.

-
§

IndirectDisp(Reg64, i32)

An indirect memory operand with additional displacement, eg mov [rax + 0x10], rcx.

-

Trait Implementations§

source§

impl Add<MemOp, Imm16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Imm16)

Emit an add instruction.
source§

impl Add<MemOp, Reg16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Reg16)

Emit an add instruction.
source§

impl Cmp<MemOp, Imm16> for Asm

source§

fn cmp(&mut self, op1: MemOp, op2: Imm16)

Emit a compare call instruction.
source§

impl Mov<MemOp, Imm16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Imm16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg32> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg32)

Emit an move instruction.
source§

impl Mov<MemOp, Reg64> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg64)

Emit an move instruction.
source§

impl Mov<MemOp, Reg8> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg16, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg32, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg64, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg8, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: MemOp)

Emit an move instruction.
source§

impl Test<MemOp, Imm16> for Asm

source§

fn test(&mut self, op1: MemOp, op2: Imm16)

Emit a logical compare instruction. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for MemOp

§

impl Send for MemOp

§

impl Sync for MemOp

§

impl Unpin for MemOp

§

impl UnwindSafe for MemOp

Blanket Implementations§

source§

impl<T> Any for Twhere +

Variants§

§

Indirect(Reg64)

An indirect memory operand, eg mov [rax], rcx.

+
§

IndirectDisp(Reg64, i32)

An indirect memory operand with additional displacement, eg mov [rax + 0x10], rcx.

+

Trait Implementations§

source§

impl Add<MemOp, Imm16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Imm16)

Emit an add instruction.
source§

impl Add<MemOp, Reg16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Reg16)

Emit an add instruction.
source§

impl Cmp<MemOp, Imm16> for Asm

source§

fn cmp(&mut self, op1: MemOp, op2: Imm16)

Emit a compare instruction. Read more
source§

impl Mov<MemOp, Imm16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Imm16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg32> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg32)

Emit an move instruction.
source§

impl Mov<MemOp, Reg64> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg64)

Emit an move instruction.
source§

impl Mov<MemOp, Reg8> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg16, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg32, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg64, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg8, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: MemOp)

Emit an move instruction.
source§

impl Test<MemOp, Imm16> for Asm

source§

fn test(&mut self, op1: MemOp, op2: Imm16)

Emit a logical compare instruction. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for MemOp

§

impl Send for MemOp

§

impl Sync for MemOp

§

impl Unpin for MemOp

§

impl UnwindSafe for MemOp

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/enum.Reg16.html b/juicebox_asm/enum.Reg16.html index 6375d11..825fdf4 100644 --- a/juicebox_asm/enum.Reg16.html +++ b/juicebox_asm/enum.Reg16.html @@ -16,7 +16,7 @@ r14w, r15w,
}
Expand description

Definition of 16 bit registers.

-

Variants§

§

ax

§

cx

§

dx

§

bx

§

sp

§

bp

§

si

§

di

§

r8w

§

r9w

§

r10w

§

r11w

§

r12w

§

r13w

§

r14w

§

r15w

Trait Implementations§

source§

impl Add<MemOp, Reg16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Reg16)

Emit an add instruction.
source§

impl Clone for Reg16

source§

fn clone(&self) -> Reg16

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Mov<MemOp, Reg16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg16)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg16, Reg16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Reg16)

Emit an move instruction.
source§

impl Copy for Reg16

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg16

§

impl Send for Reg16

§

impl Sync for Reg16

§

impl Unpin for Reg16

§

impl UnwindSafe for Reg16

Blanket Implementations§

source§

impl<T> Any for Twhere +

Variants§

§

ax

§

cx

§

dx

§

bx

§

sp

§

bp

§

si

§

di

§

r8w

§

r9w

§

r10w

§

r11w

§

r12w

§

r13w

§

r14w

§

r15w

Trait Implementations§

source§

impl Add<MemOp, Reg16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Reg16)

Emit an add instruction.
source§

impl Clone for Reg16

source§

fn clone(&self) -> Reg16

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Mov<MemOp, Reg16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg16)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg16, Reg16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Reg16)

Emit an move instruction.
source§

impl Copy for Reg16

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg16

§

impl Send for Reg16

§

impl Sync for Reg16

§

impl Unpin for Reg16

§

impl UnwindSafe for Reg16

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/enum.Reg32.html b/juicebox_asm/enum.Reg32.html index 23d36ae..199deb8 100644 --- a/juicebox_asm/enum.Reg32.html +++ b/juicebox_asm/enum.Reg32.html @@ -16,7 +16,7 @@ r14d, r15d,
}
Expand description

Definition of 32 bit registers.

-

Variants§

§

eax

§

ecx

§

edx

§

ebx

§

esp

§

ebp

§

esi

§

edi

§

r8d

§

r9d

§

r10d

§

r11d

§

r12d

§

r13d

§

r14d

§

r15d

Trait Implementations§

source§

impl Add<Reg32, Reg32> for Asm

source§

fn add(&mut self, op1: Reg32, op2: Reg32)

Emit an add instruction.
source§

impl Clone for Reg32

source§

fn clone(&self) -> Reg32

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Dec<Reg32> for Asm

source§

fn dec(&mut self, op1: Reg32)

Emit a decrement instruction.
source§

impl Mov<MemOp, Reg32> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg32)

Emit an move instruction.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.
source§

impl Mov<Reg32, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg32, Reg32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Reg32)

Emit an move instruction.
source§

impl Test<Reg32, Reg32> for Asm

source§

fn test(&mut self, op1: Reg32, op2: Reg32)

Emit a logical compare instruction. Read more
source§

impl Copy for Reg32

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg32

§

impl Send for Reg32

§

impl Sync for Reg32

§

impl Unpin for Reg32

§

impl UnwindSafe for Reg32

Blanket Implementations§

source§

impl<T> Any for Twhere +

Variants§

§

eax

§

ecx

§

edx

§

ebx

§

esp

§

ebp

§

esi

§

edi

§

r8d

§

r9d

§

r10d

§

r11d

§

r12d

§

r13d

§

r14d

§

r15d

Trait Implementations§

source§

impl Add<Reg32, Reg32> for Asm

source§

fn add(&mut self, op1: Reg32, op2: Reg32)

Emit an add instruction.
source§

impl Clone for Reg32

source§

fn clone(&self) -> Reg32

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Dec<Reg32> for Asm

source§

fn dec(&mut self, op1: Reg32)

Emit a decrement instruction.
source§

impl Mov<MemOp, Reg32> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg32)

Emit an move instruction.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.
source§

impl Mov<Reg32, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg32, Reg32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Reg32)

Emit an move instruction.
source§

impl Test<Reg32, Reg32> for Asm

source§

fn test(&mut self, op1: Reg32, op2: Reg32)

Emit a logical compare instruction. Read more
source§

impl Copy for Reg32

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg32

§

impl Send for Reg32

§

impl Sync for Reg32

§

impl Unpin for Reg32

§

impl UnwindSafe for Reg32

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/enum.Reg64.html b/juicebox_asm/enum.Reg64.html index 2e7537e..6c99dc0 100644 --- a/juicebox_asm/enum.Reg64.html +++ b/juicebox_asm/enum.Reg64.html @@ -16,7 +16,7 @@ r14, r15,
}
Expand description

Definition of 64 bit registers.

-

Variants§

§

rax

§

rcx

§

rdx

§

rbx

§

rsp

§

rbp

§

rsi

§

rdi

§

r8

§

r9

§

r10

§

r11

§

r12

§

r13

§

r14

§

r15

Trait Implementations§

source§

impl Add<Reg64, Reg64> for Asm

source§

fn add(&mut self, op1: Reg64, op2: Reg64)

Emit an add instruction.
source§

impl Call<Reg64> for Asm

source§

fn call(&mut self, op1: Reg64)

Emit a call instruction.
source§

impl Clone for Reg64

source§

fn clone(&self) -> Reg64

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Dec<Reg64> for Asm

source§

fn dec(&mut self, op1: Reg64)

Emit a decrement instruction.
source§

impl Mov<MemOp, Reg64> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg64)

Emit an move instruction.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.
source§

impl Mov<Reg64, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg64, Reg64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Reg64)

Emit an move instruction.
source§

impl Test<Reg64, Reg64> for Asm

source§

fn test(&mut self, op1: Reg64, op2: Reg64)

Emit a logical compare instruction. Read more
source§

impl Copy for Reg64

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg64

§

impl Send for Reg64

§

impl Sync for Reg64

§

impl Unpin for Reg64

§

impl UnwindSafe for Reg64

Blanket Implementations§

source§

impl<T> Any for Twhere +

Variants§

§

rax

§

rcx

§

rdx

§

rbx

§

rsp

§

rbp

§

rsi

§

rdi

§

r8

§

r9

§

r10

§

r11

§

r12

§

r13

§

r14

§

r15

Trait Implementations§

source§

impl Add<Reg64, Reg64> for Asm

source§

fn add(&mut self, op1: Reg64, op2: Reg64)

Emit an add instruction.
source§

impl Call<Reg64> for Asm

source§

fn call(&mut self, op1: Reg64)

Emit a call instruction.
source§

impl Clone for Reg64

source§

fn clone(&self) -> Reg64

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Dec<Reg64> for Asm

source§

fn dec(&mut self, op1: Reg64)

Emit a decrement instruction.
source§

impl Mov<MemOp, Reg64> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg64)

Emit an move instruction.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.
source§

impl Mov<Reg64, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg64, Reg64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Reg64)

Emit an move instruction.
source§

impl Test<Reg64, Reg64> for Asm

source§

fn test(&mut self, op1: Reg64, op2: Reg64)

Emit a logical compare instruction. Read more
source§

impl Copy for Reg64

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg64

§

impl Send for Reg64

§

impl Sync for Reg64

§

impl Unpin for Reg64

§

impl UnwindSafe for Reg64

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/enum.Reg8.html b/juicebox_asm/enum.Reg8.html index 5f0bf26..132cb00 100644 --- a/juicebox_asm/enum.Reg8.html +++ b/juicebox_asm/enum.Reg8.html @@ -20,7 +20,7 @@ dh, bh,
}
Expand description

Definition of 8 bit registers.

-

Variants§

§

al

§

cl

§

dl

§

bl

§

spl

§

bpl

§

sil

§

dil

§

r8l

§

r9l

§

r10l

§

r11l

§

r12l

§

r13l

§

r14l

§

r15l

§

ah

§

ch

§

dh

§

bh

Trait Implementations§

source§

impl Clone for Reg8

source§

fn clone(&self) -> Reg8

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Mov<MemOp, Reg8> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.
source§

impl Mov<Reg8, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg8, Reg8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Reg8)

Emit an move instruction.
source§

impl Copy for Reg8

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg8

§

impl Send for Reg8

§

impl Sync for Reg8

§

impl Unpin for Reg8

§

impl UnwindSafe for Reg8

Blanket Implementations§

source§

impl<T> Any for Twhere +

Variants§

§

al

§

cl

§

dl

§

bl

§

spl

§

bpl

§

sil

§

dil

§

r8l

§

r9l

§

r10l

§

r11l

§

r12l

§

r13l

§

r14l

§

r15l

§

ah

§

ch

§

dh

§

bh

Trait Implementations§

source§

impl Clone for Reg8

source§

fn clone(&self) -> Reg8

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Mov<MemOp, Reg8> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.
source§

impl Mov<Reg8, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg8, Reg8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Reg8)

Emit an move instruction.
source§

impl Copy for Reg8

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg8

§

impl Send for Reg8

§

impl Sync for Reg8

§

impl Unpin for Reg8

§

impl UnwindSafe for Reg8

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/imm/struct.Imm16.html b/juicebox_asm/imm/struct.Imm16.html index fbefc82..3234145 100644 --- a/juicebox_asm/imm/struct.Imm16.html +++ b/juicebox_asm/imm/struct.Imm16.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/struct.Imm16.html...

- +

Redirecting to ../../juicebox_asm/struct.Imm16.html...

+ \ No newline at end of file diff --git a/juicebox_asm/imm/struct.Imm32.html b/juicebox_asm/imm/struct.Imm32.html index c310b67..678f060 100644 --- a/juicebox_asm/imm/struct.Imm32.html +++ b/juicebox_asm/imm/struct.Imm32.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/struct.Imm32.html...

- +

Redirecting to ../../juicebox_asm/struct.Imm32.html...

+ \ No newline at end of file diff --git a/juicebox_asm/imm/struct.Imm64.html b/juicebox_asm/imm/struct.Imm64.html index 9a2ebea..2497546 100644 --- a/juicebox_asm/imm/struct.Imm64.html +++ b/juicebox_asm/imm/struct.Imm64.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/struct.Imm64.html...

- +

Redirecting to ../../juicebox_asm/struct.Imm64.html...

+ \ No newline at end of file diff --git a/juicebox_asm/imm/struct.Imm8.html b/juicebox_asm/imm/struct.Imm8.html index bda16d4..c53d44c 100644 --- a/juicebox_asm/imm/struct.Imm8.html +++ b/juicebox_asm/imm/struct.Imm8.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/struct.Imm8.html...

- +

Redirecting to ../../juicebox_asm/struct.Imm8.html...

+ \ No newline at end of file diff --git a/juicebox_asm/index.html b/juicebox_asm/index.html index d3198b3..d6639eb 100644 --- a/juicebox_asm/index.html +++ b/juicebox_asm/index.html @@ -1,7 +1,8 @@ -juicebox_asm - Rust

Crate juicebox_asm

source ·
Expand description

A simple x64 jit assembler with a minimal runtime to execute emitted code for fun.

+juicebox_asm - Rust

Crate juicebox_asm

source ·
Expand description

A simple x64 jit assembler with a minimal runtime to execute emitted code for fun.

The following is an fibonacci example implementation.

-
use juicebox_asm::prelude::*;
+
use juicebox_asm::{Asm, Reg64, Imm64, Label};
+use juicebox_asm::insn::*;
 use juicebox_asm::Runtime;
 
 const fn fib_rs(n: u64) -> u64 {
@@ -69,4 +70,4 @@
         assert_eq!(fib_jit, fib_rs(n));
     }
 }
-

Modules

  • Crate prelude, which can be used to import the most important types at once.

Structs

  • x64 jit assembler.
  • Type representing an 8 bit immediate.
  • Type representing a 16 bit immediate.
  • Type representing a 32 bit immediate.
  • Type representing a 64 bit immediate.
  • A label which is used as target for jump instructions.
  • A simple mmaped runtime with executable pages.

Enums

  • Type representing a memory operand.
  • Definition of 8 bit registers.
  • Definition of 16 bit registers.
  • Definition of 32 bit registers.
  • Definition of 64 bit registers.
\ No newline at end of file +

Modules

  • Trait definitions of various instructions.

Structs

  • x64 jit assembler.
  • Type representing an 8 bit immediate.
  • Type representing a 16 bit immediate.
  • Type representing a 32 bit immediate.
  • Type representing a 64 bit immediate.
  • A label which is used as target for jump instructions.
  • A simple mmaped runtime with executable pages.

Enums

  • Type representing a memory operand.
  • Definition of 8 bit registers.
  • Definition of 16 bit registers.
  • Definition of 32 bit registers.
  • Definition of 64 bit registers.
\ No newline at end of file diff --git a/juicebox_asm/insn/index.html b/juicebox_asm/insn/index.html new file mode 100644 index 0000000..f440fba --- /dev/null +++ b/juicebox_asm/insn/index.html @@ -0,0 +1,2 @@ +juicebox_asm::insn - Rust

Module juicebox_asm::insn

source ·
Expand description

Trait definitions of various instructions.

+

Traits

  • Trait for add instruction kinds.
  • Trait for call instruction kinds.
  • Trait for cmp instruction kinds.
  • Trait for dec instruction kinds.
  • Trait for jmp instruction kinds.
  • Trait for jnz instruction kinds.
  • Trait for jz instruction kinds.
  • Trait for mov instruction kinds.
  • Trait for test instruction kinds.
\ No newline at end of file diff --git a/juicebox_asm/insn/sidebar-items.js b/juicebox_asm/insn/sidebar-items.js new file mode 100644 index 0000000..140fc4e --- /dev/null +++ b/juicebox_asm/insn/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"trait":["Add","Call","Cmp","Dec","Jmp","Jnz","Jz","Mov","Test"]}; \ No newline at end of file diff --git a/juicebox_asm/insn/trait.Add.html b/juicebox_asm/insn/trait.Add.html index 4dbbe06..06adc65 100644 --- a/juicebox_asm/insn/trait.Add.html +++ b/juicebox_asm/insn/trait.Add.html @@ -1,11 +1,6 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Add.html...

- - - \ No newline at end of file +Add in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Add

source ·
pub trait Add<T, U> {
+    // Required method
+    fn add(&mut self, op1: T, op2: U);
+}
Expand description

Trait for add instruction kinds.

+

Required Methods§

source

fn add(&mut self, op1: T, op2: U)

Emit an add instruction.

+

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Call.html b/juicebox_asm/insn/trait.Call.html index 6bc842e..00b613f 100644 --- a/juicebox_asm/insn/trait.Call.html +++ b/juicebox_asm/insn/trait.Call.html @@ -1,11 +1,6 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Call.html...

- - - \ No newline at end of file +Call in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Call

source ·
pub trait Call<T> {
+    // Required method
+    fn call(&mut self, op1: T);
+}
Expand description

Trait for call instruction kinds.

+

Required Methods§

source

fn call(&mut self, op1: T)

Emit a call instruction.

+

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Cmp.html b/juicebox_asm/insn/trait.Cmp.html index b685490..3f88e11 100644 --- a/juicebox_asm/insn/trait.Cmp.html +++ b/juicebox_asm/insn/trait.Cmp.html @@ -1,11 +1,8 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Cmp.html...

- - - \ No newline at end of file +Cmp in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Cmp

source ·
pub trait Cmp<T, U> {
+    // Required method
+    fn cmp(&mut self, op1: T, op2: U);
+}
Expand description

Trait for cmp instruction kinds.

+

Required Methods§

source

fn cmp(&mut self, op1: T, op2: U)

Emit a compare instruction.

+

Computes op2 - op1 and sets the status flags in the same way as the sub instruction, +the result is discarded.

+

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Dec.html b/juicebox_asm/insn/trait.Dec.html index 9a2b82d..e8c6042 100644 --- a/juicebox_asm/insn/trait.Dec.html +++ b/juicebox_asm/insn/trait.Dec.html @@ -1,11 +1,6 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Dec.html...

- - - \ No newline at end of file +Dec in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Dec

source ·
pub trait Dec<T> {
+    // Required method
+    fn dec(&mut self, op1: T);
+}
Expand description

Trait for dec instruction kinds.

+

Required Methods§

source

fn dec(&mut self, op1: T)

Emit a decrement instruction.

+

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Jmp.html b/juicebox_asm/insn/trait.Jmp.html index 2f3bf40..9b01a30 100644 --- a/juicebox_asm/insn/trait.Jmp.html +++ b/juicebox_asm/insn/trait.Jmp.html @@ -1,11 +1,6 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Jmp.html...

- - - \ No newline at end of file +Jmp in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Jmp

source ·
pub trait Jmp<T> {
+    // Required method
+    fn jmp(&mut self, op1: T);
+}
Expand description

Trait for jmp instruction kinds.

+

Required Methods§

source

fn jmp(&mut self, op1: T)

Emit an unconditional jump instruction.

+

Implementors§

source§

impl Jmp<&mut Label> for Asm

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Jnz.html b/juicebox_asm/insn/trait.Jnz.html index 7692604..9031e08 100644 --- a/juicebox_asm/insn/trait.Jnz.html +++ b/juicebox_asm/insn/trait.Jnz.html @@ -1,11 +1,6 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Jnz.html...

- - - \ No newline at end of file +Jnz in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Jnz

source ·
pub trait Jnz<T> {
+    // Required method
+    fn jnz(&mut self, op1: T);
+}
Expand description

Trait for jnz instruction kinds.

+

Required Methods§

source

fn jnz(&mut self, op1: T)

Emit a conditional jump if not zero instruction (ZF = 0).

+

Implementors§

source§

impl Jnz<&mut Label> for Asm

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Jz.html b/juicebox_asm/insn/trait.Jz.html index 05a2555..fc6e391 100644 --- a/juicebox_asm/insn/trait.Jz.html +++ b/juicebox_asm/insn/trait.Jz.html @@ -1,11 +1,6 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Jz.html...

- - - \ No newline at end of file +Jz in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Jz

source ·
pub trait Jz<T> {
+    // Required method
+    fn jz(&mut self, op1: T);
+}
Expand description

Trait for jz instruction kinds.

+

Required Methods§

source

fn jz(&mut self, op1: T)

Emit a conditional jump if zero instruction (ZF = 1).

+

Implementors§

source§

impl Jz<&mut Label> for Asm

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Mov.html b/juicebox_asm/insn/trait.Mov.html index fdbd208..2022b18 100644 --- a/juicebox_asm/insn/trait.Mov.html +++ b/juicebox_asm/insn/trait.Mov.html @@ -1,11 +1,6 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Mov.html...

- - - \ No newline at end of file +Mov in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Mov

source ·
pub trait Mov<T, U> {
+    // Required method
+    fn mov(&mut self, op1: T, op2: U);
+}
Expand description

Trait for mov instruction kinds.

+

Required Methods§

source

fn mov(&mut self, op1: T, op2: U)

Emit an move instruction.

+

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/insn/trait.Test.html b/juicebox_asm/insn/trait.Test.html index 323461d..19da176 100644 --- a/juicebox_asm/insn/trait.Test.html +++ b/juicebox_asm/insn/trait.Test.html @@ -1,11 +1,8 @@ - - - - - Redirection - - -

Redirecting to ../../juicebox_asm/prelude/trait.Test.html...

- - - \ No newline at end of file +Test in juicebox_asm::insn - Rust

Trait juicebox_asm::insn::Test

source ·
pub trait Test<T, U> {
+    // Required method
+    fn test(&mut self, op1: T, op2: U);
+}
Expand description

Trait for test instruction kinds.

+

Required Methods§

source

fn test(&mut self, op1: T, op2: U)

Emit a logical compare instruction.

+

Computes the bit-wise logical AND of first operand and the second operand and sets the +SF, ZF, and PF status flags, the result is discarded.

+

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/label/struct.Label.html b/juicebox_asm/label/struct.Label.html index 7f69439..fe7146c 100644 --- a/juicebox_asm/label/struct.Label.html +++ b/juicebox_asm/label/struct.Label.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/struct.Label.html...

- +

Redirecting to ../../juicebox_asm/struct.Label.html...

+ \ No newline at end of file diff --git a/juicebox_asm/prelude/enum.Reg16.html b/juicebox_asm/prelude/enum.Reg16.html deleted file mode 100644 index 4c9aab2..0000000 --- a/juicebox_asm/prelude/enum.Reg16.html +++ /dev/null @@ -1,30 +0,0 @@ -Reg16 in juicebox_asm::prelude - Rust
#[repr(u8)]
pub enum Reg16 { -
Show 16 variants ax, - cx, - dx, - bx, - sp, - bp, - si, - di, - r8w, - r9w, - r10w, - r11w, - r12w, - r13w, - r14w, - r15w, -
}
Expand description

Definition of 16 bit registers.

-

Variants§

§

ax

§

cx

§

dx

§

bx

§

sp

§

bp

§

si

§

di

§

r8w

§

r9w

§

r10w

§

r11w

§

r12w

§

r13w

§

r14w

§

r15w

Trait Implementations§

source§

impl Add<MemOp, Reg16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Reg16)

Emit an add instruction.
source§

impl Clone for Reg16

source§

fn clone(&self) -> Reg16

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Mov<MemOp, Reg16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg16)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg16, Reg16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Reg16)

Emit an move instruction.
source§

impl Copy for Reg16

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg16

§

impl Send for Reg16

§

impl Sync for Reg16

§

impl Unpin for Reg16

§

impl UnwindSafe for Reg16

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T> ToOwned for Twhere - T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/enum.Reg32.html b/juicebox_asm/prelude/enum.Reg32.html deleted file mode 100644 index e99bafd..0000000 --- a/juicebox_asm/prelude/enum.Reg32.html +++ /dev/null @@ -1,30 +0,0 @@ -Reg32 in juicebox_asm::prelude - Rust
#[repr(u8)]
pub enum Reg32 { -
Show 16 variants eax, - ecx, - edx, - ebx, - esp, - ebp, - esi, - edi, - r8d, - r9d, - r10d, - r11d, - r12d, - r13d, - r14d, - r15d, -
}
Expand description

Definition of 32 bit registers.

-

Variants§

§

eax

§

ecx

§

edx

§

ebx

§

esp

§

ebp

§

esi

§

edi

§

r8d

§

r9d

§

r10d

§

r11d

§

r12d

§

r13d

§

r14d

§

r15d

Trait Implementations§

source§

impl Add<Reg32, Reg32> for Asm

source§

fn add(&mut self, op1: Reg32, op2: Reg32)

Emit an add instruction.
source§

impl Clone for Reg32

source§

fn clone(&self) -> Reg32

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Dec<Reg32> for Asm

source§

fn dec(&mut self, op1: Reg32)

Emit a decrement instruction.
source§

impl Mov<MemOp, Reg32> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg32)

Emit an move instruction.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.
source§

impl Mov<Reg32, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg32, Reg32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Reg32)

Emit an move instruction.
source§

impl Test<Reg32, Reg32> for Asm

source§

fn test(&mut self, op1: Reg32, op2: Reg32)

Emit a logical compare instruction. Read more
source§

impl Copy for Reg32

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg32

§

impl Send for Reg32

§

impl Sync for Reg32

§

impl Unpin for Reg32

§

impl UnwindSafe for Reg32

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T> ToOwned for Twhere - T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/enum.Reg64.html b/juicebox_asm/prelude/enum.Reg64.html deleted file mode 100644 index c8078b6..0000000 --- a/juicebox_asm/prelude/enum.Reg64.html +++ /dev/null @@ -1,30 +0,0 @@ -Reg64 in juicebox_asm::prelude - Rust
#[repr(u8)]
pub enum Reg64 { -
Show 16 variants rax, - rcx, - rdx, - rbx, - rsp, - rbp, - rsi, - rdi, - r8, - r9, - r10, - r11, - r12, - r13, - r14, - r15, -
}
Expand description

Definition of 64 bit registers.

-

Variants§

§

rax

§

rcx

§

rdx

§

rbx

§

rsp

§

rbp

§

rsi

§

rdi

§

r8

§

r9

§

r10

§

r11

§

r12

§

r13

§

r14

§

r15

Trait Implementations§

source§

impl Add<Reg64, Reg64> for Asm

source§

fn add(&mut self, op1: Reg64, op2: Reg64)

Emit an add instruction.
source§

impl Call<Reg64> for Asm

source§

fn call(&mut self, op1: Reg64)

Emit a call instruction.
source§

impl Clone for Reg64

source§

fn clone(&self) -> Reg64

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Dec<Reg64> for Asm

source§

fn dec(&mut self, op1: Reg64)

Emit a decrement instruction.
source§

impl Mov<MemOp, Reg64> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg64)

Emit an move instruction.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.
source§

impl Mov<Reg64, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg64, Reg64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Reg64)

Emit an move instruction.
source§

impl Test<Reg64, Reg64> for Asm

source§

fn test(&mut self, op1: Reg64, op2: Reg64)

Emit a logical compare instruction. Read more
source§

impl Copy for Reg64

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg64

§

impl Send for Reg64

§

impl Sync for Reg64

§

impl Unpin for Reg64

§

impl UnwindSafe for Reg64

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T> ToOwned for Twhere - T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/enum.Reg8.html b/juicebox_asm/prelude/enum.Reg8.html deleted file mode 100644 index 3e6ecb5..0000000 --- a/juicebox_asm/prelude/enum.Reg8.html +++ /dev/null @@ -1,34 +0,0 @@ -Reg8 in juicebox_asm::prelude - Rust
#[repr(u8)]
pub enum Reg8 { -
Show 20 variants al, - cl, - dl, - bl, - spl, - bpl, - sil, - dil, - r8l, - r9l, - r10l, - r11l, - r12l, - r13l, - r14l, - r15l, - ah, - ch, - dh, - bh, -
}
Expand description

Definition of 8 bit registers.

-

Variants§

§

al

§

cl

§

dl

§

bl

§

spl

§

bpl

§

sil

§

dil

§

r8l

§

r9l

§

r10l

§

r11l

§

r12l

§

r13l

§

r14l

§

r15l

§

ah

§

ch

§

dh

§

bh

Trait Implementations§

source§

impl Clone for Reg8

source§

fn clone(&self) -> Reg8

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Mov<MemOp, Reg8> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.
source§

impl Mov<Reg8, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg8, Reg8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Reg8)

Emit an move instruction.
source§

impl Copy for Reg8

Auto Trait Implementations§

§

impl RefUnwindSafe for Reg8

§

impl Send for Reg8

§

impl Sync for Reg8

§

impl Unpin for Reg8

§

impl UnwindSafe for Reg8

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T> ToOwned for Twhere - T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/index.html b/juicebox_asm/prelude/index.html deleted file mode 100644 index 4adb8ff..0000000 --- a/juicebox_asm/prelude/index.html +++ /dev/null @@ -1,2 +0,0 @@ -juicebox_asm::prelude - Rust

Module juicebox_asm::prelude

source ·
Expand description

Crate prelude, which can be used to import the most important types at once.

-

Re-exports

  • pub use crate::Asm;
  • pub use crate::MemOp;

Structs

  • Type representing an 8 bit immediate.
  • Type representing a 16 bit immediate.
  • Type representing a 32 bit immediate.
  • Type representing a 64 bit immediate.
  • A label which is used as target for jump instructions.

Enums

  • Definition of 8 bit registers.
  • Definition of 16 bit registers.
  • Definition of 32 bit registers.
  • Definition of 64 bit registers.

Traits

\ No newline at end of file diff --git a/juicebox_asm/prelude/sidebar-items.js b/juicebox_asm/prelude/sidebar-items.js deleted file mode 100644 index ab40e13..0000000 --- a/juicebox_asm/prelude/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"enum":["Reg16","Reg32","Reg64","Reg8"],"struct":["Imm16","Imm32","Imm64","Imm8","Label"],"trait":["Add","Call","Cmp","Dec","Jmp","Jnz","Jz","Mov","Test"]}; \ No newline at end of file diff --git a/juicebox_asm/prelude/struct.Imm16.html b/juicebox_asm/prelude/struct.Imm16.html deleted file mode 100644 index 0309d87..0000000 --- a/juicebox_asm/prelude/struct.Imm16.html +++ /dev/null @@ -1,12 +0,0 @@ -Imm16 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm16

source ·
pub struct Imm16(/* private fields */);
Expand description

Type representing a 16 bit immediate.

-

Trait Implementations§

source§

impl Add<MemOp, Imm16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Imm16)

Emit an add instruction.
source§

impl Cmp<MemOp, Imm16> for Asm

source§

fn cmp(&mut self, op1: MemOp, op2: Imm16)

Emit a compare call instruction.
source§

impl From<i16> for Imm16

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm16

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm16

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm16

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<MemOp, Imm16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Test<MemOp, Imm16> for Asm

source§

fn test(&mut self, op1: MemOp, op2: Imm16)

Emit a logical compare instruction. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm16

§

impl Send for Imm16

§

impl Sync for Imm16

§

impl Unpin for Imm16

§

impl UnwindSafe for Imm16

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/struct.Imm32.html b/juicebox_asm/prelude/struct.Imm32.html deleted file mode 100644 index 42ec8c2..0000000 --- a/juicebox_asm/prelude/struct.Imm32.html +++ /dev/null @@ -1,12 +0,0 @@ -Imm32 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm32

source ·
pub struct Imm32(/* private fields */);
Expand description

Type representing a 32 bit immediate.

-

Trait Implementations§

source§

impl From<i16> for Imm32

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Imm32

source§

fn from(imm: i32) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm32

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm32

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Imm32

source§

fn from(imm: u32) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm32

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm32

§

impl Send for Imm32

§

impl Sync for Imm32

§

impl Unpin for Imm32

§

impl UnwindSafe for Imm32

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/struct.Imm64.html b/juicebox_asm/prelude/struct.Imm64.html deleted file mode 100644 index 98f129a..0000000 --- a/juicebox_asm/prelude/struct.Imm64.html +++ /dev/null @@ -1,12 +0,0 @@ -Imm64 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm64

source ·
pub struct Imm64(/* private fields */);
Expand description

Type representing a 64 bit immediate.

-

Trait Implementations§

source§

impl From<i16> for Imm64

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Imm64

source§

fn from(imm: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Imm64

source§

fn from(imm: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm64

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm64

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Imm64

source§

fn from(imm: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Imm64

source§

fn from(imm: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm64

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm64

§

impl Send for Imm64

§

impl Sync for Imm64

§

impl Unpin for Imm64

§

impl UnwindSafe for Imm64

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/struct.Imm8.html b/juicebox_asm/prelude/struct.Imm8.html deleted file mode 100644 index 974183b..0000000 --- a/juicebox_asm/prelude/struct.Imm8.html +++ /dev/null @@ -1,12 +0,0 @@ -Imm8 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm8

source ·
pub struct Imm8(/* private fields */);
Expand description

Type representing an 8 bit immediate.

-

Trait Implementations§

source§

impl From<i8> for Imm8

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm8

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm8

§

impl Send for Imm8

§

impl Sync for Imm8

§

impl Unpin for Imm8

§

impl UnwindSafe for Imm8

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/struct.Label.html b/juicebox_asm/prelude/struct.Label.html deleted file mode 100644 index f54ec7b..0000000 --- a/juicebox_asm/prelude/struct.Label.html +++ /dev/null @@ -1,26 +0,0 @@ -Label in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Label

source ·
pub struct Label { /* private fields */ }
Expand description

A label which is used as target for jump instructions.

- -
use juicebox_asm::prelude::*;
-
-let mut lbl = Label::new();
-let mut asm = Asm::new();
-
-// Skip the mov instruction.
-asm.jmp(&mut lbl);
-asm.mov(Reg64::rax, Reg64::rax);
-asm.bind(&mut lbl);
-

Panics

-

Panics if the label is dropped while not yet bound, or having unresolved relocations. -This is mainly a safety-guard to detect wrong usage.

-

Implementations§

source§

impl Label

source

pub fn new() -> Label

Create a new unbound Label.

-

Trait Implementations§

source§

impl Drop for Label

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Jmp<&mut Label> for Asm

source§

fn jmp(&mut self, op1: &mut Label)

Emit an unconditional jump instruction.
source§

impl Jnz<&mut Label> for Asm

source§

fn jnz(&mut self, op1: &mut Label)

Emit a conditional jump if not zero instruction (ZF = 0).
source§

impl Jz<&mut Label> for Asm

source§

fn jz(&mut self, op1: &mut Label)

Emit a conditional jump if zero instruction (ZF = 1).

Auto Trait Implementations§

§

impl RefUnwindSafe for Label

§

impl Send for Label

§

impl Sync for Label

§

impl Unpin for Label

§

impl UnwindSafe for Label

Blanket Implementations§

source§

impl<T> Any for Twhere - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for Twhere - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T, U> TryFrom<U> for Twhere - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Add.html b/juicebox_asm/prelude/trait.Add.html deleted file mode 100644 index 0a0d048..0000000 --- a/juicebox_asm/prelude/trait.Add.html +++ /dev/null @@ -1,5 +0,0 @@ -Add in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Add

source ·
pub trait Add<T, U> {
-    // Required method
-    fn add(&mut self, op1: T, op2: U);
-}

Required Methods§

source

fn add(&mut self, op1: T, op2: U)

Emit an add instruction.

-

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Call.html b/juicebox_asm/prelude/trait.Call.html deleted file mode 100644 index 3cf1cfc..0000000 --- a/juicebox_asm/prelude/trait.Call.html +++ /dev/null @@ -1,5 +0,0 @@ -Call in juicebox_asm::prelude - Rust
pub trait Call<T> {
-    // Required method
-    fn call(&mut self, op1: T);
-}

Required Methods§

source

fn call(&mut self, op1: T)

Emit a call instruction.

-

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Cmp.html b/juicebox_asm/prelude/trait.Cmp.html deleted file mode 100644 index 872e354..0000000 --- a/juicebox_asm/prelude/trait.Cmp.html +++ /dev/null @@ -1,5 +0,0 @@ -Cmp in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Cmp

source ·
pub trait Cmp<T, U> {
-    // Required method
-    fn cmp(&mut self, op1: T, op2: U);
-}

Required Methods§

source

fn cmp(&mut self, op1: T, op2: U)

Emit a compare call instruction.

-

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Dec.html b/juicebox_asm/prelude/trait.Dec.html deleted file mode 100644 index 893b625..0000000 --- a/juicebox_asm/prelude/trait.Dec.html +++ /dev/null @@ -1,5 +0,0 @@ -Dec in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Dec

source ·
pub trait Dec<T> {
-    // Required method
-    fn dec(&mut self, op1: T);
-}

Required Methods§

source

fn dec(&mut self, op1: T)

Emit a decrement instruction.

-

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Jmp.html b/juicebox_asm/prelude/trait.Jmp.html deleted file mode 100644 index c47aa81..0000000 --- a/juicebox_asm/prelude/trait.Jmp.html +++ /dev/null @@ -1,5 +0,0 @@ -Jmp in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jmp

source ·
pub trait Jmp<T> {
-    // Required method
-    fn jmp(&mut self, op1: T);
-}

Required Methods§

source

fn jmp(&mut self, op1: T)

Emit an unconditional jump instruction.

-

Implementors§

source§

impl Jmp<&mut Label> for Asm

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Jnz.html b/juicebox_asm/prelude/trait.Jnz.html deleted file mode 100644 index 980bc93..0000000 --- a/juicebox_asm/prelude/trait.Jnz.html +++ /dev/null @@ -1,5 +0,0 @@ -Jnz in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jnz

source ·
pub trait Jnz<T> {
-    // Required method
-    fn jnz(&mut self, op1: T);
-}

Required Methods§

source

fn jnz(&mut self, op1: T)

Emit a conditional jump if not zero instruction (ZF = 0).

-

Implementors§

source§

impl Jnz<&mut Label> for Asm

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Jz.html b/juicebox_asm/prelude/trait.Jz.html deleted file mode 100644 index b19e629..0000000 --- a/juicebox_asm/prelude/trait.Jz.html +++ /dev/null @@ -1,5 +0,0 @@ -Jz in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jz

source ·
pub trait Jz<T> {
-    // Required method
-    fn jz(&mut self, op1: T);
-}

Required Methods§

source

fn jz(&mut self, op1: T)

Emit a conditional jump if zero instruction (ZF = 1).

-

Implementors§

source§

impl Jz<&mut Label> for Asm

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Mov.html b/juicebox_asm/prelude/trait.Mov.html deleted file mode 100644 index 7572ad6..0000000 --- a/juicebox_asm/prelude/trait.Mov.html +++ /dev/null @@ -1,5 +0,0 @@ -Mov in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Mov

source ·
pub trait Mov<T, U> {
-    // Required method
-    fn mov(&mut self, op1: T, op2: U);
-}

Required Methods§

source

fn mov(&mut self, op1: T, op2: U)

Emit an move instruction.

-

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Test.html b/juicebox_asm/prelude/trait.Test.html deleted file mode 100644 index 9ea9d85..0000000 --- a/juicebox_asm/prelude/trait.Test.html +++ /dev/null @@ -1,7 +0,0 @@ -Test in juicebox_asm::prelude - Rust
pub trait Test<T, U> {
-    // Required method
-    fn test(&mut self, op1: T, op2: U);
-}

Required Methods§

source

fn test(&mut self, op1: T, op2: U)

Emit a logical compare instruction.

-

Computes the bit-wise logical AND of first operand and the second operand and sets the -SF, ZF, and PF status flags, the result is discarded.

-

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/reg/enum.Reg16.html b/juicebox_asm/reg/enum.Reg16.html index d506c7f..1e209ce 100644 --- a/juicebox_asm/reg/enum.Reg16.html +++ b/juicebox_asm/reg/enum.Reg16.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/enum.Reg16.html...

- +

Redirecting to ../../juicebox_asm/enum.Reg16.html...

+ \ No newline at end of file diff --git a/juicebox_asm/reg/enum.Reg32.html b/juicebox_asm/reg/enum.Reg32.html index 79cfaf5..7488b07 100644 --- a/juicebox_asm/reg/enum.Reg32.html +++ b/juicebox_asm/reg/enum.Reg32.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/enum.Reg32.html...

- +

Redirecting to ../../juicebox_asm/enum.Reg32.html...

+ \ No newline at end of file diff --git a/juicebox_asm/reg/enum.Reg64.html b/juicebox_asm/reg/enum.Reg64.html index 0fff5d7..c843bd2 100644 --- a/juicebox_asm/reg/enum.Reg64.html +++ b/juicebox_asm/reg/enum.Reg64.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/enum.Reg64.html...

- +

Redirecting to ../../juicebox_asm/enum.Reg64.html...

+ \ No newline at end of file diff --git a/juicebox_asm/reg/enum.Reg8.html b/juicebox_asm/reg/enum.Reg8.html index 339c6e5..73f4abd 100644 --- a/juicebox_asm/reg/enum.Reg8.html +++ b/juicebox_asm/reg/enum.Reg8.html @@ -1,11 +1,11 @@ - + Redirection -

Redirecting to ../../juicebox_asm/prelude/enum.Reg8.html...

- +

Redirecting to ../../juicebox_asm/enum.Reg8.html...

+ \ No newline at end of file diff --git a/juicebox_asm/sidebar-items.js b/juicebox_asm/sidebar-items.js index 199a7d9..519ac50 100644 --- a/juicebox_asm/sidebar-items.js +++ b/juicebox_asm/sidebar-items.js @@ -1 +1 @@ -window.SIDEBAR_ITEMS = {"enum":["MemOp","Reg16","Reg32","Reg64","Reg8"],"mod":["prelude"],"struct":["Asm","Imm16","Imm32","Imm64","Imm8","Label","Runtime"]}; \ No newline at end of file +window.SIDEBAR_ITEMS = {"enum":["MemOp","Reg16","Reg32","Reg64","Reg8"],"mod":["insn"],"struct":["Asm","Imm16","Imm32","Imm64","Imm8","Label","Runtime"]}; \ No newline at end of file diff --git a/juicebox_asm/struct.Asm.html b/juicebox_asm/struct.Asm.html index 8ca2b50..e4eaf87 100644 --- a/juicebox_asm/struct.Asm.html +++ b/juicebox_asm/struct.Asm.html @@ -1,9 +1,10 @@ -Asm in juicebox_asm - Rust

Struct juicebox_asm::Asm

source ·
pub struct Asm { /* private fields */ }
Expand description

x64 jit assembler.

-

Implementations§

source§

impl Asm

source

pub fn nop(&mut self)

source§

impl Asm

source

pub fn ret(&mut self)

source§

impl Asm

source

pub fn new() -> Asm

Create a new x64 jit assembler.

-
source

pub fn into_code(self) -> Vec<u8>

Consume the assembler and get the emitted code.

-
source

pub fn bind(&mut self, label: &mut Label)

Bind the Label to the current location.

-
source

pub fn resolve(&mut self, label: &mut Label)

If the Label is bound, patch any pending relocation.

-

Trait Implementations§

source§

impl Add<MemOp, Imm16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Imm16)

Emit an add instruction.
source§

impl Add<MemOp, Reg16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Reg16)

Emit an add instruction.
source§

impl Add<Reg32, Reg32> for Asm

source§

fn add(&mut self, op1: Reg32, op2: Reg32)

Emit an add instruction.
source§

impl Add<Reg64, Reg64> for Asm

source§

fn add(&mut self, op1: Reg64, op2: Reg64)

Emit an add instruction.
source§

impl Call<Reg64> for Asm

source§

fn call(&mut self, op1: Reg64)

Emit a call instruction.
source§

impl Cmp<MemOp, Imm16> for Asm

source§

fn cmp(&mut self, op1: MemOp, op2: Imm16)

Emit a compare call instruction.
source§

impl Dec<Reg32> for Asm

source§

fn dec(&mut self, op1: Reg32)

Emit a decrement instruction.
source§

impl Dec<Reg64> for Asm

source§

fn dec(&mut self, op1: Reg64)

Emit a decrement instruction.
source§

impl Jmp<&mut Label> for Asm

source§

fn jmp(&mut self, op1: &mut Label)

Emit an unconditional jump instruction.
source§

impl Jnz<&mut Label> for Asm

source§

fn jnz(&mut self, op1: &mut Label)

Emit a conditional jump if not zero instruction (ZF = 0).
source§

impl Jz<&mut Label> for Asm

source§

fn jz(&mut self, op1: &mut Label)

Emit a conditional jump if zero instruction (ZF = 1).
source§

impl Mov<MemOp, Imm16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Imm16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg32> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg32)

Emit an move instruction.
source§

impl Mov<MemOp, Reg64> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg64)

Emit an move instruction.
source§

impl Mov<MemOp, Reg8> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg16, Reg16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Reg16)

Emit an move instruction.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.
source§

impl Mov<Reg32, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg32, Reg32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Reg32)

Emit an move instruction.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.
source§

impl Mov<Reg64, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg64, Reg64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Reg64)

Emit an move instruction.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.
source§

impl Mov<Reg8, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg8, Reg8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Reg8)

Emit an move instruction.
source§

impl Test<MemOp, Imm16> for Asm

source§

fn test(&mut self, op1: MemOp, op2: Imm16)

Emit a logical compare instruction. Read more
source§

impl Test<Reg32, Reg32> for Asm

source§

fn test(&mut self, op1: Reg32, op2: Reg32)

Emit a logical compare instruction. Read more
source§

impl Test<Reg64, Reg64> for Asm

source§

fn test(&mut self, op1: Reg64, op2: Reg64)

Emit a logical compare instruction. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Asm

§

impl Send for Asm

§

impl Sync for Asm

§

impl Unpin for Asm

§

impl UnwindSafe for Asm

Blanket Implementations§

source§

impl<T> Any for Twhere +Asm in juicebox_asm - Rust

Struct juicebox_asm::Asm

source ·
pub struct Asm { /* private fields */ }
Expand description

x64 jit assembler.

+

Implementations§

source§

impl Asm

source

pub fn new() -> Asm

Create a new x64 jit assembler.

+
source

pub fn into_code(self) -> Vec<u8>

Consume the assembler and get the emitted code.

+
source

pub fn bind(&mut self, label: &mut Label)

Bind the Label to the current location.

+
source§

impl Asm

source

pub fn nop(&mut self)

Emit a nop instruction.

+
source§

impl Asm

source

pub fn ret(&mut self)

Emit a ret instruction.

+

Trait Implementations§

source§

impl Add<MemOp, Imm16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Imm16)

Emit an add instruction.
source§

impl Add<MemOp, Reg16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Reg16)

Emit an add instruction.
source§

impl Add<Reg32, Reg32> for Asm

source§

fn add(&mut self, op1: Reg32, op2: Reg32)

Emit an add instruction.
source§

impl Add<Reg64, Reg64> for Asm

source§

fn add(&mut self, op1: Reg64, op2: Reg64)

Emit an add instruction.
source§

impl Call<Reg64> for Asm

source§

fn call(&mut self, op1: Reg64)

Emit a call instruction.
source§

impl Cmp<MemOp, Imm16> for Asm

source§

fn cmp(&mut self, op1: MemOp, op2: Imm16)

Emit a compare instruction. Read more
source§

impl Dec<Reg32> for Asm

source§

fn dec(&mut self, op1: Reg32)

Emit a decrement instruction.
source§

impl Dec<Reg64> for Asm

source§

fn dec(&mut self, op1: Reg64)

Emit a decrement instruction.
source§

impl Jmp<&mut Label> for Asm

source§

fn jmp(&mut self, op1: &mut Label)

Emit an unconditional jump instruction.
source§

impl Jnz<&mut Label> for Asm

source§

fn jnz(&mut self, op1: &mut Label)

Emit a conditional jump if not zero instruction (ZF = 0).
source§

impl Jz<&mut Label> for Asm

source§

fn jz(&mut self, op1: &mut Label)

Emit a conditional jump if zero instruction (ZF = 1).
source§

impl Mov<MemOp, Imm16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Imm16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg16)

Emit an move instruction.
source§

impl Mov<MemOp, Reg32> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg32)

Emit an move instruction.
source§

impl Mov<MemOp, Reg64> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg64)

Emit an move instruction.
source§

impl Mov<MemOp, Reg8> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Reg8)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg16, Reg16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Reg16)

Emit an move instruction.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.
source§

impl Mov<Reg32, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg32, Reg32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Reg32)

Emit an move instruction.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.
source§

impl Mov<Reg64, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg64, Reg64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Reg64)

Emit an move instruction.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.
source§

impl Mov<Reg8, MemOp> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: MemOp)

Emit an move instruction.
source§

impl Mov<Reg8, Reg8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Reg8)

Emit an move instruction.
source§

impl Test<MemOp, Imm16> for Asm

source§

fn test(&mut self, op1: MemOp, op2: Imm16)

Emit a logical compare instruction. Read more
source§

impl Test<Reg32, Reg32> for Asm

source§

fn test(&mut self, op1: Reg32, op2: Reg32)

Emit a logical compare instruction. Read more
source§

impl Test<Reg64, Reg64> for Asm

source§

fn test(&mut self, op1: Reg64, op2: Reg64)

Emit a logical compare instruction. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Asm

§

impl Send for Asm

§

impl Sync for Asm

§

impl Unpin for Asm

§

impl UnwindSafe for Asm

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/struct.Imm16.html b/juicebox_asm/struct.Imm16.html index 7e9bd5a..1216553 100644 --- a/juicebox_asm/struct.Imm16.html +++ b/juicebox_asm/struct.Imm16.html @@ -1,5 +1,5 @@ Imm16 in juicebox_asm - Rust

Struct juicebox_asm::Imm16

source ·
pub struct Imm16(/* private fields */);
Expand description

Type representing a 16 bit immediate.

-

Trait Implementations§

source§

impl Add<MemOp, Imm16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Imm16)

Emit an add instruction.
source§

impl Cmp<MemOp, Imm16> for Asm

source§

fn cmp(&mut self, op1: MemOp, op2: Imm16)

Emit a compare call instruction.
source§

impl From<i16> for Imm16

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm16

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm16

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm16

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<MemOp, Imm16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Test<MemOp, Imm16> for Asm

source§

fn test(&mut self, op1: MemOp, op2: Imm16)

Emit a logical compare instruction. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm16

§

impl Send for Imm16

§

impl Sync for Imm16

§

impl Unpin for Imm16

§

impl UnwindSafe for Imm16

Blanket Implementations§

source§

impl<T> Any for Twhere +

Trait Implementations§

source§

impl Add<MemOp, Imm16> for Asm

source§

fn add(&mut self, op1: MemOp, op2: Imm16)

Emit an add instruction.
source§

impl Cmp<MemOp, Imm16> for Asm

source§

fn cmp(&mut self, op1: MemOp, op2: Imm16)

Emit a compare instruction. Read more
source§

impl From<i16> for Imm16

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm16

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm16

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm16

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<MemOp, Imm16> for Asm

source§

fn mov(&mut self, op1: MemOp, op2: Imm16)

Emit an move instruction.
source§

impl Mov<Reg16, Imm16> for Asm

source§

fn mov(&mut self, op1: Reg16, op2: Imm16)

Emit an move instruction.
source§

impl Test<MemOp, Imm16> for Asm

source§

fn test(&mut self, op1: MemOp, op2: Imm16)

Emit a logical compare instruction. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm16

§

impl Send for Imm16

§

impl Sync for Imm16

§

impl Unpin for Imm16

§

impl UnwindSafe for Imm16

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/struct.Imm32.html b/juicebox_asm/struct.Imm32.html index 5dce417..8a2d937 100644 --- a/juicebox_asm/struct.Imm32.html +++ b/juicebox_asm/struct.Imm32.html @@ -1,5 +1,5 @@ Imm32 in juicebox_asm - Rust

Struct juicebox_asm::Imm32

source ·
pub struct Imm32(/* private fields */);
Expand description

Type representing a 32 bit immediate.

-

Trait Implementations§

source§

impl From<i16> for Imm32

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Imm32

source§

fn from(imm: i32) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm32

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm32

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Imm32

source§

fn from(imm: u32) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm32

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm32

§

impl Send for Imm32

§

impl Sync for Imm32

§

impl Unpin for Imm32

§

impl UnwindSafe for Imm32

Blanket Implementations§

source§

impl<T> Any for Twhere +

Trait Implementations§

source§

impl From<i16> for Imm32

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Imm32

source§

fn from(imm: i32) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm32

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm32

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Imm32

source§

fn from(imm: u32) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm32

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg32, Imm32> for Asm

source§

fn mov(&mut self, op1: Reg32, op2: Imm32)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm32

§

impl Send for Imm32

§

impl Sync for Imm32

§

impl Unpin for Imm32

§

impl UnwindSafe for Imm32

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/struct.Imm64.html b/juicebox_asm/struct.Imm64.html index dc3d9a6..cb711ee 100644 --- a/juicebox_asm/struct.Imm64.html +++ b/juicebox_asm/struct.Imm64.html @@ -1,8 +1,8 @@ -Imm64 in juicebox_asm - Rust

Struct juicebox_asm::Imm64

source ·
pub struct Imm64(/* private fields */);
Expand description

Type representing a 64 bit immediate.

-

Trait Implementations§

source§

impl From<i16> for Imm64

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Imm64

source§

fn from(imm: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Imm64

source§

fn from(imm: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm64

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm64

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Imm64

source§

fn from(imm: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Imm64

source§

fn from(imm: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm64

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm64

§

impl Send for Imm64

§

impl Sync for Imm64

§

impl Unpin for Imm64

§

impl UnwindSafe for Imm64

Blanket Implementations§

source§

impl<T> Any for Twhere +Imm64 in juicebox_asm - Rust

Struct juicebox_asm::Imm64

source ·
pub struct Imm64(/* private fields */);
Expand description

Type representing a 64 bit immediate.

+

Trait Implementations§

source§

impl From<i16> for Imm64

source§

fn from(imm: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Imm64

source§

fn from(imm: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Imm64

source§

fn from(imm: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Imm64

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<isize> for Imm64

source§

fn from(imm: isize) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Imm64

source§

fn from(imm: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Imm64

source§

fn from(imm: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Imm64

source§

fn from(imm: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm64

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl From<usize> for Imm64

source§

fn from(imm: usize) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg64, Imm64> for Asm

source§

fn mov(&mut self, op1: Reg64, op2: Imm64)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm64

§

impl Send for Imm64

§

impl Sync for Imm64

§

impl Unpin for Imm64

§

impl UnwindSafe for Imm64

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+ T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of diff --git a/juicebox_asm/struct.Imm8.html b/juicebox_asm/struct.Imm8.html index da8ec5a..b59a1df 100644 --- a/juicebox_asm/struct.Imm8.html +++ b/juicebox_asm/struct.Imm8.html @@ -1,5 +1,5 @@ Imm8 in juicebox_asm - Rust

Struct juicebox_asm::Imm8

source ·
pub struct Imm8(/* private fields */);
Expand description

Type representing an 8 bit immediate.

-

Trait Implementations§

source§

impl From<i8> for Imm8

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm8

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm8

§

impl Send for Imm8

§

impl Sync for Imm8

§

impl Unpin for Imm8

§

impl UnwindSafe for Imm8

Blanket Implementations§

source§

impl<T> Any for Twhere +

Trait Implementations§

source§

impl From<i8> for Imm8

source§

fn from(imm: i8) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Imm8

source§

fn from(imm: u8) -> Self

Converts to this type from the input type.
source§

impl Mov<Reg8, Imm8> for Asm

source§

fn mov(&mut self, op1: Reg8, op2: Imm8)

Emit an move instruction.

Auto Trait Implementations§

§

impl RefUnwindSafe for Imm8

§

impl Send for Imm8

§

impl Sync for Imm8

§

impl Unpin for Imm8

§

impl UnwindSafe for Imm8

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/struct.Label.html b/juicebox_asm/struct.Label.html index 9223133..63fc164 100644 --- a/juicebox_asm/struct.Label.html +++ b/juicebox_asm/struct.Label.html @@ -1,6 +1,7 @@ -Label in juicebox_asm - Rust

Struct juicebox_asm::Label

source ·
pub struct Label { /* private fields */ }
Expand description

A label which is used as target for jump instructions.

+Label in juicebox_asm - Rust

Struct juicebox_asm::Label

source ·
pub struct Label { /* private fields */ }
Expand description

A label which is used as target for jump instructions.

-
use juicebox_asm::prelude::*;
+
use juicebox_asm::{Asm, Label, Reg64};
+use juicebox_asm::insn::{Mov, Jmp};
 
 let mut lbl = Label::new();
 let mut asm = Asm::new();
@@ -12,8 +13,8 @@ asm.bind(&mut lbl);

Panics

Panics if the label is dropped while not yet bound, or having unresolved relocations. This is mainly a safety-guard to detect wrong usage.

-

Implementations§

source§

impl Label

source

pub fn new() -> Label

Create a new unbound Label.

-

Trait Implementations§

source§

impl Drop for Label

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Jmp<&mut Label> for Asm

source§

fn jmp(&mut self, op1: &mut Label)

Emit an unconditional jump instruction.
source§

impl Jnz<&mut Label> for Asm

source§

fn jnz(&mut self, op1: &mut Label)

Emit a conditional jump if not zero instruction (ZF = 0).
source§

impl Jz<&mut Label> for Asm

source§

fn jz(&mut self, op1: &mut Label)

Emit a conditional jump if zero instruction (ZF = 1).

Auto Trait Implementations§

§

impl RefUnwindSafe for Label

§

impl Send for Label

§

impl Sync for Label

§

impl Unpin for Label

§

impl UnwindSafe for Label

Blanket Implementations§

source§

impl<T> Any for Twhere +

Implementations§

source§

impl Label

source

pub fn new() -> Label

Create a new unbound Label.

+

Trait Implementations§

source§

impl Drop for Label

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Jmp<&mut Label> for Asm

source§

fn jmp(&mut self, op1: &mut Label)

Emit an unconditional jump instruction.
source§

impl Jnz<&mut Label> for Asm

source§

fn jnz(&mut self, op1: &mut Label)

Emit a conditional jump if not zero instruction (ZF = 0).
source§

impl Jz<&mut Label> for Asm

source§

fn jz(&mut self, op1: &mut Label)

Emit a conditional jump if zero instruction (ZF = 1).

Auto Trait Implementations§

§

impl RefUnwindSafe for Label

§

impl Send for Label

§

impl Sync for Label

§

impl Unpin for Label

§

impl UnwindSafe for Label

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/juicebox_asm/struct.Runtime.html b/juicebox_asm/struct.Runtime.html index 6c73cc1..9fee473 100644 --- a/juicebox_asm/struct.Runtime.html +++ b/juicebox_asm/struct.Runtime.html @@ -1,10 +1,30 @@ -Runtime in juicebox_asm - Rust

Struct juicebox_asm::Runtime

source ·
pub struct Runtime { /* private fields */ }
Expand description

A simple mmaped runtime with executable pages.

-

Implementations§

source§

impl Runtime

source

pub fn new() -> Runtime

Create a new Runtime.

-
source

pub fn protect(&mut self)

Write protect the underlying code page(s).

-
source

pub unsafe fn add_code<F>(&mut self, code: impl AsRef<[u8]>) -> F

Add block of code to the runtime and get function pointer back.

-
source

pub fn dump(&self)

Dump the currently added code to a file called jit.asm. The disassembly can be inspected -as ndisasm -b 64 jit.asm.

-

Trait Implementations§

source§

impl Drop for Runtime

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere +Runtime in juicebox_asm - Rust

Struct juicebox_asm::Runtime

source ·
pub struct Runtime { /* private fields */ }
Expand description

A simple mmaped runtime with executable pages.

+

Implementations§

source§

impl Runtime

source

pub fn new() -> Runtime

Create a new Runtime.

+
Panics
+

Panics if the mmap call fails.

+
source

pub unsafe fn add_code<F>(&mut self, code: impl AsRef<[u8]>) -> F

Add the block of code to the runtime and a get function pointer of type F.

+
Panics
+

Panics if the code does not fit on the mmaped pages or is empty.

+
Safety
+

The code added must fulfill the ABI of the specified function F and the returned function +pointer is only valid until the Runtime is dropped.

+
Examples
+
let mut rt = juicebox_asm::Runtime::new();
+
+let code = [ 0x90 /* nop */, 0xc3 /* ret */ ];
+let nop = unsafe { rt.add_code::<extern "C" fn()>(&code) };
+
+nop();
+
source

pub fn dump(&self)

Dump the code added so far to the runtime into a file called jit.asm in the processes +current working directory.

+

The code can be inspected with a disassembler as for example ndiasm from +nasm.us.

+
ndisasm -b 64 jit.asm
+
Panics
+

Panics if writing the file failed.

+

Trait Implementations§

source§

impl Drop for Runtime

source§

fn drop(&mut self)

Unmaps the code page. This invalidates all the function pointer returned by +Runtime::add_code.

+

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/search-index.js b/search-index.js index b08749a..01b4533 100644 --- a/search-index.js +++ b/search-index.js @@ -1,7 +1,7 @@ var searchIndex = JSON.parse('{\ "add":{"doc":"Add example.","t":"","n":[],"q":[],"d":[],"i":[],"f":[],"c":[],"p":[]},\ "fib":{"doc":"Fibonacci example.","t":"","n":[],"q":[],"d":[],"i":[],"f":[],"c":[],"p":[]},\ -"juicebox_asm":{"doc":"A simple x64 jit assembler with a minimal runtime to …","t":"DDDDDNNDEEEEEDLLLLLNNNNLNLLLLLLNNNLNNLNLLNNNNLLNNNNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLALNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNLLNNNNNNLLLLLLLLLLLLICIIIDDDDIIIDCIEEEEIKNNNNNLLLLLLLLLLLLLLLLLLNNNKNNLLLLLLLLKNKNNNNLNNNNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLKKKKLNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL","n":["Asm","Imm16","Imm32","Imm64","Imm8","Indirect","IndirectDisp","Label","MemOp","Reg16","Reg32","Reg64","Reg8","Runtime","add","add","add","add","add_code","ah","al","ax","bh","bind","bl","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","bp","bpl","bx","call","ch","cl","cmp","cx","dec","dec","dh","di","dil","dl","drop","dump","dx","eax","ebp","ebx","ecx","edi","edx","esi","esp","from","from","from","into","into","into","into_code","jmp","jnz","jz","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","new","new","nop","prelude","protect","r10","r10d","r10l","r10w","r11","r11d","r11l","r11w","r12","r12d","r12l","r12w","r13","r13d","r13l","r13w","r14","r14d","r14l","r14w","r15","r15d","r15l","r15w","r8","r8d","r8l","r8w","r9","r9d","r9l","r9w","rax","rbp","rbx","rcx","rdi","rdx","resolve","ret","rsi","rsp","si","sil","sp","spl","test","test","test","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","Add","Asm","Call","Cmp","Dec","Imm16","Imm32","Imm64","Imm8","Jmp","Jnz","Jz","Label","MemOp","Mov","Reg16","Reg32","Reg64","Reg8","Test","add","ah","al","ax","bh","bl","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","bp","bpl","bx","call","ch","cl","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","cmp","cx","dec","dh","di","dil","dl","drop","dx","eax","ebp","ebx","ecx","edi","edx","esi","esp","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","into","into","into","into","into","into","into","into","into","jmp","jnz","jz","mov","new","r10","r10d","r10l","r10w","r11","r11d","r11l","r11w","r12","r12d","r12l","r12w","r13","r13d","r13l","r13w","r14","r14d","r14l","r14w","r15","r15d","r15l","r15w","r8","r8d","r8l","r8w","r9","r9d","r9l","r9w","rax","rbp","rbx","rcx","rdi","rdx","rsi","rsp","si","sil","sp","spl","test","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id"],"q":[[0,"juicebox_asm"],[146,"juicebox_asm::prelude"],[340,"core::convert"],[341,"alloc::vec"],[342,"core::result"],[343,"core::any"]],"d":["x64 jit assembler.","Type representing a 16 bit immediate.","Type representing a 32 bit immediate.","Type representing a 64 bit immediate.","Type representing an 8 bit immediate.","An indirect memory operand, eg mov [rax], rcx.","An indirect memory operand with additional displacement, …","A label which is used as target for jump instructions.","Type representing a memory operand.","Definition of 16 bit registers.","Definition of 32 bit registers.","Definition of 64 bit registers.","Definition of 8 bit registers.","A simple mmaped runtime with executable pages.","","","","","Add block of code to the runtime and get function pointer …","","","","","Bind the Label to the current location.","","","","","","","","","","","","","","","","","","","","","","","Dump the currently added code to a file called jit.asm. …","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Consume the assembler and get the emitted code.","","","","","","","","","","","","","","","","","","","","","Create a new Runtime.","Create a new x64 jit assembler.","","Crate prelude, which can be used to import the most …","Write protect the underlying code page(s).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","If the Label is bound, patch any pending relocation.","","","","","","","","","","","","","","","","","","","","","","","","","Type representing a 16 bit immediate.","Type representing a 32 bit immediate.","Type representing a 64 bit immediate.","Type representing an 8 bit immediate.","","","","A label which is used as target for jump instructions.","","","Definition of 16 bit registers.","Definition of 32 bit registers.","Definition of 64 bit registers.","Definition of 8 bit registers.","","Emit an add instruction.","","","","","","","","","","","","","","","","","","","","","","","","","","","Emit a call instruction.","","","","","","","","","","","Emit a compare call instruction.","","Emit a decrement instruction.","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","","Returns the argument unchanged.","","","","","Returns the argument unchanged.","","","","","","","","","Returns the argument unchanged.","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Emit an unconditional jump instruction.","Emit a conditional jump if not zero instruction (ZF = 0).","Emit a conditional jump if zero instruction (ZF = 1).","Emit an move instruction.","Create a new unbound Label.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Emit a logical compare instruction.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,4,4,0,0,0,0,0,0,0,1,1,1,1,8,14,14,5,14,1,14,8,4,1,8,4,1,5,14,5,1,14,14,1,5,1,1,14,5,14,14,8,8,5,6,6,6,6,6,6,6,6,8,4,1,8,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,1,1,0,8,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,2,2,2,2,2,1,1,2,2,5,14,5,14,1,1,1,8,4,1,8,4,1,8,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,14,14,5,14,14,12,17,7,15,16,2,6,5,14,12,17,7,15,16,2,6,5,14,5,14,5,28,14,14,2,6,5,14,2,6,5,14,29,5,30,14,5,14,14,12,5,6,6,6,6,6,6,6,6,12,17,17,17,7,7,7,7,7,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,2,6,5,14,12,17,7,15,16,2,6,5,14,31,32,33,34,12,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,6,14,5,2,2,2,2,2,2,2,2,5,14,5,14,35,2,6,5,14,12,17,7,15,16,2,6,5,14,12,17,7,15,16,2,6,5,14,12,17,7,15,16,2,6,5,14],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[1,2,2],3],[[1,4,5],3],[[1,6,6],3],[[1,4,7],3],[[8,-1],-2,[[11,[[10,[9]]]]],[]],0,0,0,0,[[1,12],3],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,[[1,2],3],0,0,[[1,4,7],3],0,[[1,6],3],[[1,2],3],0,0,0,0,[8,3],[8,3],0,0,0,0,0,0,0,0,0,[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[1,[[13,[9]]]],[[1,12],3],[[1,12],3],[[1,12],3],[[1,4,7],3],[[1,14,14],3],[[1,6,4],3],[[1,2,4],3],[[1,6,15],3],[[1,14,4],3],[[1,2,16],3],[[1,14,17],3],[[1,4,5],3],[[1,4,14],3],[[1,4,2],3],[[1,6,6],3],[[1,4,6],3],[[1,5,5],3],[[1,2,2],3],[[1,5,4],3],[[1,5,7],3],[[],8],[[],1],[1,3],0,[8,3],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[1,12],3],[1,3],0,0,0,0,0,0,[[1,4,7],3],[[1,2,2],3],[[1,6,6],3],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[-1,-2,-3],3,[],[],[]],0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,[[-1,-2],3,[],[]],0,0,[2,2],[6,6],[5,5],[14,14],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[-1,-2,-3],3,[],[],[]],0,[[-1,-2],3,[],[]],0,0,0,0,[12,3],0,0,0,0,0,0,0,0,0,[-1,-1,[]],[-1,-1,[]],[20,17],[9,17],[9,7],[-1,-1,[]],[20,7],[21,7],[22,7],[22,15],[-1,-1,[]],[20,15],[21,15],[23,15],[9,15],[24,15],[25,16],[24,16],[26,16],[-1,-1,[]],[23,16],[20,16],[9,16],[21,16],[22,16],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[-1,-2,-3],3,[],[],[]],[[],12],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[-1,-2,-3],3,[],[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]]],"c":[],"p":[[3,"Asm",0],[4,"Reg64",146],[15,"tuple"],[4,"MemOp",0],[4,"Reg16",146],[4,"Reg32",146],[3,"Imm16",146],[3,"Runtime",0],[15,"u8"],[15,"slice"],[8,"AsRef",340],[3,"Label",146],[3,"Vec",341],[4,"Reg8",146],[3,"Imm32",146],[3,"Imm64",146],[3,"Imm8",146],[4,"Result",342],[3,"TypeId",343],[15,"i8"],[15,"u16"],[15,"i16"],[15,"u32"],[15,"i32"],[15,"i64"],[15,"u64"],[8,"Add",146],[8,"Call",146],[8,"Cmp",146],[8,"Dec",146],[8,"Jmp",146],[8,"Jnz",146],[8,"Jz",146],[8,"Mov",146],[8,"Test",146]]},\ +"juicebox_asm":{"doc":"A simple x64 jit assembler with a minimal runtime to …","t":"DDDDDNNDEEEEEDLLLLLNNNNLNLLLLLLLLLLLLLLLLLLLLLLLLNNNLNNLLLLLLLLLNLLNNNNLLLNNNNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLIIIIIIIIIKKKKKKKKK","n":["Asm","Imm16","Imm32","Imm64","Imm8","Indirect","IndirectDisp","Label","MemOp","Reg16","Reg32","Reg64","Reg8","Runtime","add","add","add","add","add_code","ah","al","ax","bh","bind","bl","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","bp","bpl","bx","call","ch","cl","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","cmp","cx","dec","dec","dh","di","dil","dl","drop","drop","dump","dx","eax","ebp","ebx","ecx","edi","edx","esi","esp","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","insn","into","into","into","into","into","into","into","into","into","into","into","into","into_code","jmp","jnz","jz","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","new","new","new","nop","r10","r10d","r10l","r10w","r11","r11d","r11l","r11w","r12","r12d","r12l","r12w","r13","r13d","r13l","r13w","r14","r14d","r14l","r14w","r15","r15d","r15l","r15w","r8","r8d","r8l","r8w","r9","r9d","r9l","r9w","rax","rbp","rbx","rcx","rdi","rdx","ret","rsi","rsp","si","sil","sp","spl","test","test","test","to_owned","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","Add","Call","Cmp","Dec","Jmp","Jnz","Jz","Mov","Test","add","call","cmp","dec","jmp","jnz","jz","mov","test"],"q":[[0,"juicebox_asm"],[243,"juicebox_asm::insn"],[261,"core::convert"],[262,"alloc::vec"],[263,"core::result"],[264,"core::any"]],"d":["x64 jit assembler.","Type representing a 16 bit immediate.","Type representing a 32 bit immediate.","Type representing a 64 bit immediate.","Type representing an 8 bit immediate.","An indirect memory operand, eg mov [rax], rcx.","An indirect memory operand with additional displacement, …","A label which is used as target for jump instructions.","Type representing a memory operand.","Definition of 16 bit registers.","Definition of 32 bit registers.","Definition of 64 bit registers.","Definition of 8 bit registers.","A simple mmaped runtime with executable pages.","","","","","Add the block of code to the runtime and a get function …","","","","","Bind the Label to the current location.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Unmaps the code page. This invalidates all the function …","Dump the code added so far to the runtime into a file …","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","","","Returns the argument unchanged.","","","","Returns the argument unchanged.","","","","","","","","Returns the argument unchanged.","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Trait definitions of various instructions.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Consume the assembler and get the emitted code.","","","","","","","","","","","","","","","","","","","","","Create a new x64 jit assembler.","Create a new unbound Label.","Create a new Runtime.","Emit a nop instruction.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Emit a ret instruction.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Trait for add instruction kinds.","Trait for call instruction kinds.","Trait for cmp instruction kinds.","Trait for dec instruction kinds.","Trait for jmp instruction kinds.","Trait for jnz instruction kinds.","Trait for jz instruction kinds.","Trait for mov instruction kinds.","Trait for test instruction kinds.","Emit an add instruction.","Emit a call instruction.","Emit a compare instruction.","Emit a decrement instruction.","Emit an unconditional jump instruction.","Emit a conditional jump if not zero instruction (ZF = 0).","Emit a conditional jump if zero instruction (ZF = 1).","Emit an move instruction.","Emit a logical compare instruction."],"i":[0,0,0,0,0,2,2,0,0,0,0,0,0,0,1,1,1,1,8,13,13,3,13,1,13,1,12,8,2,15,6,18,22,7,5,3,13,1,12,8,2,15,6,18,22,7,5,3,13,3,13,3,1,13,13,7,5,3,13,7,5,3,13,1,3,1,1,13,3,13,13,12,8,8,3,5,5,5,5,5,5,5,5,1,12,8,2,15,15,15,6,6,6,6,6,18,18,18,18,18,18,18,22,22,22,22,22,22,22,22,22,22,22,7,5,3,13,0,1,12,8,2,15,6,18,22,7,5,3,13,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,8,1,7,5,13,3,7,5,13,3,7,5,13,3,7,5,13,3,7,5,13,3,7,5,13,3,7,5,13,3,7,5,13,3,7,7,7,7,7,7,1,7,7,3,13,3,13,1,1,1,7,5,3,13,1,12,8,2,15,6,18,22,7,5,3,13,1,12,8,2,15,6,18,22,7,5,3,13,1,12,8,2,15,6,18,22,7,5,3,13,0,0,0,0,0,0,0,0,0,29,30,31,32,33,34,35,36,37],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[1,2,3],4],[[1,5,5],4],[[1,2,6],4],[[1,7,7],4],[[8,-1],-2,[[11,[[10,[9]]]]],[]],0,0,0,0,[[1,12],4],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,[[1,7],4],0,0,[7,7],[5,5],[3,3],[13,13],[[-1,-2],4,[],[]],[[-1,-2],4,[],[]],[[-1,-2],4,[],[]],[[-1,-2],4,[],[]],[[1,2,6],4],0,[[1,5],4],[[1,7],4],0,0,0,0,[12,4],[8,4],[8,4],0,0,0,0,0,0,0,0,0,[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[14,15],[-1,-1,[]],[9,15],[9,6],[-1,-1,[]],[16,6],[17,6],[14,6],[-1,-1,[]],[16,18],[9,18],[14,18],[19,18],[20,18],[17,18],[21,22],[-1,-1,[]],[17,22],[20,22],[16,22],[23,22],[14,22],[9,22],[24,22],[19,22],[25,22],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[1,[[26,[9]]]],[[1,12],4],[[1,12],4],[[1,12],4],[[1,2,5],4],[[1,5,5],4],[[1,5,2],4],[[1,7,2],4],[[1,5,18],4],[[1,13,2],4],[[1,7,22],4],[[1,13,15],4],[[1,2,3],4],[[1,2,13],4],[[1,2,6],4],[[1,3,6],4],[[1,3,2],4],[[1,2,7],4],[[1,7,7],4],[[1,3,3],4],[[1,13,13],4],[[],1],[[],12],[[],8],[1,4],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[1,4],0,0,0,0,0,0,[[1,5,5],4],[[1,7,7],4],[[1,2,6],4],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,[[27,[-2]]],[],[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],0,0,0,0,0,0,0,0,0,[[-1,-2,-3],4,[],[],[]],[[-1,-2],4,[],[]],[[-1,-2,-3],4,[],[],[]],[[-1,-2],4,[],[]],[[-1,-2],4,[],[]],[[-1,-2],4,[],[]],[[-1,-2],4,[],[]],[[-1,-2,-3],4,[],[],[]],[[-1,-2,-3],4,[],[],[]]],"c":[],"p":[[3,"Asm",0],[4,"MemOp",0],[4,"Reg16",0],[15,"tuple"],[4,"Reg32",0],[3,"Imm16",0],[4,"Reg64",0],[3,"Runtime",0],[15,"u8"],[15,"slice"],[8,"AsRef",261],[3,"Label",0],[4,"Reg8",0],[15,"i8"],[3,"Imm8",0],[15,"i16"],[15,"u16"],[3,"Imm32",0],[15,"i32"],[15,"u32"],[15,"isize"],[3,"Imm64",0],[15,"usize"],[15,"i64"],[15,"u64"],[3,"Vec",262],[4,"Result",263],[3,"TypeId",264],[8,"Add",243],[8,"Call",243],[8,"Cmp",243],[8,"Dec",243],[8,"Jmp",243],[8,"Jnz",243],[8,"Jz",243],[8,"Mov",243],[8,"Test",243]]},\ "tiny_vm":{"doc":"TinyVm example.","t":"NNNNNNNDNNNDNEEDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFFFLLLLLLLLLLLLLLLLLLLLLLL","n":["A","Add","Addi","B","Branch","BranchZero","C","Fixup","Halt","Load","LoadImm","PhysAddr","Store","TinyInsn","TinyReg","TinyVm","bind","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","dump","eq","eq","fmt","fmt","from","from","from","from","from","interp","into","into","into","into","into","into","jit","make_tinyvm_fib","make_tinyvm_jit_perf","make_tinyvm_jit_test","new","new","read_mem","read_reg","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","write_mem","write_reg"],"q":[[0,"tiny_vm"],[75,"alloc::vec"],[76,"core::fmt"],[77,"core::fmt"],[78,"core::any"]],"d":["","Add the register to the register reg1 += reg2.","Add the immediate to the register reg += imm.","","Jump unconditional (absolute addressing) pc = disp.","Jump if the register is zero (absolute addressing) …","","A minial fixup utility to implement jump labels when …","Halt the VM.","Load a value from the memory (absolute addressing) into …","Load the immediate value into the register reg = imm.","A guest physical address.","Store a value from the register into the memory (absolute …","The instructions for the TinyVm.","The registers for the TinyVm.","The TinyVm virtual machine state.","Bind the Fixup to the current location of prog and resolve …","","","","","","","","","","","","","","","Dump the VM state to stdout.","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Run in interpreter mode until the next TinyInsn::Halt …","Calls U::from(self).","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Run in JIT mode until the next TinyInsn::Halt instruction …","Generate a guest program to compute the fiibonacci …","Generate a simple count down loop to crunch some …","Generate a test program for the jit.","Create a new TinyVm and initialize the instruction memory …","Create a new Fixup at the current pc.","Read guest data memory.","Read guest register.","","","","","","","","","","","","","","","","","","Write guest data memory.","Write guest register."],"i":[5,2,2,5,2,2,5,0,2,2,2,0,2,0,0,0,1,10,6,1,5,2,10,6,1,5,2,5,2,5,2,6,5,2,5,2,10,6,1,5,2,6,10,10,6,1,5,2,6,0,0,0,6,1,6,6,5,2,10,6,1,5,2,10,6,1,5,2,10,6,1,5,2,6,6],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[1,[3,[2]]],4],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[5,5],[2,2],[[-1,-2],4,[],[]],[[-1,-2],4,[],[]],[6,4],[[5,5],7],[[2,2],7],[[5,8],9],[[2,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[6,4],[-1,-2,[],[]],[10,11],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[6,4],[12,[[3,[2]]]],[[],[[3,[2]]]],[[],[[3,[2]]]],[[[3,[2]]],6],[11,1],[[6,10],12],[[6,5],12],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,[[13,[-2]]],[],[]],[-1,14,[]],[-1,14,[]],[-1,14,[]],[-1,14,[]],[-1,14,[]],[[6,10,12],4],[[6,5,12],4]],"c":[],"p":[[3,"Fixup",0],[4,"TinyInsn",0],[3,"Vec",75],[15,"tuple"],[4,"TinyReg",0],[3,"TinyVm",0],[15,"bool"],[3,"Formatter",76],[6,"Result",76],[3,"PhysAddr",0],[15,"usize"],[15,"u16"],[4,"Result",77],[3,"TypeId",78]]}\ }'); if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; diff --git a/settings.html b/settings.html index 0959e0c..69169e2 100644 --- a/settings.html +++ b/settings.html @@ -1 +1 @@ -Rustdoc settings

Rustdoc settings

Back
\ No newline at end of file +Rustdoc settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/src-files.js b/src-files.js index 19d233f..de66aef 100644 --- a/src-files.js +++ b/src-files.js @@ -1,7 +1,7 @@ var srcIndex = JSON.parse('{\ "add":["",[],["add.rs"]],\ "fib":["",[],["fib.rs"]],\ -"juicebox_asm":["",[["insn",[],["add.rs","call.rs","cmp.rs","dec.rs","jmp.rs","jnz.rs","jz.rs","mov.rs","nop.rs","ret.rs","test.rs"]]],["imm.rs","insn.rs","label.rs","lib.rs","prelude.rs","reg.rs","rt.rs"]],\ +"juicebox_asm":["",[["insn",[],["add.rs","call.rs","cmp.rs","dec.rs","jmp.rs","jnz.rs","jz.rs","mov.rs","nop.rs","ret.rs","test.rs"]]],["asm.rs","imm.rs","insn.rs","label.rs","lib.rs","reg.rs","rt.rs"]],\ "tiny_vm":["",[],["tiny_vm.rs"]]\ }'); createSrcSidebar(); diff --git a/src/add/add.rs.html b/src/add/add.rs.html index 112d0f1..dc8c566 100644 --- a/src/add/add.rs.html +++ b/src/add/add.rs.html @@ -44,9 +44,9 @@ #[cfg(not(any(target_arch = "x86_64", target_os = "linux")))] compile_error!("Only supported on x86_64 with SystemV abi"); -use juicebox_asm::prelude::*; +use juicebox_asm::insn::*; use juicebox_asm::Runtime; -use Reg64::*; +use juicebox_asm::{Asm, Imm64, Reg64::*}; extern "C" fn add(a: u32, b: u32) -> u32 { a + b @@ -59,9 +59,9 @@ // rdi -> first argument // rsi -> second argument // rax -> return value - // + asm.mov(rsi, Imm64::from(42)); - asm.mov(rax, Imm64::from(add as u64)); + asm.mov(rax, Imm64::from(add as usize)); asm.call(rax); asm.ret(); diff --git a/src/fib/fib.rs.html b/src/fib/fib.rs.html index 87a1bbf..f7b4aa6 100644 --- a/src/fib/fib.rs.html +++ b/src/fib/fib.rs.html @@ -76,13 +76,15 @@ 76 77 78 +79
//! Fibonacci example.
 //!
 //! Jit compile a function at runtime (generate native host code) to compute the fibonacci sequence
 //! to demonstrate the [`juicebox_asm`] crate.
 
-use juicebox_asm::prelude::*;
+use juicebox_asm::insn::*;
 use juicebox_asm::Runtime;
+use juicebox_asm::{Asm, Imm64, Label, Reg64};
 
 const fn fib_rs(n: u64) -> u64 {
     match n {
diff --git a/src/juicebox_asm/asm.rs.html b/src/juicebox_asm/asm.rs.html
new file mode 100644
index 0000000..fd5f0d5
--- /dev/null
+++ b/src/juicebox_asm/asm.rs.html
@@ -0,0 +1,689 @@
+asm.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+
//! The `x64` jit assembler.
+
+use crate::*;
+use imm::Imm;
+use reg::Reg;
+
+/// Encode the `REX` byte.
+const fn rex(w: bool, r: u8, x: u8, b: u8) -> u8 {
+    let w = if w { 1 } else { 0 };
+    let r = (r >> 3) & 1;
+    let x = (x >> 3) & 1;
+    let b = (b >> 3) & 1;
+    0b0100_0000 | ((w & 1) << 3) | (r << 2) | (x << 1) | b
+}
+
+/// Encode the `ModR/M` byte.
+const fn modrm(mod_: u8, reg: u8, rm: u8) -> u8 {
+    ((mod_ & 0b11) << 6) | ((reg & 0b111) << 3) | (rm & 0b111)
+}
+
+/// `x64` jit assembler.
+pub struct Asm {
+    buf: Vec<u8>,
+}
+
+impl Asm {
+    /// Create a new `x64` jit assembler.
+    pub fn new() -> Asm {
+        // Some random default capacity.
+        let buf = Vec::with_capacity(1024);
+        Asm { buf }
+    }
+
+    /// Consume the assembler and get the emitted code.
+    pub fn into_code(self) -> Vec<u8> {
+        self.buf
+    }
+
+    /// Emit a slice of bytes.
+    pub(crate) fn emit(&mut self, bytes: &[u8]) {
+        self.buf.extend_from_slice(bytes);
+    }
+
+    /// Emit a slice of optional bytes.
+    fn emit_optional(&mut self, bytes: &[Option<u8>]) {
+        for byte in bytes.iter().filter_map(|&b| b) {
+            self.buf.push(byte);
+        }
+    }
+
+    /// Emit a slice of bytes at `pos`.
+    ///
+    /// # Panics
+    ///
+    /// Panics if [pos..pos+len] indexes out of bound of the underlying code buffer.
+    fn emit_at(&mut self, pos: usize, bytes: &[u8]) {
+        if let Some(buf) = self.buf.get_mut(pos..pos + bytes.len()) {
+            buf.copy_from_slice(bytes);
+        } else {
+            unimplemented!();
+        }
+    }
+
+    /// Bind the [Label] to the current location.
+    pub fn bind(&mut self, label: &mut Label) {
+        // Bind the label to the current offset.
+        label.bind(self.buf.len());
+
+        // Resolve any pending relocations for the label.
+        self.resolve(label);
+    }
+
+    /// If the [Label] is bound, patch any pending relocation.
+    fn resolve(&mut self, label: &mut Label) {
+        if let Some(loc) = label.location() {
+            // For now we only support disp32 as label location.
+            let loc = i32::try_from(loc).expect("Label location did not fit into i32.");
+
+            // Resolve any pending relocations for the label.
+            for off in label.offsets_mut().drain() {
+                // Displacement is relative to the next instruction following the jump.
+                // We record the offset to patch at the first byte of the disp32 therefore we need
+                // to account for that in the disp computation.
+                let disp32 = loc - i32::try_from(off).expect("Label offset did not fit into i32") - 4 /* account for the disp32 */;
+
+                // Patch the relocation with the disp32.
+                self.emit_at(off, &disp32.to_ne_bytes());
+            }
+        }
+    }
+
+    // -- Encode utilities.
+
+    /// Encode an register-register instruction.
+    pub(crate) fn encode_rr<T: Reg>(&mut self, opc: u8, op1: T, op2: T)
+    where
+        Self: EncodeRR<T>,
+    {
+        // MR operand encoding.
+        //   op1 -> modrm.rm
+        //   op2 -> modrm.reg
+        let modrm = modrm(
+            0b11,      /* mod */
+            op2.idx(), /* reg */
+            op1.idx(), /* rm */
+        );
+
+        let prefix = <Self as EncodeRR<T>>::legacy_prefix();
+        let rex = <Self as EncodeRR<T>>::rex(op1, op2);
+
+        self.emit_optional(&[prefix, rex]);
+        self.emit(&[opc, modrm]);
+    }
+
+    /// Encode an offset-immediate instruction.
+    /// Register idx is encoded in the opcode.
+    pub(crate) fn encode_oi<T: Reg, U: Imm>(&mut self, opc: u8, op1: T, op2: U)
+    where
+        Self: EncodeR<T>,
+    {
+        let opc = opc + (op1.idx() & 0b111);
+        let prefix = <Self as EncodeR<T>>::legacy_prefix();
+        let rex = <Self as EncodeR<T>>::rex(op1);
+
+        self.emit_optional(&[prefix, rex]);
+        self.emit(&[opc]);
+        self.emit(op2.bytes());
+    }
+
+    /// Encode a register instruction.
+    pub(crate) fn encode_r<T: Reg>(&mut self, opc: u8, opc_ext: u8, op1: T)
+    where
+        Self: EncodeR<T>,
+    {
+        // M operand encoding.
+        //   op1           -> modrm.rm
+        //   opc extension -> modrm.reg
+        let modrm = modrm(
+            0b11,      /* mod */
+            opc_ext,   /* reg */
+            op1.idx(), /* rm */
+        );
+
+        let prefix = <Self as EncodeR<T>>::legacy_prefix();
+        let rex = <Self as EncodeR<T>>::rex(op1);
+
+        self.emit_optional(&[prefix, rex]);
+        self.emit(&[opc, modrm]);
+    }
+
+    /// Encode a memory-immediate instruction.
+    pub(crate) fn encode_mi<T: Imm>(&mut self, opc: u8, opc_ext: u8, op1: MemOp, op2: T)
+    where
+        Self: EncodeMI<T>,
+    {
+        // MI operand encoding.
+        //   op1 -> modrm.rm
+        //   op2 -> imm
+        let mode = match op1 {
+            MemOp::Indirect(..) => {
+                assert!(!op1.base().need_sib() && !op1.base().is_pc_rel());
+                0b00
+            }
+            MemOp::IndirectDisp(..) => {
+                assert!(!op1.base().need_sib());
+                0b10
+            }
+        };
+
+        let modrm = modrm(
+            mode,             /* mode */
+            opc_ext,          /* reg */
+            op1.base().idx(), /* rm */
+        );
+
+        let prefix = <Self as EncodeMI<T>>::legacy_prefix();
+        let rex = <Self as EncodeMI<T>>::rex(&op1);
+
+        self.emit_optional(&[prefix, rex]);
+        self.emit(&[opc, modrm]);
+        if let MemOp::IndirectDisp(_, disp) = op1 {
+            self.emit(&disp.to_ne_bytes());
+        }
+        self.emit(op2.bytes());
+    }
+
+    /// Encode a memory-register instruction.
+    pub(crate) fn encode_mr<T: Reg>(&mut self, opc: u8, op1: MemOp, op2: T)
+    where
+        Self: EncodeMR<T>,
+    {
+        // MR operand encoding.
+        //   op1 -> modrm.rm
+        //   op2 -> modrm.reg
+        let mode = match op1 {
+            MemOp::Indirect(..) => {
+                assert!(!op1.base().need_sib() && !op1.base().is_pc_rel());
+                0b00
+            }
+            MemOp::IndirectDisp(..) => {
+                assert!(!op1.base().need_sib());
+                0b10
+            }
+        };
+
+        let modrm = modrm(
+            mode,             /* mode */
+            op2.idx(),        /* reg */
+            op1.base().idx(), /* rm */
+        );
+        let prefix = <Self as EncodeMR<T>>::legacy_prefix();
+        let rex = <Self as EncodeMR<T>>::rex(&op1, op2);
+
+        self.emit_optional(&[prefix, rex]);
+        self.emit(&[opc, modrm]);
+        if let MemOp::IndirectDisp(_, disp) = op1 {
+            self.emit(&disp.to_ne_bytes());
+        }
+    }
+
+    /// Encode a register-memory instruction.
+    pub(crate) fn encode_rm<T: Reg>(&mut self, opc: u8, op1: T, op2: MemOp)
+    where
+        Self: EncodeMR<T>,
+    {
+        // RM operand encoding.
+        //   op1 -> modrm.reg
+        //   op2 -> modrm.rm
+        self.encode_mr(opc, op2, op1);
+    }
+
+    /// Encode a jump to label instruction.
+    pub(crate) fn encode_jmp_label(&mut self, opc: &[u8], op1: &mut Label) {
+        // Emit the opcode.
+        self.emit(opc);
+
+        // Record relocation offset starting at the first byte of the disp32.
+        op1.record_offset(self.buf.len());
+
+        // Emit a zeroed disp32, which serves as placeholder for the relocation.
+        // We currently only support disp32 jump targets.
+        self.emit(&[0u8; 4]);
+
+        // Resolve any pending relocations for the label.
+        self.resolve(op1);
+    }
+}
+
+// -- Encoder helper.
+
+/// Encode helper for register-register instructions.
+pub(crate) trait EncodeRR<T: Reg> {
+    fn legacy_prefix() -> Option<u8> {
+        None
+    }
+
+    fn rex(op1: T, op2: T) -> Option<u8> {
+        if op1.need_rex() || op2.need_rex() {
+            Some(rex(op1.rexw(), op2.idx(), 0, op1.idx()))
+        } else {
+            None
+        }
+    }
+}
+
+impl EncodeRR<Reg8> for Asm {}
+impl EncodeRR<Reg32> for Asm {}
+impl EncodeRR<Reg16> for Asm {
+    fn legacy_prefix() -> Option<u8> {
+        Some(0x66)
+    }
+}
+impl EncodeRR<Reg64> for Asm {}
+
+/// Encode helper for register instructions.
+pub(crate) trait EncodeR<T: Reg> {
+    fn legacy_prefix() -> Option<u8> {
+        None
+    }
+
+    fn rex(op1: T) -> Option<u8> {
+        if op1.need_rex() {
+            Some(rex(op1.rexw(), 0, 0, op1.idx()))
+        } else {
+            None
+        }
+    }
+}
+
+impl EncodeR<Reg8> for Asm {}
+impl EncodeR<Reg32> for Asm {}
+impl EncodeR<Reg16> for Asm {
+    fn legacy_prefix() -> Option<u8> {
+        Some(0x66)
+    }
+}
+impl EncodeR<Reg64> for Asm {}
+
+/// Encode helper for memory-register instructions.
+pub(crate) trait EncodeMR<T: Reg> {
+    fn legacy_prefix() -> Option<u8> {
+        None
+    }
+
+    fn rex(op1: &MemOp, op2: T) -> Option<u8> {
+        if op2.need_rex() || (op1.base().is_ext()) {
+            Some(rex(op2.rexw(), op2.idx(), 0, op1.base().idx()))
+        } else {
+            None
+        }
+    }
+}
+
+impl EncodeMR<Reg8> for Asm {}
+impl EncodeMR<Reg16> for Asm {
+    fn legacy_prefix() -> Option<u8> {
+        Some(0x66)
+    }
+}
+impl EncodeMR<Reg32> for Asm {}
+impl EncodeMR<Reg64> for Asm {}
+
+/// Encode helper for memory-immediate instructions.
+pub(crate) trait EncodeMI<T: Imm> {
+    fn legacy_prefix() -> Option<u8> {
+        None
+    }
+
+    fn rex(op1: &MemOp) -> Option<u8> {
+        if op1.base().is_ext() {
+            Some(rex(false, 0, 0, op1.base().idx()))
+        } else {
+            None
+        }
+    }
+}
+
+impl EncodeMI<Imm8> for Asm {}
+impl EncodeMI<Imm16> for Asm {
+    fn legacy_prefix() -> Option<u8> {
+        Some(0x66)
+    }
+}
+impl EncodeMI<Imm32> for Asm {}
+
\ No newline at end of file diff --git a/src/juicebox_asm/imm.rs.html b/src/juicebox_asm/imm.rs.html index 78f4a8b..e0b6592 100644 --- a/src/juicebox_asm/imm.rs.html +++ b/src/juicebox_asm/imm.rs.html @@ -48,6 +48,19 @@ 48 49 50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63
//! Definition of different immediate types which are used as input operands for various
 //! instructions.
 
@@ -96,6 +109,19 @@
 );
 impl_imm!(
     /// Type representing a 64 bit immediate.
-    Imm64, 8, from: { u64, i64, u32, i32, u16, i16, u8, i8 }
+    Imm64, 8, from: { u64, i64, u32, i32, u16, i16, u8, i8, usize, isize }
 );
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use std::mem::size_of;
+
+    #[test]
+    fn test_usize_isize() {
+        // Imm64 should not implementd from usize/isize if this fails.
+        assert_eq!(size_of::<usize>(), size_of::<Imm64>());
+        assert_eq!(size_of::<isize>(), size_of::<Imm64>());
+    }
+}
 
\ No newline at end of file diff --git a/src/juicebox_asm/insn.rs.html b/src/juicebox_asm/insn.rs.html index 550a4ab..a367feb 100644 --- a/src/juicebox_asm/insn.rs.html +++ b/src/juicebox_asm/insn.rs.html @@ -59,6 +59,18 @@ 59 60 61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73

//! Trait definitions of various instructions.
 
 mod add;
@@ -73,47 +85,59 @@
 mod ret;
 mod test;
 
-pub trait Add<T, U> {
+/// Trait for [`add`](https://www.felixcloutier.com/x86/add) instruction kinds.
+pub trait Add<T, U> {
     /// Emit an add instruction.
     fn add(&mut self, op1: T, op2: U);
 }
 
-pub trait Call<T> {
+/// Trait for [`call`](https://www.felixcloutier.com/x86/call) instruction kinds.
+pub trait Call<T> {
     /// Emit a call instruction.
     fn call(&mut self, op1: T);
 }
 
-pub trait Cmp<T, U> {
-    /// Emit a compare call instruction.
+/// Trait for [`cmp`](https://www.felixcloutier.com/x86/cmp) instruction kinds.
+pub trait Cmp<T, U> {
+    /// Emit a compare instruction.
+    ///
+    /// Computes `op2 - op1` and sets the status flags in the same way as the `sub` instruction,
+    /// the result is discarded.
     fn cmp(&mut self, op1: T, op2: U);
 }
 
-pub trait Dec<T> {
+/// Trait for [`dec`](https://www.felixcloutier.com/x86/dec) instruction kinds.
+pub trait Dec<T> {
     /// Emit a decrement instruction.
     fn dec(&mut self, op1: T);
 }
 
-pub trait Jmp<T> {
+/// Trait for [`jmp`](https://www.felixcloutier.com/x86/jmp) instruction kinds.
+pub trait Jmp<T> {
     /// Emit an unconditional jump instruction.
     fn jmp(&mut self, op1: T);
 }
 
-pub trait Jnz<T> {
+/// Trait for [`jnz`](https://www.felixcloutier.com/x86/jcc) instruction kinds.
+pub trait Jnz<T> {
     /// Emit a conditional jump if not zero instruction (`ZF = 0`).
     fn jnz(&mut self, op1: T);
 }
 
-pub trait Jz<T> {
+/// Trait for [`jz`](https://www.felixcloutier.com/x86/jcc) instruction kinds.
+pub trait Jz<T> {
     /// Emit a conditional jump if zero instruction (`ZF = 1`).
     fn jz(&mut self, op1: T);
 }
 
-pub trait Mov<T, U> {
+/// Trait for [`mov`](https://www.felixcloutier.com/x86/mov) instruction kinds.
+pub trait Mov<T, U> {
     /// Emit an move instruction.
     fn mov(&mut self, op1: T, op2: U);
 }
 
-pub trait Test<T, U> {
+/// Trait for [`test`](https://www.felixcloutier.com/x86/test) instruction kinds.
+pub trait Test<T, U> {
     /// Emit a logical compare instruction.
     ///
     /// Computes the bit-wise logical AND of first operand and the second operand and sets the
diff --git a/src/juicebox_asm/insn/add.rs.html b/src/juicebox_asm/insn/add.rs.html
index d7f968a..d7d8c39 100644
--- a/src/juicebox_asm/insn/add.rs.html
+++ b/src/juicebox_asm/insn/add.rs.html
@@ -23,7 +23,9 @@
 23
 24
 25
-
use crate::prelude::*;
+26
+
use super::Add;
+use crate::{Asm, Imm16, MemOp, Reg16, Reg32, Reg64};
 
 impl Add<Reg64, Reg64> for Asm {
     fn add(&mut self, op1: Reg64, op2: Reg64) {
diff --git a/src/juicebox_asm/insn/call.rs.html b/src/juicebox_asm/insn/call.rs.html
index f9649ed..e88996d 100644
--- a/src/juicebox_asm/insn/call.rs.html
+++ b/src/juicebox_asm/insn/call.rs.html
@@ -5,7 +5,9 @@
 5
 6
 7
-
use crate::prelude::*;
+8
+
use super::Call;
+use crate::{Asm, Reg64};
 
 impl Call<Reg64> for Asm {
     fn call(&mut self, op1: Reg64) {
diff --git a/src/juicebox_asm/insn/cmp.rs.html b/src/juicebox_asm/insn/cmp.rs.html
index b50d90d..4e28818 100644
--- a/src/juicebox_asm/insn/cmp.rs.html
+++ b/src/juicebox_asm/insn/cmp.rs.html
@@ -5,7 +5,9 @@
 5
 6
 7
-
use crate::prelude::*;
+8
+
use super::Cmp;
+use crate::{Asm, Imm16, MemOp};
 
 impl Cmp<MemOp, Imm16> for Asm {
     fn cmp(&mut self, op1: MemOp, op2: Imm16) {
diff --git a/src/juicebox_asm/insn/dec.rs.html b/src/juicebox_asm/insn/dec.rs.html
index 2afecd2..5a10063 100644
--- a/src/juicebox_asm/insn/dec.rs.html
+++ b/src/juicebox_asm/insn/dec.rs.html
@@ -11,7 +11,9 @@
 11
 12
 13
-
use crate::prelude::*;
+14
+
use super::Dec;
+use crate::{Asm, Reg32, Reg64};
 
 impl Dec<Reg64> for Asm {
     fn dec(&mut self, op1: Reg64) {
diff --git a/src/juicebox_asm/insn/jmp.rs.html b/src/juicebox_asm/insn/jmp.rs.html
index 55da0e3..e0167e3 100644
--- a/src/juicebox_asm/insn/jmp.rs.html
+++ b/src/juicebox_asm/insn/jmp.rs.html
@@ -5,7 +5,9 @@
 5
 6
 7
-
use crate::prelude::*;
+8
+
use super::Jmp;
+use crate::{Asm, Label};
 
 impl Jmp<&mut Label> for Asm {
     fn jmp(&mut self, op1: &mut Label) {
diff --git a/src/juicebox_asm/insn/jnz.rs.html b/src/juicebox_asm/insn/jnz.rs.html
index 45fb92d..be0062d 100644
--- a/src/juicebox_asm/insn/jnz.rs.html
+++ b/src/juicebox_asm/insn/jnz.rs.html
@@ -5,7 +5,9 @@
 5
 6
 7
-
use crate::prelude::*;
+8
+
use super::Jnz;
+use crate::{Asm, Label};
 
 impl Jnz<&mut Label> for Asm {
     fn jnz(&mut self, op1: &mut Label) {
diff --git a/src/juicebox_asm/insn/jz.rs.html b/src/juicebox_asm/insn/jz.rs.html
index 4b17a71..e4197af 100644
--- a/src/juicebox_asm/insn/jz.rs.html
+++ b/src/juicebox_asm/insn/jz.rs.html
@@ -5,7 +5,9 @@
 5
 6
 7
-
use crate::prelude::*;
+8
+
use super::Jz;
+use crate::{Asm, Label};
 
 impl Jz<&mut Label> for Asm {
     fn jz(&mut self, op1: &mut Label) {
diff --git a/src/juicebox_asm/insn/mov.rs.html b/src/juicebox_asm/insn/mov.rs.html
index 7be5d09..1e672a1 100644
--- a/src/juicebox_asm/insn/mov.rs.html
+++ b/src/juicebox_asm/insn/mov.rs.html
@@ -111,7 +111,9 @@
 111
 112
 113
-
use crate::prelude::*;
+114
+
use super::Mov;
+use crate::{Asm, Imm16, Imm32, Imm64, Imm8, MemOp, Reg16, Reg32, Reg64, Reg8};
 
 // -- MOV : reg reg
 
diff --git a/src/juicebox_asm/insn/nop.rs.html b/src/juicebox_asm/insn/nop.rs.html
index accc13a..c3c264b 100644
--- a/src/juicebox_asm/insn/nop.rs.html
+++ b/src/juicebox_asm/insn/nop.rs.html
@@ -5,10 +5,12 @@
 5
 6
 7
+8
 
use crate::Asm;
 
 impl Asm {
-    pub fn nop(&mut self) {
+    /// Emit a [`nop`](https://www.felixcloutier.com/x86/nop) instruction.
+    pub fn nop(&mut self) {
         self.emit(&[0x90]);
     }
 }
diff --git a/src/juicebox_asm/insn/ret.rs.html b/src/juicebox_asm/insn/ret.rs.html
index 97070e8..26e3a47 100644
--- a/src/juicebox_asm/insn/ret.rs.html
+++ b/src/juicebox_asm/insn/ret.rs.html
@@ -5,10 +5,12 @@
 5
 6
 7
+8
 
use crate::Asm;
 
 impl Asm {
-    pub fn ret(&mut self) {
+    /// Emit a [`ret`](https://www.felixcloutier.com/x86/ret) instruction.
+    pub fn ret(&mut self) {
         self.emit(&[0xc3]);
     }
 }
diff --git a/src/juicebox_asm/insn/test.rs.html b/src/juicebox_asm/insn/test.rs.html
index d636920..0f1d8da 100644
--- a/src/juicebox_asm/insn/test.rs.html
+++ b/src/juicebox_asm/insn/test.rs.html
@@ -17,7 +17,9 @@
 17
 18
 19
-
use crate::prelude::*;
+20
+

use super::Test;
+use crate::{Asm, Imm16, MemOp, Reg32, Reg64};
 
 impl Test<Reg64, Reg64> for Asm {
     fn test(&mut self, op1: Reg64, op2: Reg64) {
diff --git a/src/juicebox_asm/label.rs.html b/src/juicebox_asm/label.rs.html
index e209289..29d236e 100644
--- a/src/juicebox_asm/label.rs.html
+++ b/src/juicebox_asm/label.rs.html
@@ -80,6 +80,7 @@
 80
 81
 82
+83
 
//! Definition of the lable type which can be used as jump target and can be bound to a location in
 //! the emitted code.
 
@@ -88,7 +89,8 @@
 /// A label which is used as target for jump instructions.
 ///
 /// ```rust
-/// use juicebox_asm::prelude::*;
+/// use juicebox_asm::{Asm, Label, Reg64};
+/// use juicebox_asm::insn::{Mov, Jmp};
 ///
 /// let mut lbl = Label::new();
 /// let mut asm = Asm::new();
diff --git a/src/juicebox_asm/lib.rs.html b/src/juicebox_asm/lib.rs.html
index 83c8f81..7d1bc0c 100644
--- a/src/juicebox_asm/lib.rs.html
+++ b/src/juicebox_asm/lib.rs.html
@@ -105,373 +105,12 @@
 105
 106
 107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-280
-281
-282
-283
-284
-285
-286
-287
-288
-289
-290
-291
-292
-293
-294
-295
-296
-297
-298
-299
-300
-301
-302
-303
-304
-305
-306
-307
-308
-309
-310
-311
-312
-313
-314
-315
-316
-317
-318
-319
-320
-321
-322
-323
-324
-325
-326
-327
-328
-329
-330
-331
-332
-333
-334
-335
-336
-337
-338
-339
-340
-341
-342
-343
-344
-345
-346
-347
-348
-349
-350
-351
-352
-353
-354
-355
-356
-357
-358
-359
-360
-361
-362
-363
-364
-365
-366
-367
-368
-369
-370
-371
-372
-373
-374
-375
-376
-377
-378
-379
-380
-381
-382
-383
-384
-385
-386
-387
-388
-389
-390
-391
-392
-393
-394
-395
-396
-397
-398
-399
-400
-401
-402
-403
-404
-405
-406
-407
-408
-409
-410
-411
-412
-413
-414
-415
-416
-417
-418
-419
-420
-421
-422
-423
-424
-425
-426
-427
-428
-429
-430
-431
-432
-433
-434
-435
-436
-437
-438
-439
-440
-441
-442
-443
-444
-445
-446
-447
-448
-449
-450
-451
-452
-453
-454
-455
-456
-457
-458
-459
-460
-461
-462
-463
-464
-465
-466
-467
-468
-469
 
//! A simple `x64` jit assembler with a minimal runtime to execute emitted code for fun.
 //!
 //! The following is an fibonacci example implementation.
 //! ```rust
-//! use juicebox_asm::prelude::*;
+//! use juicebox_asm::{Asm, Reg64, Imm64, Label};
+//! use juicebox_asm::insn::*;
 //! use juicebox_asm::Runtime;
 //!
 //! const fn fib_rs(n: u64) -> u64 {
@@ -541,22 +180,20 @@
 //! }
 //! ```
 
-pub mod prelude;
-
+mod asm;
 mod imm;
-mod insn;
 mod label;
 mod reg;
 mod rt;
 
+pub mod insn;
+
+pub use asm::Asm;
 pub use imm::{Imm16, Imm32, Imm64, Imm8};
 pub use label::Label;
 pub use reg::{Reg16, Reg32, Reg64, Reg8};
 pub use rt::Runtime;
 
-use imm::Imm;
-use reg::Reg;
-
 /// Type representing a memory operand.
 pub enum MemOp {
     /// An indirect memory operand, eg `mov [rax], rcx`.
@@ -575,365 +212,4 @@
         }
     }
 }
-
-/// Encode the `REX` byte.
-const fn rex(w: bool, r: u8, x: u8, b: u8) -> u8 {
-    let w = if w { 1 } else { 0 };
-    let r = (r >> 3) & 1;
-    let x = (x >> 3) & 1;
-    let b = (b >> 3) & 1;
-    0b0100_0000 | ((w & 1) << 3) | (r << 2) | (x << 1) | b
-}
-
-/// Encode the `ModR/M` byte.
-const fn modrm(mod_: u8, reg: u8, rm: u8) -> u8 {
-    ((mod_ & 0b11) << 6) | ((reg & 0b111) << 3) | (rm & 0b111)
-}
-
-/// `x64` jit assembler.
-pub struct Asm {
-    buf: Vec<u8>,
-}
-
-impl Asm {
-    /// Create a new `x64` jit assembler.
-    pub fn new() -> Asm {
-        // Some random default capacity.
-        let buf = Vec::with_capacity(1024);
-        Asm { buf }
-    }
-
-    /// Consume the assembler and get the emitted code.
-    pub fn into_code(self) -> Vec<u8> {
-        self.buf
-    }
-
-    /// Emit a slice of bytes.
-    fn emit(&mut self, bytes: &[u8]) {
-        self.buf.extend_from_slice(bytes);
-    }
-
-    /// Emit a slice of optional bytes.
-    fn emit_optional(&mut self, bytes: &[Option<u8>]) {
-        for byte in bytes.iter().filter_map(|&b| b) {
-            self.buf.push(byte);
-        }
-    }
-
-    /// Emit a slice of bytes at `pos`.
-    ///
-    /// # Panics
-    ///
-    /// Panics if [pos..pos+len] indexes out of bound of the underlying code buffer.
-    fn emit_at(&mut self, pos: usize, bytes: &[u8]) {
-        if let Some(buf) = self.buf.get_mut(pos..pos + bytes.len()) {
-            buf.copy_from_slice(bytes);
-        } else {
-            unimplemented!();
-        }
-    }
-
-    /// Bind the [Label] to the current location.
-    pub fn bind(&mut self, label: &mut Label) {
-        // Bind the label to the current offset.
-        label.bind(self.buf.len());
-
-        // Resolve any pending relocations for the label.
-        self.resolve(label);
-    }
-
-    /// If the [Label] is bound, patch any pending relocation.
-    pub fn resolve(&mut self, label: &mut Label) {
-        if let Some(loc) = label.location() {
-            // For now we only support disp32 as label location.
-            let loc = i32::try_from(loc).expect("Label location did not fit into i32.");
-
-            // Resolve any pending relocations for the label.
-            for off in label.offsets_mut().drain() {
-                // Displacement is relative to the next instruction following the jump.
-                // We record the offset to patch at the first byte of the disp32 therefore we need
-                // to account for that in the disp computation.
-                let disp32 = loc - i32::try_from(off).expect("Label offset did not fit into i32") - 4 /* account for the disp32 */;
-
-                // Patch the relocation with the disp32.
-                self.emit_at(off, &disp32.to_ne_bytes());
-            }
-        }
-    }
-
-    // -- Encode utilities.
-
-    /// Encode an register-register instruction.
-    fn encode_rr<T: Reg>(&mut self, opc: u8, op1: T, op2: T)
-    where
-        Self: EncodeRR<T>,
-    {
-        // MR operand encoding.
-        //   op1 -> modrm.rm
-        //   op2 -> modrm.reg
-        let modrm = modrm(
-            0b11,      /* mod */
-            op2.idx(), /* reg */
-            op1.idx(), /* rm */
-        );
-
-        let prefix = <Self as EncodeRR<T>>::legacy_prefix();
-        let rex = <Self as EncodeRR<T>>::rex(op1, op2);
-
-        self.emit_optional(&[prefix, rex]);
-        self.emit(&[opc, modrm]);
-    }
-
-    /// Encode an offset-immediate instruction.
-    /// Register idx is encoded in the opcode.
-    fn encode_oi<T: Reg, U: Imm>(&mut self, opc: u8, op1: T, op2: U)
-    where
-        Self: EncodeR<T>,
-    {
-        let opc = opc + (op1.idx() & 0b111);
-        let prefix = <Self as EncodeR<T>>::legacy_prefix();
-        let rex = <Self as EncodeR<T>>::rex(op1);
-
-        self.emit_optional(&[prefix, rex]);
-        self.emit(&[opc]);
-        self.emit(op2.bytes());
-    }
-
-    /// Encode a register-immediate instruction.
-    fn encode_ri<T: Reg, U: Imm>(&mut self, opc: u8, opc_ext: u8, op1: T, op2: U)
-    where
-        Self: EncodeR<T>,
-    {
-        // MI operand encoding.
-        //   op1           -> modrm.rm
-        //   opc extension -> modrm.reg
-        let modrm = modrm(
-            0b11,      /* mod */
-            opc_ext,   /* reg */
-            op1.idx(), /* rm */
-        );
-
-        let prefix = <Self as EncodeR<T>>::legacy_prefix();
-        let rex = <Self as EncodeR<T>>::rex(op1);
-
-        self.emit_optional(&[prefix, rex]);
-        self.emit(&[opc, modrm]);
-        self.emit(op2.bytes());
-    }
-
-    /// Encode a register instruction.
-    fn encode_r<T: Reg>(&mut self, opc: u8, opc_ext: u8, op1: T)
-    where
-        Self: EncodeR<T>,
-    {
-        // M operand encoding.
-        //   op1           -> modrm.rm
-        //   opc extension -> modrm.reg
-        let modrm = modrm(
-            0b11,      /* mod */
-            opc_ext,   /* reg */
-            op1.idx(), /* rm */
-        );
-
-        let prefix = <Self as EncodeR<T>>::legacy_prefix();
-        let rex = <Self as EncodeR<T>>::rex(op1);
-
-        self.emit_optional(&[prefix, rex]);
-        self.emit(&[opc, modrm]);
-    }
-
-    /// Encode a memory-immediate instruction.
-    fn encode_mi<T: Imm>(&mut self, opc: u8, opc_ext: u8, op1: MemOp, op2: T)
-    where
-        Self: EncodeMI<T>,
-    {
-        // MI operand encoding.
-        //   op1 -> modrm.rm
-        //   op2 -> imm
-        let mode = match op1 {
-            MemOp::Indirect(..) => {
-                assert!(!op1.base().need_sib() && !op1.base().is_pc_rel());
-                0b00
-            }
-            MemOp::IndirectDisp(..) => {
-                assert!(!op1.base().need_sib());
-                0b10
-            }
-        };
-
-        let modrm = modrm(
-            mode,             /* mode */
-            opc_ext,          /* reg */
-            op1.base().idx(), /* rm */
-        );
-
-        let prefix = <Self as EncodeMI<T>>::legacy_prefix();
-        let rex = <Self as EncodeMI<T>>::rex(&op1);
-
-        self.emit_optional(&[prefix, rex]);
-        self.emit(&[opc, modrm]);
-        if let MemOp::IndirectDisp(_, disp) = op1 {
-            self.emit(&disp.to_ne_bytes());
-        }
-        self.emit(op2.bytes());
-    }
-
-    /// Encode a memory-register instruction.
-    fn encode_mr<T: Reg>(&mut self, opc: u8, op1: MemOp, op2: T)
-    where
-        Self: EncodeMR<T>,
-    {
-        // MR operand encoding.
-        //   op1 -> modrm.rm
-        //   op2 -> modrm.reg
-        let mode = match op1 {
-            MemOp::Indirect(..) => {
-                assert!(!op1.base().need_sib() && !op1.base().is_pc_rel());
-                0b00
-            }
-            MemOp::IndirectDisp(..) => {
-                assert!(!op1.base().need_sib());
-                0b10
-            }
-        };
-
-        let modrm = modrm(
-            mode,             /* mode */
-            op2.idx(),        /* reg */
-            op1.base().idx(), /* rm */
-        );
-        let prefix = <Self as EncodeMR<T>>::legacy_prefix();
-        let rex = <Self as EncodeMR<T>>::rex(&op1, op2);
-
-        self.emit_optional(&[prefix, rex]);
-        self.emit(&[opc, modrm]);
-        if let MemOp::IndirectDisp(_, disp) = op1 {
-            self.emit(&disp.to_ne_bytes());
-        }
-    }
-
-    /// Encode a register-memory instruction.
-    fn encode_rm<T: Reg>(&mut self, opc: u8, op1: T, op2: MemOp)
-    where
-        Self: EncodeMR<T>,
-    {
-        // RM operand encoding.
-        //   op1 -> modrm.reg
-        //   op2 -> modrm.rm
-        self.encode_mr(opc, op2, op1);
-    }
-
-    /// Encode a jump to label instruction.
-    fn encode_jmp_label(&mut self, opc: &[u8], op1: &mut Label) {
-        // Emit the opcode.
-        self.emit(opc);
-
-        // Record relocation offset starting at the first byte of the disp32.
-        op1.record_offset(self.buf.len());
-
-        // Emit a zeroed disp32, which serves as placeholder for the relocation.
-        // We currently only support disp32 jump targets.
-        self.emit(&[0u8; 4]);
-
-        // Resolve any pending relocations for the label.
-        self.resolve(op1);
-    }
-}
-
-// -- Encoder helper.
-
-/// Encode helper for register-register instructions.
-trait EncodeRR<T: Reg> {
-    fn legacy_prefix() -> Option<u8> {
-        None
-    }
-
-    fn rex(op1: T, op2: T) -> Option<u8> {
-        if op1.need_rex() || op2.need_rex() {
-            Some(rex(op1.rexw(), op2.idx(), 0, op1.idx()))
-        } else {
-            None
-        }
-    }
-}
-
-impl EncodeRR<Reg8> for Asm {}
-impl EncodeRR<Reg32> for Asm {}
-impl EncodeRR<Reg16> for Asm {
-    fn legacy_prefix() -> Option<u8> {
-        Some(0x66)
-    }
-}
-impl EncodeRR<Reg64> for Asm {}
-
-/// Encode helper for register instructions.
-trait EncodeR<T: Reg> {
-    fn legacy_prefix() -> Option<u8> {
-        None
-    }
-
-    fn rex(op1: T) -> Option<u8> {
-        if op1.need_rex() {
-            Some(rex(op1.rexw(), 0, 0, op1.idx()))
-        } else {
-            None
-        }
-    }
-}
-
-impl EncodeR<Reg8> for Asm {}
-impl EncodeR<Reg32> for Asm {}
-impl EncodeR<Reg16> for Asm {
-    fn legacy_prefix() -> Option<u8> {
-        Some(0x66)
-    }
-}
-impl EncodeR<Reg64> for Asm {}
-
-/// Encode helper for memory-register instructions.
-trait EncodeMR<T: Reg> {
-    fn legacy_prefix() -> Option<u8> {
-        None
-    }
-
-    fn rex(op1: &MemOp, op2: T) -> Option<u8> {
-        if op2.need_rex() || (op1.base().is_ext()) {
-            Some(rex(op2.rexw(), op2.idx(), 0, op1.base().idx()))
-        } else {
-            None
-        }
-    }
-}
-
-impl EncodeMR<Reg8> for Asm {}
-impl EncodeMR<Reg16> for Asm {
-    fn legacy_prefix() -> Option<u8> {
-        Some(0x66)
-    }
-}
-impl EncodeMR<Reg32> for Asm {}
-impl EncodeMR<Reg64> for Asm {}
-
-/// Encode helper for memory-immediate instructions.
-trait EncodeMI<T: Imm> {
-    fn legacy_prefix() -> Option<u8> {
-        None
-    }
-
-    fn rex(op1: &MemOp) -> Option<u8> {
-        if op1.base().is_ext() {
-            Some(rex(false, 0, 0, op1.base().idx()))
-        } else {
-            None
-        }
-    }
-}
-
-impl EncodeMI<Imm8> for Asm {}
-impl EncodeMI<Imm16> for Asm {
-    fn legacy_prefix() -> Option<u8> {
-        Some(0x66)
-    }
-}
-impl EncodeMI<Imm32> for Asm {}
 
\ No newline at end of file diff --git a/src/juicebox_asm/prelude.rs.html b/src/juicebox_asm/prelude.rs.html deleted file mode 100644 index e877286..0000000 --- a/src/juicebox_asm/prelude.rs.html +++ /dev/null @@ -1,21 +0,0 @@ -prelude.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-
//! Crate prelude, which can be used to import the most important types at once.
-
-pub use crate::Asm;
-pub use crate::MemOp;
-
-pub use crate::imm::{Imm16, Imm32, Imm64, Imm8};
-pub use crate::label::Label;
-pub use crate::reg::{Reg16, Reg32, Reg64, Reg8};
-
-pub use crate::insn::{Add, Call, Cmp, Dec, Jmp, Jnz, Jz, Mov, Test};
-
\ No newline at end of file diff --git a/src/juicebox_asm/reg.rs.html b/src/juicebox_asm/reg.rs.html index a511005..fe4b50c 100644 --- a/src/juicebox_asm/reg.rs.html +++ b/src/juicebox_asm/reg.rs.html @@ -302,36 +302,6 @@ 302 303 304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334
//! Definition of registers which are used as input operands for various instructions.
 
 /// Trait to interact with register operands.
@@ -489,27 +459,21 @@
             assert_eq!(r.idx(), idx);
 
             // Check REX.W bit.
-            assert_eq!(r.rexw(), false);
+            assert!(!r.rexw());
 
             // Check need REX byte.
-            let rex = match r {
-                r8l | r9l | r10l | r11l | r12l | r13l | r14l | r15l | spl | bpl | sil | dil => true,
-                _ => false,
-            };
+            let rex = matches!(
+                r,
+                r8l | r9l | r10l | r11l | r12l | r13l | r14l | r15l | spl | bpl | sil | dil
+            );
             assert_eq!(r.need_rex(), rex);
 
             // Check need SIB byte.
-            let sib = match r {
-                spl | r12l | ah => true,
-                _ => false,
-            };
+            let sib = matches!(r, spl | r12l | ah);
             assert_eq!(r.need_sib(), sib);
 
             // Check if is PC relative addressing.
-            let rel = match r {
-                bpl | r13l | ch => true,
-                _ => false,
-            };
+            let rel = matches!(r, bpl | r13l | ch);
             assert_eq!(r.is_pc_rel(), rel);
         }
     }
@@ -541,27 +505,18 @@
             assert_eq!(r.idx(), idx);
 
             // Check REX.W bit.
-            assert_eq!(r.rexw(), false);
+            assert!(!r.rexw());
 
             // Check need REX byte.
-            let rex = match r {
-                r8w | r9w | r10w | r11w | r12w | r13w | r14w | r15w => true,
-                _ => false,
-            };
+            let rex = matches!(r, r8w | r9w | r10w | r11w | r12w | r13w | r14w | r15w);
             assert_eq!(r.need_rex(), rex);
 
             // Check need SIB byte.
-            let sib = match r {
-                sp | r12w => true,
-                _ => false,
-            };
+            let sib = matches!(r, sp | r12w);
             assert_eq!(r.need_sib(), sib);
 
             // Check if is PC relative addressing.
-            let rel = match r {
-                bp | r13w => true,
-                _ => false,
-            };
+            let rel = matches!(r, bp | r13w);
             assert_eq!(r.is_pc_rel(), rel);
         }
     }
@@ -593,27 +548,18 @@
             assert_eq!(r.idx(), idx);
 
             // Check REX.W bit.
-            assert_eq!(r.rexw(), false);
+            assert!(!r.rexw());
 
             // Check need REX byte.
-            let rex = match r {
-                r8d | r9d | r10d | r11d | r12d | r13d | r14d | r15d => true,
-                _ => false,
-            };
+            let rex = matches!(r, r8d | r9d | r10d | r11d | r12d | r13d | r14d | r15d);
             assert_eq!(r.need_rex(), rex);
 
             // Check need SIB byte.
-            let sib = match r {
-                esp | r12d => true,
-                _ => false,
-            };
+            let sib = matches!(r, esp | r12d);
             assert_eq!(r.need_sib(), sib);
 
             // Check if is PC relative addressing.
-            let rel = match r {
-                ebp | r13d => true,
-                _ => false,
-            };
+            let rel = matches!(r, ebp | r13d);
             assert_eq!(r.is_pc_rel(), rel);
         }
     }
@@ -645,23 +591,17 @@
             assert_eq!(r.idx(), idx);
 
             // Check REX.W bit.
-            assert_eq!(r.rexw(), true);
+            assert!(r.rexw());
 
             // Check need REX byte.
-            assert_eq!(r.need_rex(), true);
+            assert!(r.need_rex());
 
             // Check need SIB byte.
-            let sib = match r {
-                rsp | r12 => true,
-                _ => false,
-            };
+            let sib = matches!(r, rsp | r12);
             assert_eq!(r.need_sib(), sib);
 
             // Check if is PC relative addressing.
-            let rel = match r {
-                rbp | r13 => true,
-                _ => false,
-            };
+            let rel = matches!(r, rbp | r13);
             assert_eq!(r.is_pc_rel(), rel);
         }
     }
diff --git a/src/juicebox_asm/rt.rs.html b/src/juicebox_asm/rt.rs.html
index 244be8b..efc55d3 100644
--- a/src/juicebox_asm/rt.rs.html
+++ b/src/juicebox_asm/rt.rs.html
@@ -86,10 +86,129 @@
 86
 87
 88
-
//! A simple runtime which can be used to execute emitted instructions.
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+
//! Simple `mmap`ed runtime.
+//!
+//! This runtime supports adding code to executable pages and turn the added code into user
+//! specified function pointer.
 
-use core::slice;
-use nix::sys::mman::{mmap, mprotect, munmap, MapFlags, ProtFlags};
+use nix::sys::mman::{mmap, mprotect, munmap, MapFlags, ProtFlags};
+
+#[cfg(not(target_os = "linux"))]
+compile_error!("This runtime is only supported on linux");
 
 /// A simple `mmap`ed runtime with executable pages.
 pub struct Runtime {
@@ -100,19 +219,23 @@
 
 impl Runtime {
     /// Create a new [Runtime].
+    ///
+    /// # Panics
+    ///
+    /// Panics if the `mmap` call fails.
     pub fn new() -> Runtime {
         // Allocate a single page.
-        let len = core::num::NonZeroUsize::new(4096).unwrap();
+        let len = core::num::NonZeroUsize::new(4096).expect("Value is non zero");
         let buf = unsafe {
             mmap(
                 None,
                 len,
-                ProtFlags::PROT_WRITE | ProtFlags::PROT_READ | ProtFlags::PROT_EXEC,
+                ProtFlags::PROT_NONE,
                 MapFlags::MAP_PRIVATE | MapFlags::MAP_ANONYMOUS,
                 0, /* fd */
                 0, /* off */
             )
-            .unwrap() as *mut u8
+            .expect("Failed to mmap runtime code page") as *mut u8
         };
 
         Runtime {
@@ -122,55 +245,160 @@
         }
     }
 
-    /// Write protect the underlying code page(s).
-    pub fn protect(&mut self) {
-        unsafe {
-            // Remove write permissions from code buffer and allow to read-execute from it.
-            mprotect(
-                self.buf.cast(),
-                self.len,
-                ProtFlags::PROT_READ | ProtFlags::PROT_EXEC,
-            )
-            .expect("Failed to RX mprotect Runtime code buffer");
-        }
-    }
-
-    /// Add block of code to the runtime and get function pointer back.
+    /// Add the block of `code` to the runtime and a get function pointer of type `F`.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the `code` does not fit on the `mmap`ed pages or is empty.
+    ///
+    /// # Safety
+    ///
+    /// The code added must fulfill the ABI of the specified function `F` and the returned function
+    /// pointer is only valid until the [`Runtime`] is dropped.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let mut rt = juicebox_asm::Runtime::new();
+    ///
+    /// let code = [ 0x90 /* nop */, 0xc3 /* ret */ ];
+    /// let nop = unsafe { rt.add_code::<extern "C" fn()>(&code) };
+    ///
+    /// nop();
+    /// ```
     pub unsafe fn add_code<F>(&mut self, code: impl AsRef<[u8]>) -> F {
         // Get pointer to start of next free byte.
-        assert!(self.idx < self.len);
+        assert!(self.idx < self.len, "Runtime code page full");
         let fn_start = self.buf.add(self.idx);
 
         // Copy over code.
         let code = code.as_ref();
-        assert!(code.len() < (self.len - self.idx));
+        assert!(!code.is_empty(), "Adding empty code not supported");
+        assert!(
+            code.len() <= (self.len - self.idx),
+            "Code does not fit on the runtime code page"
+        );
+        self.unprotect();
         unsafe { std::ptr::copy_nonoverlapping(code.as_ptr(), fn_start, code.len()) };
+        self.protect();
 
         // Increment index to next free byte.
         self.idx += code.len();
 
         // Return function to newly added code.
-        Self::as_fn::<F>(fn_start)
+        unsafe { Self::as_fn::<F>(fn_start) }
     }
 
-    /// Reinterpret the block of code as `F`.
+    /// Dump the code added so far to the runtime into a file called `jit.asm` in the processes
+    /// current working directory.
+    ///
+    /// The code can be inspected with a disassembler as for example `ndiasm` from
+    /// [nasm.us](https://nasm.us/index.php).
+    /// ```sh
+    /// ndisasm -b 64 jit.asm
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Panics if writing the file failed.
+    pub fn dump(&self) {
+        assert!(self.idx <= self.len);
+        let code = unsafe { core::slice::from_raw_parts(self.buf, self.idx) };
+        std::fs::write("jit.asm", code).expect("Failed to write file");
+    }
+
+    /// Reinterpret the block of code pointed to by `fn_start` as `F`.
     #[inline]
     unsafe fn as_fn<F>(fn_start: *mut u8) -> F {
         unsafe { std::mem::transmute_copy(&fn_start) }
     }
 
-    /// Dump the currently added code to a file called `jit.asm`. The disassembly can be inspected
-    /// as `ndisasm -b 64 jit.asm`.
-    pub fn dump(&self) {
-        let code = unsafe { slice::from_raw_parts(self.buf, self.idx) };
-        std::fs::write("jit.asm", code).unwrap();
+    /// Add write protection the underlying code page(s).
+    ///
+    /// # Panics
+    ///
+    /// Panics if the `mprotect` call fails.
+    fn protect(&mut self) {
+        unsafe {
+            // Remove write permissions from code page and allow to read-execute from it.
+            mprotect(
+                self.buf.cast(),
+                self.len,
+                ProtFlags::PROT_READ | ProtFlags::PROT_EXEC,
+            )
+            .expect("Failed to RX mprotect runtime code page");
+        }
+    }
+
+    /// Remove write protection the underlying code page(s).
+    ///
+    /// # Panics
+    ///
+    /// Panics if the `mprotect` call fails.
+    fn unprotect(&mut self) {
+        unsafe {
+            // Add write permissions to code page.
+            mprotect(self.buf.cast(), self.len, ProtFlags::PROT_WRITE)
+                .expect("Failed to W mprotect runtime code page");
+        }
     }
 }
 
 impl Drop for Runtime {
-    fn drop(&mut self) {
+    /// Unmaps the code page. This invalidates all the function pointer returned by
+    /// [`Runtime::add_code`].
+    fn drop(&mut self) {
+        unsafe {
+            munmap(self.buf.cast(), self.len).expect("Failed to munmap runtime");
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn test_code_max_size() {
+        let mut rt = Runtime::new();
+        let code = [0u8; 4096];
+        unsafe {
+            rt.add_code::<extern "C" fn()>(code);
+        }
+    }
+
+    #[test]
+    #[should_panic]
+    fn test_code_max_size_plus_1() {
+        let mut rt = Runtime::new();
+        let code = [0u8; 4097];
+        unsafe {
+            rt.add_code::<extern "C" fn()>(code);
+        }
+    }
+
+    #[test]
+    #[should_panic]
+    fn test_code_max_size_plus_1_2() {
+        let mut rt = Runtime::new();
+        let code = [0u8; 4096];
+        unsafe {
+            rt.add_code::<extern "C" fn()>(code);
+        }
+
+        let code = [0u8; 1];
+        unsafe {
+            rt.add_code::<extern "C" fn()>(code);
+        }
+    }
+
+    #[test]
+    #[should_panic]
+    fn test_empty_code() {
+        let mut rt = Runtime::new();
+        let code = [0u8; 0];
         unsafe {
-            munmap(self.buf.cast(), self.len).expect("Failed to munmap Runtime");
+            rt.add_code::<extern "C" fn()>(code);
         }
     }
 }
diff --git a/src/tiny_vm/tiny_vm.rs.html b/src/tiny_vm/tiny_vm.rs.html
index b986ed6..7de10c9 100644
--- a/src/tiny_vm/tiny_vm.rs.html
+++ b/src/tiny_vm/tiny_vm.rs.html
@@ -695,6 +695,7 @@
 695
 696
 697
+698
 
//! TinyVm example.
 //!
 //! This example introduces as simple 16 bit virtual machine the [`TinyVm`]. The VM consits of
@@ -736,8 +737,9 @@
 #[cfg(not(any(target_arch = "x86_64", target_os = "linux")))]
 compile_error!("Only supported on x86_64 with SystemV abi");
 
-use juicebox_asm::prelude::*;
+use juicebox_asm::insn::*;
 use juicebox_asm::Runtime;
+use juicebox_asm::{Asm, Imm16, Imm64, Label, MemOp, Reg16, Reg64};
 
 /// A guest physical address.
 pub struct PhysAddr(pub u16);
diff --git a/tiny_vm/enum.TinyInsn.html b/tiny_vm/enum.TinyInsn.html
index ac8d1b9..57b3487 100644
--- a/tiny_vm/enum.TinyInsn.html
+++ b/tiny_vm/enum.TinyInsn.html
@@ -1,4 +1,4 @@
-TinyInsn in tiny_vm - Rust

Enum tiny_vm::TinyInsn

source ·
pub enum TinyInsn {
+TinyInsn in tiny_vm - Rust

Enum tiny_vm::TinyInsn

source ·
pub enum TinyInsn {
     Halt,
     LoadImm(TinyReg, u16),
     Load(TinyReg, u16),
@@ -16,9 +16,9 @@
 
§

Addi(TinyReg, i16)

Add the immediate to the register reg += imm.

§

Branch(usize)

Jump unconditional (absolute addressing) pc = disp.

§

BranchZero(TinyReg, usize)

Jump if the register is zero (absolute addressing) pc = (reg == 0) ? disp : pc++.

-

Trait Implementations§

source§

impl Clone for TinyInsn

source§

fn clone(&self) -> TinyInsn

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TinyInsn

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<TinyInsn> for TinyInsn

source§

fn eq(&self, other: &TinyInsn) -> bool

This method tests for self and other values to be equal, and is used +

Trait Implementations§

source§

impl Clone for TinyInsn

source§

fn clone(&self) -> TinyInsn

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TinyInsn

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<TinyInsn> for TinyInsn

source§

fn eq(&self, other: &TinyInsn) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason.
source§

impl Copy for TinyInsn

source§

impl StructuralPartialEq for TinyInsn

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere +sufficient, and should not be overridden without very good reason.

source§

impl Copy for TinyInsn

source§

impl StructuralPartialEq for TinyInsn

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/tiny_vm/enum.TinyReg.html b/tiny_vm/enum.TinyReg.html index 61495de..a5c9df9 100644 --- a/tiny_vm/enum.TinyReg.html +++ b/tiny_vm/enum.TinyReg.html @@ -1,11 +1,11 @@ -TinyReg in tiny_vm - Rust

Enum tiny_vm::TinyReg

source ·
pub enum TinyReg {
+TinyReg in tiny_vm - Rust

Enum tiny_vm::TinyReg

source ·
pub enum TinyReg {
     A,
     B,
     C,
 }
Expand description

The registers for the TinyVm.

-

Variants§

Trait Implementations§

source§

impl Clone for TinyReg

source§

fn clone(&self) -> TinyReg

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TinyReg

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<TinyReg> for TinyReg

source§

fn eq(&self, other: &TinyReg) -> bool

This method tests for self and other values to be equal, and is used +

Variants§

Trait Implementations§

source§

impl Clone for TinyReg

source§

fn clone(&self) -> TinyReg

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TinyReg

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<TinyReg> for TinyReg

source§

fn eq(&self, other: &TinyReg) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason.
source§

impl Copy for TinyReg

source§

impl StructuralPartialEq for TinyReg

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere +sufficient, and should not be overridden without very good reason.

source§

impl Copy for TinyReg

source§

impl StructuralPartialEq for TinyReg

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/tiny_vm/fn.make_tinyvm_fib.html b/tiny_vm/fn.make_tinyvm_fib.html index 03ed4e0..4ccf6e5 100644 --- a/tiny_vm/fn.make_tinyvm_fib.html +++ b/tiny_vm/fn.make_tinyvm_fib.html @@ -1,2 +1,2 @@ -make_tinyvm_fib in tiny_vm - Rust

Function tiny_vm::make_tinyvm_fib

source ·
pub fn make_tinyvm_fib(start_n: u16) -> Vec<TinyInsn>
Expand description

Generate a guest program to compute the fiibonacci sequence for n.

+make_tinyvm_fib in tiny_vm - Rust

Function tiny_vm::make_tinyvm_fib

source ·
pub fn make_tinyvm_fib(start_n: u16) -> Vec<TinyInsn>
Expand description

Generate a guest program to compute the fiibonacci sequence for n.

\ No newline at end of file diff --git a/tiny_vm/fn.make_tinyvm_jit_perf.html b/tiny_vm/fn.make_tinyvm_jit_perf.html index fa4fee2..28089e3 100644 --- a/tiny_vm/fn.make_tinyvm_jit_perf.html +++ b/tiny_vm/fn.make_tinyvm_jit_perf.html @@ -1,2 +1,2 @@ -make_tinyvm_jit_perf in tiny_vm - Rust
pub fn make_tinyvm_jit_perf() -> Vec<TinyInsn>
Expand description

Generate a simple count down loop to crunch some instructions.

+make_tinyvm_jit_perf in tiny_vm - Rust
pub fn make_tinyvm_jit_perf() -> Vec<TinyInsn>
Expand description

Generate a simple count down loop to crunch some instructions.

\ No newline at end of file diff --git a/tiny_vm/fn.make_tinyvm_jit_test.html b/tiny_vm/fn.make_tinyvm_jit_test.html index 88ebf5b..903f42c 100644 --- a/tiny_vm/fn.make_tinyvm_jit_test.html +++ b/tiny_vm/fn.make_tinyvm_jit_test.html @@ -1,2 +1,2 @@ -make_tinyvm_jit_test in tiny_vm - Rust
pub fn make_tinyvm_jit_test() -> Vec<TinyInsn>
Expand description

Generate a test program for the jit.

+make_tinyvm_jit_test in tiny_vm - Rust
pub fn make_tinyvm_jit_test() -> Vec<TinyInsn>
Expand description

Generate a test program for the jit.

\ No newline at end of file diff --git a/tiny_vm/index.html b/tiny_vm/index.html index 38f37bd..0323d25 100644 --- a/tiny_vm/index.html +++ b/tiny_vm/index.html @@ -1,4 +1,4 @@ -tiny_vm - Rust

Crate tiny_vm

source ·
Expand description

TinyVm example.

+tiny_vm - Rust

Crate tiny_vm

source ·
Expand description

TinyVm example.

This example introduces as simple 16 bit virtual machine the TinyVm. The VM consits of three registers defined in TinyReg, a separate data and insutrction memory and a small set of instructions TinyInsn, sufficient to implement a guest program to compute the diff --git a/tiny_vm/struct.Fixup.html b/tiny_vm/struct.Fixup.html index 0711c0b..83e7fb1 100644 --- a/tiny_vm/struct.Fixup.html +++ b/tiny_vm/struct.Fixup.html @@ -1,6 +1,6 @@ -Fixup in tiny_vm - Rust

Struct tiny_vm::Fixup

source ·
pub struct Fixup { /* private fields */ }
Expand description

A minial fixup utility to implement jump labels when constructing guest programs.

-

Implementations§

source§

impl Fixup

source

pub fn new(pc: usize) -> Self

Create a new Fixup at the current pc.

-
source

pub fn bind(self, prog: &mut Vec<TinyInsn>)

Bind the Fixup to the current location of prog and resolve the Fixup.

+Fixup in tiny_vm - Rust

Struct tiny_vm::Fixup

source ·
pub struct Fixup { /* private fields */ }
Expand description

A minial fixup utility to implement jump labels when constructing guest programs.

+

Implementations§

source§

impl Fixup

source

pub fn new(pc: usize) -> Self

Create a new Fixup at the current pc.

+
source

pub fn bind(self, prog: &mut Vec<TinyInsn>)

Bind the Fixup to the current location of prog and resolve the Fixup.

Auto Trait Implementations§

§

impl RefUnwindSafe for Fixup

§

impl Send for Fixup

§

impl Sync for Fixup

§

impl Unpin for Fixup

§

impl UnwindSafe for Fixup

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere diff --git a/tiny_vm/struct.PhysAddr.html b/tiny_vm/struct.PhysAddr.html index 3e549f7..6f09f30 100644 --- a/tiny_vm/struct.PhysAddr.html +++ b/tiny_vm/struct.PhysAddr.html @@ -1,5 +1,5 @@ -PhysAddr in tiny_vm - Rust

Struct tiny_vm::PhysAddr

source ·
pub struct PhysAddr(pub u16);
Expand description

A guest physical address.

-

Tuple Fields§

§0: u16

Trait Implementations§

source§

impl Into<usize> for PhysAddr

source§

fn into(self) -> usize

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere +PhysAddr in tiny_vm - Rust

Struct tiny_vm::PhysAddr

source ·
pub struct PhysAddr(pub u16);
Expand description

A guest physical address.

+

Tuple Fields§

§0: u16

Trait Implementations§

source§

impl Into<usize> for PhysAddr

source§

fn into(self) -> usize

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

diff --git a/tiny_vm/struct.TinyVm.html b/tiny_vm/struct.TinyVm.html index a7c57cf..9932a6a 100644 --- a/tiny_vm/struct.TinyVm.html +++ b/tiny_vm/struct.TinyVm.html @@ -1,12 +1,12 @@ -TinyVm in tiny_vm - Rust

Struct tiny_vm::TinyVm

source ·
pub struct TinyVm { /* private fields */ }
Expand description

The TinyVm virtual machine state.

-

Implementations§

source§

impl TinyVm

source

pub fn new(code: Vec<TinyInsn>) -> Self

Create a new TinyVm and initialize the instruction memory from code.

-
source

pub fn read_reg(&self, reg: TinyReg) -> u16

Read guest register.

-
source

pub fn write_reg(&mut self, reg: TinyReg, val: u16)

Write guest register.

-
source

pub fn read_mem(&self, paddr: PhysAddr) -> u16

Read guest data memory.

-
source

pub fn write_mem(&mut self, paddr: PhysAddr, val: u16)

Write guest data memory.

-
source

pub fn dump(&self)

Dump the VM state to stdout.

-
source

pub fn interp(&mut self)

Run in interpreter mode until the next TinyInsn::Halt instruction is hit.

-
source

pub fn jit(&mut self)

Run in JIT mode until the next TinyInsn::Halt instruction is hit. Translate guest +TinyVm in tiny_vm - Rust

Struct tiny_vm::TinyVm

source ·
pub struct TinyVm { /* private fields */ }
Expand description

The TinyVm virtual machine state.

+

Implementations§

source§

impl TinyVm

source

pub fn new(code: Vec<TinyInsn>) -> Self

Create a new TinyVm and initialize the instruction memory from code.

+
source

pub fn read_reg(&self, reg: TinyReg) -> u16

Read guest register.

+
source

pub fn write_reg(&mut self, reg: TinyReg, val: u16)

Write guest register.

+
source

pub fn read_mem(&self, paddr: PhysAddr) -> u16

Read guest data memory.

+
source

pub fn write_mem(&mut self, paddr: PhysAddr, val: u16)

Write guest data memory.

+
source

pub fn dump(&self)

Dump the VM state to stdout.

+
source

pub fn interp(&mut self)

Run in interpreter mode until the next TinyInsn::Halt instruction is hit.

+
source

pub fn jit(&mut self)

Run in JIT mode until the next TinyInsn::Halt instruction is hit. Translate guest basic blocks on demand.

Auto Trait Implementations§

§

impl RefUnwindSafe for TinyVm

§

impl !Send for TinyVm

§

impl !Sync for TinyVm

§

impl Unpin for TinyVm

§

impl UnwindSafe for TinyVm

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere -- cgit v1.2.3