summaryrefslogtreecommitdiff
path: root/crates/types/src
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2023-12-05 23:45:45 +0100
committerHenry Gressmann <mail@henrygressmann.de>2023-12-05 23:45:45 +0100
commitef4dbf261d13a72931887dad8db02d53a695a810 (patch)
tree5158792703337483594ceb49e50e9c00b83f0b16 /crates/types/src
parent15c7ec404c0e4c6aa8829ac6b2d13a6e11cddd9a (diff)
feat: block stack, make cargofmt a bit more sane
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/types/src')
-rw-r--r--crates/types/src/instructions.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs
index 13f8ce0..40bb9f4 100644
--- a/crates/types/src/instructions.rs
+++ b/crates/types/src/instructions.rs
@@ -4,8 +4,7 @@ use super::{FuncAddr, GlobalAddr, LabelAddr, LocalAddr, TableAddr, TypeAddr, Val
pub enum BlockArgs {
Empty,
Type(ValType),
- // TODO: wasm 2.0
- // FuncType(u32),
+ FuncType(u32),
}
/// Represents a memory immediate in a WebAssembly memory instruction.
@@ -22,6 +21,9 @@ pub struct MemArg {
/// For example, `br_table` stores the jump lables in the following `br_label` instructions to keep this enum small.
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Instruction {
+ // Custom Instructions
+ BrLabel(LabelAddr),
+
// Control Instructions
// See https://webassembly.github.io/spec/core/binary/instructions.html#control-instructions
Unreachable,
@@ -33,8 +35,7 @@ pub enum Instruction {
End,
Br(LabelAddr),
BrIf(LabelAddr),
- BrTable(u32), // has to be followed by multiple BrLabel instructions
- BrLabel(LabelAddr),
+ BrTable(u32, u32), // has to be followed by multiple BrLabel instructions
Return,
Call(FuncAddr),
CallIndirect(TypeAddr, TableAddr),