diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2024-03-13 15:28:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-13 15:28:31 +0100 |
| commit | 03020080366241f1c5b610546d3e17687232eb30 (patch) | |
| tree | 67ed5722bb37f55ffa135ce241f722f78cb56831 /crates/types/src | |
| parent | 398b2af4ea37be98093bdf7ac185a468c62c4aef (diff) | |
chore: optimize block stack, remove EndFunc (#12)
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/types/src')
| -rw-r--r-- | crates/types/src/archive.rs | 3 | ||||
| -rw-r--r-- | crates/types/src/instructions.rs | 4 | ||||
| -rw-r--r-- | crates/types/src/lib.rs | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/crates/types/src/archive.rs b/crates/types/src/archive.rs index 273d6ed..9bf095b 100644 --- a/crates/types/src/archive.rs +++ b/crates/types/src/archive.rs @@ -48,6 +48,9 @@ impl Display for TwasmError { } #[cfg(feature = "std")] +extern crate std; + +#[cfg(feature = "std")] impl std::error::Error for TwasmError {} impl TinyWasmModule { diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs index c932704..402cc9a 100644 --- a/crates/types/src/instructions.rs +++ b/crates/types/src/instructions.rs @@ -73,8 +73,7 @@ pub enum ConstInstruction { /// /// # Differences to the spec /// * `br_table` stores the jump labels in the following `br_label` instructions to keep this enum small. -/// * Lables/Blocks: we store the label end offset in the instruction itself and -/// have seperate EndBlockFrame and EndFunc instructions to mark the end of a block or function. +/// * Lables/Blocks: we store the label end offset in the instruction itself and use `EndBlockFrame` to mark the end of a block. /// This makes it easier to implement the label stack iteratively. /// /// See <https://webassembly.github.io/spec/core/binary/instructions.html> @@ -121,7 +120,6 @@ pub enum Instruction { If(BlockArgsPacked, ElseOffset, EndOffset), // If else offset is 0 if there is no else block Else(EndOffset), EndBlockFrame, - EndFunc, Br(LabelAddr), BrIf(LabelAddr), BrTable(BrTableDefault, BrTableLen), // has to be followed by multiple BrLabel instructions diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 679f3bf..c5c8071 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -3,7 +3,7 @@ attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_assignments, unused_variables)) ))] #![warn(missing_debug_implementations, rust_2018_idioms, unreachable_pub)] -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] #![cfg_attr(not(feature = "unsafe"), forbid(unsafe_code))] #![cfg_attr(feature = "unsafe", deny(unused_unsafe))] |
