From 865c1d3231fd57c648121d961be91793d0bfe690 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 5 Mar 2023 20:47:28 +0000 Subject: deploy: 1ea7de2ba46b58b4afe3e65b95d8a45160218a5c --- 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/enum.MemOp.html | 7 +- juicebox_asm/enum.Reg16.html | 24 ++ juicebox_asm/enum.Reg32.html | 24 ++ juicebox_asm/enum.Reg64.html | 24 ++ juicebox_asm/enum.Reg8.html | 28 ++ juicebox_asm/index.html | 73 +++++- juicebox_asm/prelude/enum.Reg16.html | 6 +- juicebox_asm/prelude/enum.Reg32.html | 6 +- juicebox_asm/prelude/enum.Reg64.html | 6 +- juicebox_asm/prelude/enum.Reg8.html | 6 +- juicebox_asm/prelude/index.html | 3 +- juicebox_asm/prelude/sidebar-items.js | 2 +- juicebox_asm/prelude/struct.Imm16.html | 4 +- juicebox_asm/prelude/struct.Imm32.html | 4 +- juicebox_asm/prelude/struct.Imm64.html | 4 +- juicebox_asm/prelude/struct.Imm8.html | 4 +- juicebox_asm/prelude/struct.Label.html | 6 +- juicebox_asm/prelude/trait.Add.html | 4 +- juicebox_asm/prelude/trait.Dec.html | 4 +- juicebox_asm/prelude/trait.Jmp.html | 4 +- juicebox_asm/prelude/trait.Jnz.html | 4 +- juicebox_asm/prelude/trait.Jz.html | 4 +- juicebox_asm/prelude/trait.Mov.html | 4 +- juicebox_asm/prelude/trait.Test.html | 4 +- juicebox_asm/rt/index.html | 1 - juicebox_asm/rt/sidebar-items.js | 1 - juicebox_asm/rt/struct.Runtime.html | 19 +- juicebox_asm/sidebar-items.js | 2 +- juicebox_asm/struct.Asm.html | 7 +- juicebox_asm/struct.Imm16.html | 6 + juicebox_asm/struct.Imm32.html | 6 + juicebox_asm/struct.Imm64.html | 6 + juicebox_asm/struct.Imm8.html | 6 + juicebox_asm/struct.Label.html | 20 ++ juicebox_asm/struct.Runtime.html | 8 + search-index.js | 2 +- src/juicebox_asm/imm.rs.html | 44 +++- src/juicebox_asm/insn.rs.html | 6 +- src/juicebox_asm/label.rs.html | 28 +- src/juicebox_asm/lib.rs.html | 286 ++++++++++++++++++--- src/juicebox_asm/prelude.rs.html | 6 +- src/juicebox_asm/reg.rs.html | 46 +++- src/juicebox_asm/rt.rs.html | 6 +- 51 files changed, 654 insertions(+), 127 deletions(-) create mode 100644 juicebox_asm/enum.Reg16.html create mode 100644 juicebox_asm/enum.Reg32.html create mode 100644 juicebox_asm/enum.Reg64.html create mode 100644 juicebox_asm/enum.Reg8.html delete mode 100644 juicebox_asm/rt/index.html delete mode 100644 juicebox_asm/rt/sidebar-items.js create mode 100644 juicebox_asm/struct.Imm16.html create mode 100644 juicebox_asm/struct.Imm32.html create mode 100644 juicebox_asm/struct.Imm64.html create mode 100644 juicebox_asm/struct.Imm8.html create mode 100644 juicebox_asm/struct.Label.html create mode 100644 juicebox_asm/struct.Runtime.html diff --git a/implementors/core/marker/trait.Freeze.js b/implementors/core/marker/trait.Freeze.js index 384dac4..bca1a65 100644 --- a/implementors/core/marker/trait.Freeze.js +++ b/implementors/core/marker/trait.Freeze.js @@ -1,3 +1,3 @@ (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 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"]]] };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 e990726..ae988f6 100644 --- a/implementors/core/marker/trait.Send.js +++ b/implementors/core/marker/trait.Send.js @@ -1,3 +1,3 @@ (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 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"]]] };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 8bf0bba..e98ed6b 100644 --- a/implementors/core/marker/trait.Sync.js +++ b/implementors/core/marker/trait.Sync.js @@ -1,3 +1,3 @@ (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 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"]]] };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 3cab694..e9b66e6 100644 --- a/implementors/core/marker/trait.Unpin.js +++ b/implementors/core/marker/trait.Unpin.js @@ -1,3 +1,3 @@ (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 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"]]] };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 f4aeefa..1ba4103 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 Runtime"],["impl Drop for Label"]] +"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 1cd4688..3bdd389 100644 --- a/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js +++ b/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -1,3 +1,3 @@ (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 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"]]] };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 5930d21..47510ab 100644 --- a/implementors/core/panic/unwind_safe/trait.UnwindSafe.js +++ b/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -1,3 +1,3 @@ (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 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"]]] };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 aa7a8df..201b868 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/enum.MemOp.html b/juicebox_asm/enum.MemOp.html index 0ea0a71..e126e68 100644 --- a/juicebox_asm/enum.MemOp.html +++ b/juicebox_asm/enum.MemOp.html @@ -1,7 +1,10 @@ -MemOp in juicebox_asm - Rust

Enum juicebox_asm::MemOp

source ·
pub enum MemOp {
+MemOp in juicebox_asm - Rust

Enum juicebox_asm::MemOp

source ·
pub enum MemOp {
     Indirect(Reg64),
     IndirectDisp(Reg64i32),
-}

Variants§

§

Indirect(Reg64)

§

IndirectDisp(Reg64i32)

Trait Implementations§

Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+}
Expand description

Type representing a memory operand.

+

Variants§

§

Indirect(Reg64)

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

+
§

IndirectDisp(Reg64i32)

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

+

Trait Implementations§

Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/enum.Reg16.html b/juicebox_asm/enum.Reg16.html new file mode 100644 index 0000000..6815ce4 --- /dev/null +++ b/juicebox_asm/enum.Reg16.html @@ -0,0 +1,24 @@ +Reg16 in juicebox_asm - Rust

Enum juicebox_asm::Reg16

source ·
#[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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/enum.Reg32.html b/juicebox_asm/enum.Reg32.html new file mode 100644 index 0000000..b6b1c0f --- /dev/null +++ b/juicebox_asm/enum.Reg32.html @@ -0,0 +1,24 @@ +Reg32 in juicebox_asm - Rust

Enum juicebox_asm::Reg32

source ·
#[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§

Emit an add instruction.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit a decrement instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit a logical compare instruction. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/enum.Reg64.html b/juicebox_asm/enum.Reg64.html new file mode 100644 index 0000000..75eaf41 --- /dev/null +++ b/juicebox_asm/enum.Reg64.html @@ -0,0 +1,24 @@ +Reg64 in juicebox_asm - Rust

Enum juicebox_asm::Reg64

source ·
#[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§

Emit an add instruction.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit a decrement instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit a logical compare instruction. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/enum.Reg8.html b/juicebox_asm/enum.Reg8.html new file mode 100644 index 0000000..4643a63 --- /dev/null +++ b/juicebox_asm/enum.Reg8.html @@ -0,0 +1,28 @@ +Reg8 in juicebox_asm - Rust

Enum juicebox_asm::Reg8

source ·
#[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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/index.html b/juicebox_asm/index.html index a58f940..226978d 100644 --- a/juicebox_asm/index.html +++ b/juicebox_asm/index.html @@ -1 +1,72 @@ -juicebox_asm - Rust
\ No newline at end of file +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::Runtime;
+
+const fn fib_rs(n: u64) -> u64 {
+    match n {
+        0 => 0,
+        1 => 1,
+        _ => fib_rs(n - 2) + fib_rs(n - 1),
+    }
+}
+
+fn main() {
+    let mut asm = Asm::new();
+
+    let mut lp = Label::new();
+    let mut end = Label::new();
+
+    // Reference implementation:
+    //
+    // int fib(int n) {
+    //   int tmp = 0;
+    //   int prv = 1;
+    //   int sum = 0;
+    // loop:
+    //   if (n == 0) goto end;
+    //   tmp = sum;
+    //   sum += prv;
+    //   prv = tmp;
+    //   --n;
+    //   goto loop;
+    // end:
+    //   return sum;
+    // }
+
+    // SystemV abi:
+    //   rdi -> first argument
+    //   rax -> return value
+    let n = Reg64::rdi;
+    let sum = Reg64::rax;
+
+    let tmp = Reg64::rcx;
+    let prv = Reg64::rbx;
+
+    asm.mov(tmp, Imm64::from(0));
+    asm.mov(prv, Imm64::from(1));
+    asm.mov(sum, Imm64::from(0));
+
+    asm.bind(&mut lp);
+    asm.test(n, n);
+    asm.jz(&mut end);
+    asm.mov(tmp, sum);
+    asm.add(sum, prv);
+    asm.mov(prv, tmp);
+    asm.dec(n);
+    asm.jmp(&mut lp);
+    asm.bind(&mut end);
+    asm.ret();
+
+    // Move code into executable page and get function pointer to it.
+    let rt = Runtime::new(&asm.into_code());
+    let fib = unsafe { rt.as_fn::<extern "C" fn(u64) -> u64>() };
+
+    for n in 0..15 {
+        let fib_jit = fib(n);
+        println!("fib({}) = {}", n, fib_jit);
+        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 diff --git a/juicebox_asm/prelude/enum.Reg16.html b/juicebox_asm/prelude/enum.Reg16.html index a51ea1f..cd9ed8b 100644 --- a/juicebox_asm/prelude/enum.Reg16.html +++ b/juicebox_asm/prelude/enum.Reg16.html @@ -1,4 +1,4 @@ -Reg16 in juicebox_asm::prelude - Rust
#[repr(u8)]
+Reg16 in juicebox_asm::prelude - Rust
#[repr(u8)]
 pub enum Reg16 {
 
Show 16 variants ax, cx, @@ -16,8 +16,8 @@ pub enum Reg16 { r13w, r14w, r15w, -
}
Expand description

General purpose register operands.

-

Variants§

§

ax

§

cx

§

dx

§

bx

§

sp

§

bp

§

si

§

di

§

r8w

§

r9w

§

r10w

§

r11w

§

r12w

§

r13w

§

r14w

§

r15w

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+
}
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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/enum.Reg32.html b/juicebox_asm/prelude/enum.Reg32.html index 8b82fc5..27ef00c 100644 --- a/juicebox_asm/prelude/enum.Reg32.html +++ b/juicebox_asm/prelude/enum.Reg32.html @@ -1,4 +1,4 @@ -Reg32 in juicebox_asm::prelude - Rust
#[repr(u8)]
+Reg32 in juicebox_asm::prelude - Rust
#[repr(u8)]
 pub enum Reg32 {
 
Show 16 variants eax, ecx, @@ -16,8 +16,8 @@ pub enum Reg32 { r13d, r14d, r15d, -
}
Expand description

General purpose register operands.

-

Variants§

§

eax

§

ecx

§

edx

§

ebx

§

esp

§

ebp

§

esi

§

edi

§

r8d

§

r9d

§

r10d

§

r11d

§

r12d

§

r13d

§

r14d

§

r15d

Trait Implementations§

Emit an add instruction.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit a decrement instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit a logical compare instruction. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+
}
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§

Emit an add instruction.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit a decrement instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit a logical compare instruction. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/enum.Reg64.html b/juicebox_asm/prelude/enum.Reg64.html index 7dc291f..7682091 100644 --- a/juicebox_asm/prelude/enum.Reg64.html +++ b/juicebox_asm/prelude/enum.Reg64.html @@ -1,4 +1,4 @@ -Reg64 in juicebox_asm::prelude - Rust
#[repr(u8)]
+Reg64 in juicebox_asm::prelude - Rust
#[repr(u8)]
 pub enum Reg64 {
 
Show 16 variants rax, rcx, @@ -16,8 +16,8 @@ pub enum Reg64 { r13, r14, r15, -
}
Expand description

General purpose register operands.

-

Variants§

§

rax

§

rcx

§

rdx

§

rbx

§

rsp

§

rbp

§

rsi

§

rdi

§

r8

§

r9

§

r10

§

r11

§

r12

§

r13

§

r14

§

r15

Trait Implementations§

Emit an add instruction.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit a decrement instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit a logical compare instruction. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+
}
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§

Emit an add instruction.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit a decrement instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit a logical compare instruction. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/enum.Reg8.html b/juicebox_asm/prelude/enum.Reg8.html index 40d7cda..09ac1e5 100644 --- a/juicebox_asm/prelude/enum.Reg8.html +++ b/juicebox_asm/prelude/enum.Reg8.html @@ -1,4 +1,4 @@ -Reg8 in juicebox_asm::prelude - Rust
#[repr(u8)]
+Reg8 in juicebox_asm::prelude - Rust
#[repr(u8)]
 pub enum Reg8 {
 
Show 20 variants al, cl, @@ -20,8 +20,8 @@ pub enum Reg8 { ch, dh, bh, -
}
Expand description

General purpose register operands.

-

Variants§

§

al

§

cl

§

dl

§

bl

§

spl

§

bpl

§

sil

§

dil

§

r8l

§

r9l

§

r10l

§

r11l

§

r12l

§

r13l

§

r14l

§

r15l

§

ah

§

ch

§

dh

§

bh

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+
}
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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/index.html b/juicebox_asm/prelude/index.html index beedf58..bc32b86 100644 --- a/juicebox_asm/prelude/index.html +++ b/juicebox_asm/prelude/index.html @@ -1 +1,2 @@ -juicebox_asm::prelude - Rust

Module juicebox_asm::prelude

source ·

Re-exports

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

Structs

Immediate operand.
Immediate operand.
Immediate operand.
Immediate operand.
A label which is used as target for jump instructions.

Enums

General purpose register operands.
General purpose register operands.
General purpose register operands.
General purpose register operands.

Traits

\ No newline at end of file +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 index 5a5bcf1..6491a87 100644 --- a/juicebox_asm/prelude/sidebar-items.js +++ b/juicebox_asm/prelude/sidebar-items.js @@ -1 +1 @@ -window.SIDEBAR_ITEMS = {"enum":[["Reg16","General purpose register operands."],["Reg32","General purpose register operands."],["Reg64","General purpose register operands."],["Reg8","General purpose register operands."]],"struct":[["Imm16","Immediate operand."],["Imm32","Immediate operand."],["Imm64","Immediate operand."],["Imm8","Immediate operand."],["Label","A label which is used as target for jump instructions."]],"trait":[["Add",""],["Dec",""],["Jmp",""],["Jnz",""],["Jz",""],["Mov",""],["Test",""]]}; \ No newline at end of file +window.SIDEBAR_ITEMS = {"enum":[["Reg16","Definition of 16 bit registers."],["Reg32","Definition of 32 bit registers."],["Reg64","Definition of 64 bit registers."],["Reg8","Definition of 8 bit registers."]],"struct":[["Imm16","Type representing a 16 bit immediate."],["Imm32","Type representing a 32 bit immediate."],["Imm64","Type representing a 64 bit immediate."],["Imm8","Type representing an 8 bit immediate."],["Label","A label which is used as target for jump instructions."]],"trait":[["Add",""],["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 index 10d476b..e2e6bea 100644 --- a/juicebox_asm/prelude/struct.Imm16.html +++ b/juicebox_asm/prelude/struct.Imm16.html @@ -1,5 +1,5 @@ -Imm16 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm16

source ·
pub struct Imm16(_);
Expand description

Immediate operand.

-

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+Imm16 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm16

source ·
pub struct Imm16(_);
Expand description

Type representing a 16 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/struct.Imm32.html b/juicebox_asm/prelude/struct.Imm32.html index cadbf85..df69edb 100644 --- a/juicebox_asm/prelude/struct.Imm32.html +++ b/juicebox_asm/prelude/struct.Imm32.html @@ -1,5 +1,5 @@ -Imm32 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm32

source ·
pub struct Imm32(_);
Expand description

Immediate operand.

-

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+Imm32 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm32

source ·
pub struct Imm32(_);
Expand description

Type representing a 32 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/struct.Imm64.html b/juicebox_asm/prelude/struct.Imm64.html index 2df9f88..6fd7442 100644 --- a/juicebox_asm/prelude/struct.Imm64.html +++ b/juicebox_asm/prelude/struct.Imm64.html @@ -1,5 +1,5 @@ -Imm64 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm64

source ·
pub struct Imm64(_);
Expand description

Immediate operand.

-

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+Imm64 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm64

source ·
pub struct Imm64(_);
Expand description

Type representing a 64 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/struct.Imm8.html b/juicebox_asm/prelude/struct.Imm8.html index 33bc618..7194fc2 100644 --- a/juicebox_asm/prelude/struct.Imm8.html +++ b/juicebox_asm/prelude/struct.Imm8.html @@ -1,5 +1,5 @@ -Imm8 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm8

source ·
pub struct Imm8(_);
Expand description

Immediate operand.

-

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+Imm8 in juicebox_asm::prelude - Rust

Struct juicebox_asm::prelude::Imm8

source ·
pub struct Imm8(_);
Expand description

Type representing an 8 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/struct.Label.html b/juicebox_asm/prelude/struct.Label.html index a9346b4..7675857 100644 --- a/juicebox_asm/prelude/struct.Label.html +++ b/juicebox_asm/prelude/struct.Label.html @@ -1,4 +1,4 @@ -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.

+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::*;
 
@@ -12,8 +12,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§

Create a new unbound Label.

-

Trait Implementations§

Executes the destructor for this type. Read more
Emit an unconditional jump instruction.
Emit a conditional jump if not zero instruction (ZF = 0).
Emit a conditional jump if zero instruction (ZF = 1).

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Implementations§

Create a new unbound Label.

+

Trait Implementations§

Executes the destructor for this type. Read more
Emit an unconditional jump instruction.
Emit a conditional jump if not zero instruction (ZF = 0).
Emit a conditional jump if zero instruction (ZF = 1).

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

diff --git a/juicebox_asm/prelude/trait.Add.html b/juicebox_asm/prelude/trait.Add.html index 71c02d9..38d3ac0 100644 --- a/juicebox_asm/prelude/trait.Add.html +++ b/juicebox_asm/prelude/trait.Add.html @@ -1,4 +1,4 @@ -Add in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Add

source ·
pub trait Add<T, U> {
+Add in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Add

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

Required Methods§

Emit an add instruction.

+}

Required Methods§

Emit an add instruction.

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Dec.html b/juicebox_asm/prelude/trait.Dec.html index 099f88f..d99761d 100644 --- a/juicebox_asm/prelude/trait.Dec.html +++ b/juicebox_asm/prelude/trait.Dec.html @@ -1,4 +1,4 @@ -Dec in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Dec

source ·
pub trait Dec<T> {
+Dec in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Dec

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

Required Methods§

Emit a decrement instruction.

+}

Required Methods§

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 index 4d2bc46..282a71c 100644 --- a/juicebox_asm/prelude/trait.Jmp.html +++ b/juicebox_asm/prelude/trait.Jmp.html @@ -1,4 +1,4 @@ -Jmp in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jmp

source ·
pub trait Jmp<T> {
+Jmp in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jmp

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

Required Methods§

Emit an unconditional jump instruction.

+}

Required Methods§

Emit an unconditional jump instruction.

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Jnz.html b/juicebox_asm/prelude/trait.Jnz.html index 8bd9098..a1172bd 100644 --- a/juicebox_asm/prelude/trait.Jnz.html +++ b/juicebox_asm/prelude/trait.Jnz.html @@ -1,4 +1,4 @@ -Jnz in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jnz

source ·
pub trait Jnz<T> {
+Jnz in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jnz

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

Required Methods§

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

+}

Required Methods§

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

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Jz.html b/juicebox_asm/prelude/trait.Jz.html index 1e8cba2..6e7d6fb 100644 --- a/juicebox_asm/prelude/trait.Jz.html +++ b/juicebox_asm/prelude/trait.Jz.html @@ -1,4 +1,4 @@ -Jz in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jz

source ·
pub trait Jz<T> {
+Jz in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Jz

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

Required Methods§

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

+}

Required Methods§

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

Implementors§

\ No newline at end of file diff --git a/juicebox_asm/prelude/trait.Mov.html b/juicebox_asm/prelude/trait.Mov.html index 96188d4..453e913 100644 --- a/juicebox_asm/prelude/trait.Mov.html +++ b/juicebox_asm/prelude/trait.Mov.html @@ -1,4 +1,4 @@ -Mov in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Mov

source ·
pub trait Mov<T, U> {
+Mov in juicebox_asm::prelude - Rust

Trait juicebox_asm::prelude::Mov

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

Required Methods§

Emit an move instruction.

+}

Required Methods§

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 index 4dacf0b..7ac23e5 100644 --- a/juicebox_asm/prelude/trait.Test.html +++ b/juicebox_asm/prelude/trait.Test.html @@ -1,6 +1,6 @@ -Test in juicebox_asm::prelude - Rust
pub trait Test<T, U> {
+Test in juicebox_asm::prelude - Rust
pub trait Test<T, U> {
     fn test(&mut self, op1: T, op2: U);
-}

Required Methods§

Emit a logical compare instruction.

+}

Required Methods§

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/rt/index.html b/juicebox_asm/rt/index.html deleted file mode 100644 index d6ffe84..0000000 --- a/juicebox_asm/rt/index.html +++ /dev/null @@ -1 +0,0 @@ -juicebox_asm::rt - Rust

Module juicebox_asm::rt

source ·

Structs

A simple mmaped runtime with executable pages.
\ No newline at end of file diff --git a/juicebox_asm/rt/sidebar-items.js b/juicebox_asm/rt/sidebar-items.js deleted file mode 100644 index 9040803..0000000 --- a/juicebox_asm/rt/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"struct":[["Runtime","A simple `mmap`ed runtime with executable pages."]]}; \ No newline at end of file diff --git a/juicebox_asm/rt/struct.Runtime.html b/juicebox_asm/rt/struct.Runtime.html index 59812f1..801189d 100644 --- a/juicebox_asm/rt/struct.Runtime.html +++ b/juicebox_asm/rt/struct.Runtime.html @@ -1,8 +1,11 @@ -Runtime in juicebox_asm::rt - Rust

Struct juicebox_asm::rt::Runtime

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

A simple mmaped runtime with executable pages.

-

Implementations§

Create a new Runtime.

-

Reinterpret the block of code as F.

-

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

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

-
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file + + + + + Redirection + + +

Redirecting to ../../juicebox_asm/struct.Runtime.html...

+ + + \ No newline at end of file diff --git a/juicebox_asm/sidebar-items.js b/juicebox_asm/sidebar-items.js index a1b0c17..3f5deba 100644 --- a/juicebox_asm/sidebar-items.js +++ b/juicebox_asm/sidebar-items.js @@ -1 +1 @@ -window.SIDEBAR_ITEMS = {"enum":[["MemOp",""]],"mod":[["prelude",""],["rt",""]],"struct":[["Asm",""]]}; \ No newline at end of file +window.SIDEBAR_ITEMS = {"enum":[["MemOp","Type representing a memory operand."],["Reg16","Definition of 16 bit registers."],["Reg32","Definition of 32 bit registers."],["Reg64","Definition of 64 bit registers."],["Reg8","Definition of 8 bit registers."]],"mod":[["prelude","Crate prelude, which can be used to import the most important types at once."]],"struct":[["Asm","`x64` jit assembler."],["Imm16","Type representing a 16 bit immediate."],["Imm32","Type representing a 32 bit immediate."],["Imm64","Type representing a 64 bit immediate."],["Imm8","Type representing an 8 bit immediate."],["Label","A label which is used as target for jump instructions."],["Runtime","A simple `mmap`ed runtime with executable pages."]]}; \ No newline at end of file diff --git a/juicebox_asm/struct.Asm.html b/juicebox_asm/struct.Asm.html index d227900..31abbb5 100644 --- a/juicebox_asm/struct.Asm.html +++ b/juicebox_asm/struct.Asm.html @@ -1,5 +1,8 @@ -Asm in juicebox_asm - Rust

Struct juicebox_asm::Asm

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

Implementations§

Bind the Label to the current location.

-

If the Label is bound, patch any pending relocation.

+Asm in juicebox_asm - Rust

Struct juicebox_asm::Asm

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

x64 jit assembler.

+

Implementations§

Create a new x64 jit assembler.

+

Consume the assembler and get the emitted code.

+

Bind the Label to the current location.

+

If the Label is bound, patch any pending relocation.

Trait Implementations§

Emit an add instruction.
Emit an add instruction.
Emit a decrement 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 an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit an move instruction.
Emit a logical compare instruction. Read more
Emit a logical compare instruction. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of diff --git a/juicebox_asm/struct.Imm16.html b/juicebox_asm/struct.Imm16.html new file mode 100644 index 0000000..5174881 --- /dev/null +++ b/juicebox_asm/struct.Imm16.html @@ -0,0 +1,6 @@ +Imm16 in juicebox_asm - Rust

Struct juicebox_asm::Imm16

source ·
pub struct Imm16(_);
Expand description

Type representing a 16 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/struct.Imm32.html b/juicebox_asm/struct.Imm32.html new file mode 100644 index 0000000..2317786 --- /dev/null +++ b/juicebox_asm/struct.Imm32.html @@ -0,0 +1,6 @@ +Imm32 in juicebox_asm - Rust

Struct juicebox_asm::Imm32

source ·
pub struct Imm32(_);
Expand description

Type representing a 32 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/struct.Imm64.html b/juicebox_asm/struct.Imm64.html new file mode 100644 index 0000000..e9dcc73 --- /dev/null +++ b/juicebox_asm/struct.Imm64.html @@ -0,0 +1,6 @@ +Imm64 in juicebox_asm - Rust

Struct juicebox_asm::Imm64

source ·
pub struct Imm64(_);
Expand description

Type representing a 64 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/struct.Imm8.html b/juicebox_asm/struct.Imm8.html new file mode 100644 index 0000000..720b3cb --- /dev/null +++ b/juicebox_asm/struct.Imm8.html @@ -0,0 +1,6 @@ +Imm8 in juicebox_asm - Rust

Struct juicebox_asm::Imm8

source ·
pub struct Imm8(_);
Expand description

Type representing an 8 bit immediate.

+

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Emit an move instruction.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/struct.Label.html b/juicebox_asm/struct.Label.html new file mode 100644 index 0000000..9b2a9c5 --- /dev/null +++ b/juicebox_asm/struct.Label.html @@ -0,0 +1,20 @@ +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::*;
+
+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§

Create a new unbound Label.

+

Trait Implementations§

Executes the destructor for this type. Read more
Emit an unconditional jump instruction.
Emit a conditional jump if not zero instruction (ZF = 0).
Emit a conditional jump if zero instruction (ZF = 1).

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/juicebox_asm/struct.Runtime.html b/juicebox_asm/struct.Runtime.html new file mode 100644 index 0000000..9f0da89 --- /dev/null +++ b/juicebox_asm/struct.Runtime.html @@ -0,0 +1,8 @@ +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§

Create a new Runtime.

+

Reinterpret the block of code as F.

+

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

+

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

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/search-index.js b/search-index.js index 391af50..1bfce2f 100644 --- a/search-index.js +++ b/search-index.js @@ -1,5 +1,5 @@ var searchIndex = JSON.parse('{\ -"juicebox_asm":{"doc":"","t":[3,13,13,4,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,0,11,11,11,11,11,11,11,11,8,2,8,3,3,3,3,8,8,8,3,2,8,4,4,4,4,8,10,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,13,13,13,13,11,11,11,11,11,11,11,11,13,10,13,13,13,13,11,13,13,13,13,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,3,11,11,11,11,11,11,11,11,11,11],"n":["Asm","Indirect","IndirectDisp","MemOp","add","add","bind","borrow","borrow","borrow_mut","borrow_mut","dec","dec","from","from","into","into","into_code","jmp","jnz","jz","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","mov","new","prelude","resolve","ret","rt","test","test","try_from","try_from","try_into","try_into","type_id","type_id","Add","Asm","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","ch","cl","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","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","Runtime","as_fn","borrow","borrow_mut","drop","from","into","new","try_from","try_into","type_id"],"q":["juicebox_asm","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","juicebox_asm::prelude","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","juicebox_asm::rt","","","","","","","","","",""],"d":["","","","","","","Bind the Label to the current location.","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","If the Label is bound, patch any pending relocation.","","","","","","","","","","","","","","Immediate operand.","Immediate operand.","Immediate operand.","Immediate operand.","","","","A label which is used as target for jump instructions.","","","General purpose register operands.","General purpose register operands.","General purpose register operands.","General purpose register operands.","","Emit an add 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.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","A simple mmaped runtime with executable pages.","Reinterpret the block of code as F.","","","","Returns the argument unchanged.","Calls U::from(self).","Create a new Runtime.","","",""],"i":[0,7,7,0,1,1,1,7,1,7,1,1,1,7,1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,7,1,7,1,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,9,9,8,9,9,4,10,11,12,13,3,2,8,9,4,10,11,12,13,3,2,8,9,8,9,8,9,9,3,2,8,9,3,2,8,9,8,25,9,8,9,9,4,8,2,2,2,2,2,2,2,2,4,10,10,10,11,11,11,11,11,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,3,2,8,9,4,10,11,12,13,3,2,8,9,26,27,28,29,4,3,2,9,8,3,2,9,8,3,2,9,8,3,2,9,8,3,2,9,8,3,2,9,8,3,2,9,8,3,2,9,8,3,3,3,3,3,3,3,3,8,9,8,9,30,3,2,8,9,4,10,11,12,13,3,2,8,9,4,10,11,12,13,3,2,8,9,4,10,11,12,13,3,2,8,9,0,23,23,23,23,23,23,23,23,23,23],"f":[0,0,0,0,[[1,2,2]],[[1,3,3]],[[1,4]],[[]],[[]],[[]],[[]],[[1,2]],[[1,3]],[[]],[[]],[[]],[[]],[1,[[6,[5]]]],[[1,4]],[[1,4]],[[1,4]],[[1,7,8]],[[1,3,7]],[[1,3,3]],[[1,2,2]],[[1,9,10]],[[1,8,11]],[[1,2,12]],[[1,3,13]],[[1,9,7]],[[1,8,7]],[[1,2,7]],[[1,8,8]],[[1,7,9]],[[1,9,9]],[[1,7,3]],[[1,7,2]],[[],1],0,[[1,4]],[1],0,[[1,2,2]],[[1,3,3]],[[],14],[[],14],[[],14],[[],14],[[],15],[[],15],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,[3,3],[2,2],[8,8],[9,9],[[]],[[]],[[]],[[]],0,[[]],0,0,0,0,[4],0,0,0,0,0,0,0,0,0,[[]],[5,10],[16,10],[[]],[[]],[17,11],[5,11],[16,11],[18,11],[19,12],[16,12],[5,12],[[]],[17,12],[18,12],[20,12],[[]],[18,13],[20,13],[19,13],[21,13],[22,13],[5,13],[16,13],[17,13],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],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,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],0,[23],[[]],[[]],[23],[[]],[[]],[[],23],[[],14],[[],14],[[],15]],"p":[[3,"Asm"],[4,"Reg32"],[4,"Reg64"],[3,"Label"],[15,"u8"],[3,"Vec"],[4,"MemOp"],[4,"Reg16"],[4,"Reg8"],[3,"Imm8"],[3,"Imm16"],[3,"Imm32"],[3,"Imm64"],[4,"Result"],[3,"TypeId"],[15,"i8"],[15,"i16"],[15,"u16"],[15,"u32"],[15,"i32"],[15,"i64"],[15,"u64"],[3,"Runtime"],[8,"Add"],[8,"Dec"],[8,"Jmp"],[8,"Jnz"],[8,"Jz"],[8,"Mov"],[8,"Test"]]}\ +"juicebox_asm":{"doc":"A simple x64 jit assembler with a minimal runtime to …","t":[3,3,3,3,3,13,13,3,4,4,4,4,4,3,11,11,13,13,11,13,13,11,13,11,11,11,11,11,11,13,13,13,13,13,13,11,11,13,13,13,13,11,13,13,13,13,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,11,13,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,8,2,8,3,3,3,3,8,8,8,3,2,8,4,4,4,4,8,10,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,13,13,13,13,11,11,11,11,11,11,11,11,13,10,13,13,13,13,11,13,13,13,13,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["Asm","Imm16","Imm32","Imm64","Imm8","Indirect","IndirectDisp","Label","MemOp","Reg16","Reg32","Reg64","Reg8","Runtime","add","add","ah","al","as_fn","ax","bh","bind","bl","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","bp","bpl","bx","ch","cl","cx","dec","dec","dh","di","dil","dl","drop","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","new","new","prelude","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","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","Add","Asm","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","ch","cl","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","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":["juicebox_asm","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","juicebox_asm::prelude","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"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.","","","","","Reinterpret the block of code as F.","","","Bind the Label to the current location.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 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,13,13,0,0,0,0,0,0,0,1,1,8,8,4,11,8,1,8,4,13,1,4,13,1,11,8,11,8,8,11,1,1,8,11,8,8,4,11,3,3,3,3,3,3,3,3,4,13,1,4,13,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,0,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,2,2,2,2,2,1,1,2,2,11,8,11,8,1,1,4,13,1,4,13,1,4,13,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,8,8,11,8,8,5,9,12,10,14,2,3,11,8,5,9,12,10,14,2,3,11,8,11,8,11,8,8,2,3,11,8,2,3,11,8,11,25,8,11,8,8,5,11,3,3,3,3,3,3,3,3,5,9,9,9,12,12,12,12,12,10,10,10,10,10,10,10,14,14,14,14,14,14,14,14,14,2,3,11,8,5,9,12,10,14,2,3,11,8,26,27,28,29,5,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,3,8,11,2,2,2,2,2,2,2,2,11,8,11,8,30,2,3,11,8,5,9,12,10,14,2,3,11,8,5,9,12,10,14,2,3,11,8,5,9,12,10,14,2,3,11,8],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[1,2,2]],[[1,3,3]],0,0,[4],0,0,[[1,5]],0,[[]],[[]],[[]],[[]],[[]],[[]],0,0,0,0,0,0,[[1,2]],[[1,3]],0,0,0,0,[4],0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[1,[[7,[6]]]],[[1,5]],[[1,5]],[[1,5]],[[1,8,9]],[[1,2,2]],[[1,3,10]],[[1,3,3]],[[1,11,11]],[[1,11,12]],[[1,8,8]],[[1,13,2]],[[1,13,3]],[[1,13,11]],[[1,13,8]],[[1,2,13]],[[1,3,13]],[[1,11,13]],[[1,8,13]],[[1,2,14]],[[],4],[[],1],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,5]],[1],0,0,0,0,0,0,[[1,2,2]],[[1,3,3]],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],16],[[],16],[[],16],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,[2,2],[3,3],[11,11],[8,8],[[]],[[]],[[]],[[]],0,[[]],0,0,0,0,[5],0,0,0,0,0,0,0,0,0,[[]],[17,9],[[]],[6,9],[17,12],[18,12],[19,12],[6,12],[[]],[[]],[20,10],[21,10],[18,10],[19,10],[6,10],[17,10],[20,14],[18,14],[19,14],[[]],[6,14],[17,14],[22,14],[23,14],[21,14],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],5],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,[[]],[[]],[[]],[[]],[[]],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],15],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16]],"p":[[3,"Asm"],[4,"Reg64"],[4,"Reg32"],[3,"Runtime"],[3,"Label"],[15,"u8"],[3,"Vec"],[4,"Reg8"],[3,"Imm8"],[3,"Imm32"],[4,"Reg16"],[3,"Imm16"],[4,"MemOp"],[3,"Imm64"],[4,"Result"],[3,"TypeId"],[15,"i8"],[15,"u16"],[15,"i16"],[15,"u32"],[15,"i32"],[15,"u64"],[15,"i64"],[8,"Add"],[8,"Dec"],[8,"Jmp"],[8,"Jnz"],[8,"Jz"],[8,"Mov"],[8,"Test"]]}\ }'); if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; diff --git a/src/juicebox_asm/imm.rs.html b/src/juicebox_asm/imm.rs.html index 0990c92..0a9933e 100644 --- a/src/juicebox_asm/imm.rs.html +++ b/src/juicebox_asm/imm.rs.html @@ -33,15 +33,33 @@ 33 34 35 -
/// Trait to interact with immediate operands.
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+
//! Definition of different immediate types which are used as input operands for various
+//! instructions.
+
+/// Trait to interact with immediate operands.
 pub(crate) trait Imm {
     /// Get immediate operand as slice of bytes.
     fn bytes(&self) -> &[u8];
 }
 
 macro_rules! impl_imm {
-    ($name:ident, $size:expr, from: $( $from:ty ),* $(,)?) => {
-        /// Immediate operand.
+    (#[$doc:meta] $name:ident, $size:expr, from: { $( $from:ty ),* $(,)? }) => {
+        #[$doc]
         pub struct $name([u8; $size]);
 
         impl Imm for $name {
@@ -64,9 +82,21 @@
     }
 }
 
-impl_imm!(Imm8, 1, from: u8, i8);
-impl_imm!(Imm16, 2, from: u16, i16, u8, i8);
-impl_imm!(Imm32, 4, from: u32, i32, u16, i16, u8, i8);
-impl_imm!(Imm64, 8, from: u64, i64, u32, i32, u16, i16, u8, i8);
+impl_imm!(
+    /// Type representing an 8 bit immediate.
+    Imm8, 1, from: { u8, i8 }
+);
+impl_imm!(
+    /// Type representing a 16 bit immediate.
+    Imm16, 2, from: { u16, i16, u8, i8 }
+);
+impl_imm!(
+    /// Type representing a 32 bit immediate.
+    Imm32, 4, from: { u32, i32, u16, i16, u8, i8 }
+);
+impl_imm!(
+    /// Type representing a 64 bit immediate.
+    Imm64, 8, from: { u64, i64, u32, i32, u16, i16, u8, i8 }
+);
 
\ No newline at end of file diff --git a/src/juicebox_asm/insn.rs.html b/src/juicebox_asm/insn.rs.html index 93134d8..2affb2d 100644 --- a/src/juicebox_asm/insn.rs.html +++ b/src/juicebox_asm/insn.rs.html @@ -44,7 +44,11 @@ 44 45 46 -
mod add;
+47
+48
+
//! Trait definitions of various instructions.
+
+mod add;
 mod dec;
 mod jmp;
 mod jnz;
diff --git a/src/juicebox_asm/label.rs.html b/src/juicebox_asm/label.rs.html
index cf7e7ae..aff9f8f 100644
--- a/src/juicebox_asm/label.rs.html
+++ b/src/juicebox_asm/label.rs.html
@@ -70,7 +70,20 @@
 70
 71
 72
-
use std::collections::HashSet;
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+
//! Definition of the lable type which can be used as jump target and can be bound to a location in
+//! the emitted code.
+
+use std::collections::HashSet;
 
 /// A label which is used as target for jump instructions.
 ///
@@ -107,7 +120,11 @@
         }
     }
 
-    /// Bind the label to the `location`.
+    /// Bind the label to the `location`, can only be bound once.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the lable is already bound.
     pub(crate) fn bind(&mut self, loc: usize) {
         // A label can only be bound once!
         assert!(!self.is_bound());
@@ -120,11 +137,14 @@
         self.offsets.insert(off);
     }
 
-    pub(crate) fn location(&self) -> Option<usize> {
+    /// Get the location of the lable if already bound, `None` else.
+    pub(crate) fn location(&self) -> Option<usize> {
         self.location
     }
 
-    pub(crate) fn offsets_mut(&mut self) -> &mut HashSet<usize> {
+    /// Get the offsets which refer to the label. These are used to patch the jump instructions to
+    /// the label location.
+    pub(crate) fn offsets_mut(&mut self) -> &mut HashSet<usize> {
         &mut self.offsets
     }
 
diff --git a/src/juicebox_asm/lib.rs.html b/src/juicebox_asm/lib.rs.html
index 7b17af1..47e6bf6 100644
--- a/src/juicebox_asm/lib.rs.html
+++ b/src/juicebox_asm/lib.rs.html
@@ -302,26 +302,214 @@
 302
 303
 304
-
pub mod prelude;
-pub mod rt;
+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
+
//! 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::Runtime;
+//!
+//! const fn fib_rs(n: u64) -> u64 {
+//!     match n {
+//!         0 => 0,
+//!         1 => 1,
+//!         _ => fib_rs(n - 2) + fib_rs(n - 1),
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let mut asm = Asm::new();
+//!
+//!     let mut lp = Label::new();
+//!     let mut end = Label::new();
+//!
+//!     // Reference implementation:
+//!     //
+//!     // int fib(int n) {
+//!     //   int tmp = 0;
+//!     //   int prv = 1;
+//!     //   int sum = 0;
+//!     // loop:
+//!     //   if (n == 0) goto end;
+//!     //   tmp = sum;
+//!     //   sum += prv;
+//!     //   prv = tmp;
+//!     //   --n;
+//!     //   goto loop;
+//!     // end:
+//!     //   return sum;
+//!     // }
+//!
+//!     // SystemV abi:
+//!     //   rdi -> first argument
+//!     //   rax -> return value
+//!     let n = Reg64::rdi;
+//!     let sum = Reg64::rax;
+//!
+//!     let tmp = Reg64::rcx;
+//!     let prv = Reg64::rbx;
+//!
+//!     asm.mov(tmp, Imm64::from(0));
+//!     asm.mov(prv, Imm64::from(1));
+//!     asm.mov(sum, Imm64::from(0));
+//!
+//!     asm.bind(&mut lp);
+//!     asm.test(n, n);
+//!     asm.jz(&mut end);
+//!     asm.mov(tmp, sum);
+//!     asm.add(sum, prv);
+//!     asm.mov(prv, tmp);
+//!     asm.dec(n);
+//!     asm.jmp(&mut lp);
+//!     asm.bind(&mut end);
+//!     asm.ret();
+//!
+//!     // Move code into executable page and get function pointer to it.
+//!     let rt = Runtime::new(&asm.into_code());
+//!     let fib = unsafe { rt.as_fn::<extern "C" fn(u64) -> u64>() };
+//!
+//!     for n in 0..15 {
+//!         let fib_jit = fib(n);
+//!         println!("fib({}) = {}", n, fib_jit);
+//!         assert_eq!(fib_jit, fib_rs(n));
+//!     }
+//! }
+//! ```
+
+pub mod prelude;
 
 mod imm;
 mod insn;
 mod label;
 mod reg;
+mod rt;
+
+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 label::Label;
 use reg::Reg;
-use reg::{Reg16, Reg32, Reg64, Reg8};
 
-pub enum MemOp {
-    Indirect(Reg64),
-    IndirectDisp(Reg64, i32),
+/// Type representing a memory operand.
+pub enum MemOp {
+    /// An indirect memory operand, eg `mov [rax], rcx`.
+    Indirect(Reg64),
+
+    /// An indirect memory operand with additional displacement, eg `mov [rax + 0x10], rcx`.
+    IndirectDisp(Reg64, i32),
 }
 
 impl MemOp {
-    const fn base(&self) -> Reg64 {
+    /// Get the base address register of the memory operand.
+    const fn base(&self) -> Reg64 {
         match self {
             MemOp::Indirect(base) => *base,
             MemOp::IndirectDisp(base, ..) => *base,
@@ -343,31 +531,42 @@
     ((mod_ & 0b11) << 6) | ((reg & 0b111) << 3) | (rm & 0b111)
 }
 
-pub struct Asm {
+/// `x64` jit assembler.
+pub struct Asm {
     buf: Vec<u8>,
 }
 
 impl Asm {
-    pub fn new() -> Asm {
-        let buf = Vec::with_capacity(1024);
+    /// Create a new `x64` jit assembler.
+    pub fn new() -> Asm {
+        // Some random default capacity.
+        let buf = Vec::with_capacity(1024);
         Asm { buf }
     }
 
-    pub fn into_code(self) -> Vec<u8> {
+    /// Consume the assembler and get the emitted code.
+    pub fn into_code(self) -> Vec<u8> {
         self.buf
     }
 
-    fn emit(&mut self, bytes: &[u8]) {
+    /// Emit a slice of bytes.
+    fn emit(&mut self, bytes: &[u8]) {
         self.buf.extend_from_slice(bytes);
     }
 
-    fn emit_optional(&mut self, bytes: &[Option<u8>]) {
+    /// 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);
         }
     }
 
-    fn emit_at(&mut self, pos: usize, bytes: &[u8]) {
+    /// 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 {
@@ -387,7 +586,8 @@
     /// If the [Label] is bound, patch any pending relocation.
     pub fn resolve(&mut self, label: &mut Label) {
         if let Some(loc) = label.location() {
-            let loc = i32::try_from(loc).expect("Label location did not fit into i32.");
+            // 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() {
@@ -404,6 +604,7 @@
 
     // -- Encode utilities.
 
+    /// Encode an register-register instruction.
     fn encode_rr<T: Reg>(&mut self, opc: u8, op1: T, op2: T)
     where
         Self: EncodeRR<T>,
@@ -424,22 +625,25 @@
         self.emit(&[opc, modrm]);
     }
 
-    fn encode_oi<T: Reg, U: Imm>(&mut self, opc: u8, op1: T, op2: U)
+    /// 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: EncodeRI<T>,
+        Self: EncodeR<T>,
     {
         let opc = opc + (op1.idx() & 0b111);
-        let prefix = <Self as EncodeRI<T>>::legacy_prefix();
-        let rex = <Self as EncodeRI<T>>::rex(op1);
+        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());
     }
 
-    fn encode_ri<T: Reg, U: Imm>(&mut self, opc: u8, opc_ext: u8, op1: T, op2: U)
+    /// 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: EncodeRI<T>,
+        Self: EncodeR<T>,
     {
         // MI operand encoding.
         //   op1           -> modrm.rm
@@ -450,17 +654,18 @@
             op1.idx(), /* rm */
         );
 
-        let prefix = <Self as EncodeRI<T>>::legacy_prefix();
-        let rex = <Self as EncodeRI<T>>::rex(op1);
+        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());
     }
 
-    fn encode_r<T: Reg>(&mut self, opc: u8, opc_ext: u8, op1: T)
+    /// Encode a register instruction.
+    fn encode_r<T: Reg>(&mut self, opc: u8, opc_ext: u8, op1: T)
     where
-        Self: EncodeRI<T>,
+        Self: EncodeR<T>,
     {
         // M operand encoding.
         //   op1           -> modrm.rm
@@ -471,14 +676,15 @@
             op1.idx(), /* rm */
         );
 
-        let prefix = <Self as EncodeRI<T>>::legacy_prefix();
-        let rex = <Self as EncodeRI<T>>::rex(op1);
+        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]);
     }
 
-    fn encode_mr<T: Reg>(&mut self, opc: u8, op1: MemOp, op2: T)
+    /// Encode a memory-register instruction.
+    fn encode_mr<T: Reg>(&mut self, opc: u8, op1: MemOp, op2: T)
     where
         Self: EncodeMR<T>,
     {
@@ -511,7 +717,8 @@
         }
     }
 
-    fn encode_rm<T: Reg>(&mut self, opc: u8, op1: T, op2: MemOp)
+    /// Encode a register-memory instruction.
+    fn encode_rm<T: Reg>(&mut self, opc: u8, op1: T, op2: MemOp)
     where
         Self: EncodeMR<T>,
     {
@@ -521,7 +728,8 @@
         self.encode_mr(opc, op2, op1);
     }
 
-    fn encode_jmp_label(&mut self, opc: &[u8], op1: &mut Label) {
+    /// Encode a jump to label instruction.
+    fn encode_jmp_label(&mut self, opc: &[u8], op1: &mut Label) {
         // Emit the opcode.
         self.emit(opc);
 
@@ -529,6 +737,7 @@
         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.
@@ -538,6 +747,7 @@
 
 // -- Encoder helper.
 
+/// Encode helper for register-register instructions.
 trait EncodeRR<T: Reg> {
     fn legacy_prefix() -> Option<u8> {
         None
@@ -561,7 +771,8 @@
 }
 impl EncodeRR<Reg64> for Asm {}
 
-trait EncodeRI<T: Reg> {
+/// Encode helper for register instructions.
+trait EncodeR<T: Reg> {
     fn legacy_prefix() -> Option<u8> {
         None
     }
@@ -575,16 +786,17 @@
     }
 }
 
-impl EncodeRI<Reg8> for Asm {}
-impl EncodeRI<Reg32> for Asm {}
-impl EncodeRI<Reg16> for Asm {
+impl EncodeR<Reg8> for Asm {}
+impl EncodeR<Reg32> for Asm {}
+impl EncodeR<Reg16> for Asm {
     fn legacy_prefix() -> Option<u8> {
         Some(0x66)
     }
 }
-impl EncodeRI<Reg64> for Asm {}
+impl EncodeR<Reg64> for Asm {}
 
-trait EncodeMR<T: Reg> {
+/// Encode helper for memory-register instructions.
+trait EncodeMR<T: Reg> {
     fn legacy_prefix() -> Option<u8> {
         None
     }
diff --git a/src/juicebox_asm/prelude.rs.html b/src/juicebox_asm/prelude.rs.html
index 51df87d..be1334b 100644
--- a/src/juicebox_asm/prelude.rs.html
+++ b/src/juicebox_asm/prelude.rs.html
@@ -6,7 +6,11 @@
 6
 7
 8
-
pub use crate::Asm;
+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};
diff --git a/src/juicebox_asm/reg.rs.html b/src/juicebox_asm/reg.rs.html
index 65ff29e..8791ddb 100644
--- a/src/juicebox_asm/reg.rs.html
+++ b/src/juicebox_asm/reg.rs.html
@@ -321,7 +321,20 @@
 321
 322
 323
-
/// Trait to interact with register operands.
+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.
 pub(crate) trait Reg {
     /// Get the raw x64 register code.
     fn idx(&self) -> u8;
@@ -358,10 +371,10 @@
     }
 }
 
-macro_rules! impl_reg {
-    (ENUM_ONLY, $name:ident, { $($reg:ident),+ $(,)? }) => {
-        /// General purpose register operands.
-        #[allow(non_camel_case_types)]
+macro_rules! enum_reg {
+    (#[$doc:meta]  $name:ident, { $($reg:ident),+ $(,)? }) => {
+        #[$doc]
+        #[allow(non_camel_case_types)]
         #[derive(Copy, Clone)]
         #[repr(u8)]
         pub enum $name {
@@ -376,9 +389,11 @@
             }
         }
     };
+}
 
-    ($name:ident, $rexw:expr, { $($reg:ident),+ $(,)? }) => {
-        impl_reg!(ENUM_ONLY, $name, { $( $reg, )+ });
+macro_rules! impl_reg {
+    (#[$doc:meta] $name:ident, $rexw:expr, { $($reg:ident),+ $(,)? }) => {
+        enum_reg!(#[$doc] $name, { $( $reg, )+ });
 
         impl Reg for $name {
             /// Get the raw x64 register code.
@@ -394,11 +409,18 @@
     }
 }
 
-impl_reg!(Reg64, true,  { rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, r8,  r9,  r10,  r11,  r12,  r13,  r14,  r15  });
-impl_reg!(Reg32, false, { eax, ecx, edx, ebx, esp, ebp, esi, edi, r8d, r9d, r10d, r11d, r12d, r13d, r14d, r15d });
-impl_reg!(Reg16, false, { ax,  cx,  dx,  bx,  sp,  bp,  si,  di,  r8w, r9w, r10w, r11w, r12w, r13w, r14w, r15w });
-impl_reg!(ENUM_ONLY,
-          Reg8,         { al,  cl,  dl,  bl,  spl, bpl, sil, dil, r8l, r9l, r10l, r11l, r12l, r13l, r14l, r15l,
+impl_reg!(
+    /// Definition of 64 bit registers.
+    Reg64, true,  { rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, r8,  r9,  r10,  r11,  r12,  r13,  r14,  r15  });
+impl_reg!(
+    /// Definition of 32 bit registers.
+    Reg32, false, { eax, ecx, edx, ebx, esp, ebp, esi, edi, r8d, r9d, r10d, r11d, r12d, r13d, r14d, r15d });
+impl_reg!(
+    /// Definition of 16 bit registers.
+    Reg16, false, { ax,  cx,  dx,  bx,  sp,  bp,  si,  di,  r8w, r9w, r10w, r11w, r12w, r13w, r14w, r15w });
+enum_reg!(
+    /// Definition of 8 bit registers.
+    Reg8,         { al,  cl,  dl,  bl,  spl, bpl, sil, dil, r8l, r9l, r10l, r11l, r12l, r13l, r14l, r15l,
                           ah,  ch,  dh,  bh });
 
 impl Reg for Reg8 {
diff --git a/src/juicebox_asm/rt.rs.html b/src/juicebox_asm/rt.rs.html
index a44e465..62ee9b7 100644
--- a/src/juicebox_asm/rt.rs.html
+++ b/src/juicebox_asm/rt.rs.html
@@ -49,7 +49,11 @@
 49
 50
 51
-
use core::ffi::c_void;
+52
+53
+
//! A simple runtime which can be used to execute emitted instructions.
+
+use core::ffi::c_void;
 use nix::sys::mman::{mmap, munmap, MapFlags, ProtFlags};
 
 /// A simple `mmap`ed runtime with executable pages.
-- 
cgit v1.2.3