summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/parser/src/conversion.rs9
-rw-r--r--crates/tinywasm/src/imports.rs8
-rw-r--r--crates/tinywasm/src/instance.rs8
-rw-r--r--crates/tinywasm/src/store.rs58
-rw-r--r--crates/tinywasm/tests/generated/mvp.csv2
-rw-r--r--crates/tinywasm/tests/generated/progress-mvp.svg6
-rw-r--r--crates/types/src/instructions.rs48
7 files changed, 71 insertions, 68 deletions
diff --git a/crates/parser/src/conversion.rs b/crates/parser/src/conversion.rs
index 4f79a4a..1448d59 100644
--- a/crates/parser/src/conversion.rs
+++ b/crates/parser/src/conversion.rs
@@ -1,9 +1,6 @@
use alloc::{boxed::Box, format, string::ToString, vec::Vec};
use log::debug;
-use tinywasm_types::{
- BlockArgs, ConstInstruction, ElementItem, Export, ExternalKind, FuncType, Global, GlobalType, Import, ImportKind,
- Instruction, MemArg, MemoryArch, MemoryType, TableType, ValType,
-};
+use tinywasm_types::*;
use wasmparser::{FuncValidator, OperatorsReader, ValidatorResources};
use crate::{module::CodeSection, Result};
@@ -210,8 +207,8 @@ pub(crate) fn convert_valtype(valtype: &wasmparser::ValType) -> ValType {
}
}
-pub(crate) fn convert_memarg(memarg: wasmparser::MemArg) -> MemArg {
- MemArg { offset: memarg.offset, align: memarg.align, align_max: memarg.max_align, mem_addr: memarg.memory }
+pub(crate) fn convert_memarg(memarg: wasmparser::MemArg) -> MemoryArg {
+ MemoryArg { offset: memarg.offset, align: memarg.align, align_max: memarg.max_align, mem_addr: memarg.memory }
}
pub(crate) fn process_const_operators(ops: OperatorsReader) -> Result<ConstInstruction> {
diff --git a/crates/tinywasm/src/imports.rs b/crates/tinywasm/src/imports.rs
index a6c07b5..c557069 100644
--- a/crates/tinywasm/src/imports.rs
+++ b/crates/tinywasm/src/imports.rs
@@ -215,13 +215,13 @@ pub(crate) enum ResolvedExtern<S, V> {
pub(crate) struct ResolvedImports {
pub(crate) globals: Vec<GlobalAddr>,
pub(crate) tables: Vec<TableAddr>,
- pub(crate) mems: Vec<MemAddr>,
+ pub(crate) memories: Vec<MemAddr>,
pub(crate) funcs: Vec<FuncAddr>,
}
impl ResolvedImports {
pub(crate) fn new() -> Self {
- Self { globals: Vec::new(), tables: Vec::new(), mems: Vec::new(), funcs: Vec::new() }
+ Self { globals: Vec::new(), tables: Vec::new(), memories: Vec::new(), funcs: Vec::new() }
}
}
@@ -318,7 +318,7 @@ impl Imports {
match &kind {
ExternalKind::Global => imports.globals.push(addr),
ExternalKind::Table => imports.tables.push(addr),
- ExternalKind::Memory => imports.mems.push(addr),
+ ExternalKind::Memory => imports.memories.push(addr),
ExternalKind::Func => imports.funcs.push(addr),
}
}
@@ -338,7 +338,7 @@ impl Imports {
match val {
ExternVal::Global(g) => imports.globals.push(g),
ExternVal::Table(t) => imports.tables.push(t),
- ExternVal::Mem(m) => imports.mems.push(m),
+ ExternVal::Mem(m) => imports.memories.push(m),
ExternVal::Func(f) => imports.funcs.push(f),
}
}
diff --git a/crates/tinywasm/src/instance.rs b/crates/tinywasm/src/instance.rs
index 38cb42a..11deedc 100644
--- a/crates/tinywasm/src/instance.rs
+++ b/crates/tinywasm/src/instance.rs
@@ -66,10 +66,10 @@ impl ModuleInstance {
addrs.globals.extend(store.init_globals(data.globals.into(), idx)?);
addrs.funcs.extend(store.init_funcs(data.funcs.into(), idx)?);
addrs.tables.extend(store.init_tables(data.table_types.into(), idx)?);
- addrs.mems.extend(store.init_mems(data.memory_types.into(), idx)?);
+ addrs.memories.extend(store.init_memories(data.memory_types.into(), idx)?);
- let elem_addrs = store.init_elems(&addrs.tables, data.elements.into(), idx)?;
- let data_addrs = store.init_datas(&addrs.mems, data.data.into(), idx)?;
+ let elem_addrs = store.init_elements(&addrs.tables, data.elements.into(), idx)?;
+ let data_addrs = store.init_datas(&addrs.memories, data.data.into(), idx)?;
let instance = ModuleInstanceInner {
store_id: store.id(),
@@ -78,7 +78,7 @@ impl ModuleInstance {
types: data.func_types,
func_addrs: addrs.funcs.into_boxed_slice(),
table_addrs: addrs.tables.into_boxed_slice(),
- mem_addrs: addrs.mems.into_boxed_slice(),
+ mem_addrs: addrs.memories.into_boxed_slice(),
global_addrs: addrs.globals.into_boxed_slice(),
elem_addrs,
data_addrs: data_addrs,
diff --git a/crates/tinywasm/src/store.rs b/crates/tinywasm/src/store.rs
index 5b4c696..730dbd7 100644
--- a/crates/tinywasm/src/store.rs
+++ b/crates/tinywasm/src/store.rs
@@ -86,9 +86,9 @@ impl Default for Store {
pub(crate) struct StoreData {
pub(crate) funcs: Vec<Rc<FunctionInstance>>,
pub(crate) tables: Vec<Rc<RefCell<TableInstance>>>,
- pub(crate) mems: Vec<Rc<RefCell<MemoryInstance>>>,
+ pub(crate) memories: Vec<Rc<RefCell<MemoryInstance>>>,
pub(crate) globals: Vec<Rc<RefCell<GlobalInstance>>>,
- pub(crate) elems: Vec<ElemInstance>,
+ pub(crate) elements: Vec<ElementInstance>,
pub(crate) datas: Vec<DataInstance>,
}
@@ -142,15 +142,15 @@ impl Store {
}
/// Add memories to the store, returning their addresses in the store
- pub(crate) fn init_mems(&mut self, mems: Vec<MemoryType>, idx: ModuleInstanceAddr) -> Result<Vec<MemAddr>> {
- let mem_count = self.data.mems.len();
+ pub(crate) fn init_memories(&mut self, memories: Vec<MemoryType>, idx: ModuleInstanceAddr) -> Result<Vec<MemAddr>> {
+ let mem_count = self.data.memories.len();
let mut mem_addrs = Vec::with_capacity(mem_count);
- for (i, mem) in mems.into_iter().enumerate() {
+ for (i, mem) in memories.into_iter().enumerate() {
if let MemoryArch::I64 = mem.arch {
return Err(Error::UnsupportedFeature("64-bit memories".to_string()));
}
log::info!("adding memory: {:?}", mem);
- self.data.mems.push(Rc::new(RefCell::new(MemoryInstance::new(mem, idx))));
+ self.data.memories.push(Rc::new(RefCell::new(MemoryInstance::new(mem, idx))));
mem_addrs.push((i + mem_count) as MemAddr);
}
@@ -175,16 +175,16 @@ impl Store {
/// Add elements to the store, returning their addresses in the store
/// Should be called after the tables have been added
- pub(crate) fn init_elems(
+ pub(crate) fn init_elements(
&mut self,
table_addrs: &[TableAddr],
- elems: Vec<Element>,
+ elements: Vec<Element>,
idx: ModuleInstanceAddr,
) -> Result<Box<[Addr]>> {
- let elem_count = self.data.elems.len();
+ let elem_count = self.data.elements.len();
let mut elem_addrs = Vec::with_capacity(elem_count);
- for (i, elem) in elems.into_iter().enumerate() {
- let init = elem
+ for (i, element) in elements.into_iter().enumerate() {
+ let init = element
.items
.iter()
.map(|item| {
@@ -194,7 +194,7 @@ impl Store {
})
.collect::<Result<Vec<_>>>()?;
- let items = match elem.kind {
+ let items = match element.kind {
// doesn't need to be initialized, can be initialized lazily using the `table.init` instruction
ElementKind::Passive => Some(init),
@@ -228,7 +228,7 @@ impl Store {
}
};
- self.data.elems.push(ElemInstance::new(elem.kind, idx, items));
+ self.data.elements.push(ElementInstance::new(element.kind, idx, items));
elem_addrs.push((i + elem_count) as Addr);
}
@@ -262,7 +262,7 @@ impl Store {
let offset = self.eval_i32_const(&offset)?;
let mem =
- self.data.mems.get_mut(mem_addr as usize).ok_or_else(|| {
+ self.data.memories.get_mut(mem_addr as usize).ok_or_else(|| {
Error::Other(format!("memory {} not found for data segment {}", mem_addr, i))
})?;
@@ -296,8 +296,8 @@ impl Store {
if let MemoryArch::I64 = mem.arch {
return Err(Error::UnsupportedFeature("64-bit memories".to_string()));
}
- self.data.mems.push(Rc::new(RefCell::new(MemoryInstance::new(mem, idx))));
- Ok(self.data.mems.len() as MemAddr - 1)
+ self.data.memories.push(Rc::new(RefCell::new(MemoryInstance::new(mem, idx))));
+ Ok(self.data.memories.len() as MemAddr - 1)
}
pub(crate) fn add_func(&mut self, func: Function, type_idx: TypeAddr, idx: ModuleInstanceAddr) -> Result<FuncAddr> {
@@ -348,7 +348,7 @@ impl Store {
/// Get the memory at the actual index in the store
pub(crate) fn get_mem(&self, addr: usize) -> Result<&Rc<RefCell<MemoryInstance>>> {
- self.data.mems.get(addr).ok_or_else(|| Error::Other(format!("memory {} not found", addr)))
+ self.data.memories.get(addr).ok_or_else(|| Error::Other(format!("memory {} not found", addr)))
}
/// Get the table at the actual index in the store
@@ -357,8 +357,8 @@ impl Store {
}
/// Get the element at the actual index in the store
- pub(crate) fn get_elem(&self, addr: usize) -> Result<&ElemInstance> {
- self.data.elems.get(addr).ok_or_else(|| Error::Other(format!("element {} not found", addr)))
+ pub(crate) fn get_elem(&self, addr: usize) -> Result<&ElementInstance> {
+ self.data.elements.get(addr).ok_or_else(|| Error::Other(format!("element {} not found", addr)))
}
/// Get the global at the actual index in the store
@@ -413,25 +413,29 @@ impl FunctionInstance {
/// See <https://webassembly.github.io/spec/core/exec/runtime.html#table-instances>
#[derive(Debug)]
pub(crate) struct TableInstance {
- pub(crate) elements: Vec<Addr>,
+ pub(crate) elements: Vec<Option<Addr>>,
pub(crate) _kind: TableType,
pub(crate) _owner: ModuleInstanceAddr, // index into store.module_instances
}
impl TableInstance {
pub(crate) fn new(kind: TableType, owner: ModuleInstanceAddr) -> Self {
- Self { elements: vec![0; kind.size_initial as usize], _kind: kind, _owner: owner }
+ Self { elements: vec![None; kind.size_initial as usize], _kind: kind, _owner: owner }
}
pub(crate) fn get(&self, addr: usize) -> Result<Addr> {
- self.elements.get(addr).copied().ok_or_else(|| Trap::UndefinedElement { index: addr }.into())
+ self.elements
+ .get(addr)
+ .copied()
+ .ok_or_else(|| Error::Trap(Trap::UndefinedElement { index: addr }))
+ .map(|elem| elem.ok_or_else(|| Trap::UninitializedElement { index: addr }.into()))?
}
pub(crate) fn set(&mut self, addr: usize, value: Addr) -> Result<()> {
if addr >= self.elements.len() {
return Err(Error::Other(format!("table element {} not found", addr)));
}
- self.elements[addr] = value;
+ self.elements[addr] = Some(value);
Ok(())
}
@@ -440,6 +444,8 @@ impl TableInstance {
}
pub(crate) fn init(&mut self, offset: i32, init: &[Addr]) -> Result<()> {
+ let init = init.iter().map(|item| Some(*item)).collect::<Vec<_>>();
+
let offset = offset as usize;
let end = offset.checked_add(init.len()).ok_or_else(|| {
Error::Trap(crate::Trap::TableOutOfBounds { offset, len: init.len(), max: self.elements.len() })
@@ -449,7 +455,7 @@ impl TableInstance {
return Err(crate::Trap::TableOutOfBounds { offset, len: init.len(), max: self.elements.len() }.into());
}
- self.elements[offset..end].copy_from_slice(init);
+ self.elements[offset..end].copy_from_slice(&init);
Ok(())
}
}
@@ -573,13 +579,13 @@ impl GlobalInstance {
///
/// See <https://webassembly.github.io/spec/core/exec/runtime.html#element-instances>
#[derive(Debug)]
-pub(crate) struct ElemInstance {
+pub(crate) struct ElementInstance {
pub(crate) kind: ElementKind,
pub(crate) items: Option<Vec<u32>>, // none is the element was dropped
_owner: ModuleInstanceAddr, // index into store.module_instances
}
-impl ElemInstance {
+impl ElementInstance {
pub(crate) fn new(kind: ElementKind, owner: ModuleInstanceAddr, items: Option<Vec<u32>>) -> Self {
Self { kind, _owner: owner, items }
}
diff --git a/crates/tinywasm/tests/generated/mvp.csv b/crates/tinywasm/tests/generated/mvp.csv
index 3c3efcb..472bd35 100644
--- a/crates/tinywasm/tests/generated/mvp.csv
+++ b/crates/tinywasm/tests/generated/mvp.csv
@@ -2,4 +2,4 @@
0.0.5,11135,9093,[{"name":"address.wast","passed":1,"failed":259},{"name":"align.wast","passed":108,"failed":48},{"name":"binary-leb128.wast","passed":78,"failed":13},{"name":"binary.wast","passed":107,"failed":5},{"name":"block.wast","passed":170,"failed":53},{"name":"br.wast","passed":20,"failed":77},{"name":"br_if.wast","passed":29,"failed":89},{"name":"br_table.wast","passed":24,"failed":150},{"name":"call.wast","passed":18,"failed":73},{"name":"call_indirect.wast","passed":34,"failed":136},{"name":"comments.wast","passed":5,"failed":3},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":25,"failed":594},{"name":"custom.wast","passed":10,"failed":1},{"name":"data.wast","passed":22,"failed":39},{"name":"elem.wast","passed":27,"failed":72},{"name":"endianness.wast","passed":1,"failed":68},{"name":"exports.wast","passed":90,"failed":6},{"name":"f32.wast","passed":1018,"failed":1496},{"name":"f32_bitwise.wast","passed":4,"failed":360},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":1018,"failed":1496},{"name":"f64_bitwise.wast","passed":4,"failed":360},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":1,"failed":7},{"name":"float_exprs.wast","passed":275,"failed":625},{"name":"float_literals.wast","passed":112,"failed":51},{"name":"float_memory.wast","passed":0,"failed":90},{"name":"float_misc.wast","passed":138,"failed":303},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":81,"failed":91},{"name":"func_ptrs.wast","passed":7,"failed":29},{"name":"global.wast","passed":50,"failed":60},{"name":"i32.wast","passed":85,"failed":375},{"name":"i64.wast","passed":31,"failed":385},{"name":"if.wast","passed":116,"failed":125},{"name":"imports.wast","passed":23,"failed":160},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":38,"failed":70},{"name":"int_literals.wast","passed":25,"failed":26},{"name":"labels.wast","passed":13,"failed":16},{"name":"left-to-right.wast","passed":0,"failed":96},{"name":"linking.wast","passed":5,"failed":127},{"name":"load.wast","passed":59,"failed":38},{"name":"local_get.wast","passed":18,"failed":18},{"name":"local_set.wast","passed":38,"failed":15},{"name":"local_tee.wast","passed":41,"failed":56},{"name":"loop.wast","passed":42,"failed":78},{"name":"memory.wast","passed":30,"failed":49},{"name":"memory_grow.wast","passed":11,"failed":85},{"name":"memory_redundancy.wast","passed":1,"failed":7},{"name":"memory_size.wast","passed":6,"failed":36},{"name":"memory_trap.wast","passed":1,"failed":181},{"name":"names.wast","passed":484,"failed":2},{"name":"nop.wast","passed":4,"failed":84},{"name":"return.wast","passed":20,"failed":64},{"name":"select.wast","passed":28,"failed":120},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":2,"failed":5},{"name":"start.wast","passed":4,"failed":16},{"name":"store.wast","passed":59,"failed":9},{"name":"switch.wast","passed":2,"failed":26},{"name":"token.wast","passed":39,"failed":19},{"name":"traps.wast","passed":4,"failed":32},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":0,"failed":64},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":9,"failed":41},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}]
0.1.0,17630,2598,[{"name":"address.wast","passed":5,"failed":255},{"name":"align.wast","passed":108,"failed":48},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":110,"failed":2},{"name":"block.wast","passed":193,"failed":30},{"name":"br.wast","passed":84,"failed":13},{"name":"br_if.wast","passed":90,"failed":28},{"name":"br_table.wast","passed":25,"failed":149},{"name":"call.wast","passed":29,"failed":62},{"name":"call_indirect.wast","passed":36,"failed":134},{"name":"comments.wast","passed":7,"failed":1},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":371,"failed":248},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":47,"failed":14},{"name":"elem.wast","passed":50,"failed":49},{"name":"endianness.wast","passed":1,"failed":68},{"name":"exports.wast","passed":92,"failed":4},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":2,"failed":6},{"name":"float_exprs.wast","passed":761,"failed":139},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":6,"failed":84},{"name":"float_misc.wast","passed":437,"failed":4},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":124,"failed":48},{"name":"func_ptrs.wast","passed":10,"failed":26},{"name":"global.wast","passed":51,"failed":59},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":120,"failed":121},{"name":"imports.wast","passed":74,"failed":109},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":14,"failed":15},{"name":"left-to-right.wast","passed":1,"failed":95},{"name":"linking.wast","passed":21,"failed":111},{"name":"load.wast","passed":60,"failed":37},{"name":"local_get.wast","passed":32,"failed":4},{"name":"local_set.wast","passed":50,"failed":3},{"name":"local_tee.wast","passed":68,"failed":29},{"name":"loop.wast","passed":93,"failed":27},{"name":"memory.wast","passed":34,"failed":45},{"name":"memory_grow.wast","passed":12,"failed":84},{"name":"memory_redundancy.wast","passed":1,"failed":7},{"name":"memory_size.wast","passed":6,"failed":36},{"name":"memory_trap.wast","passed":2,"failed":180},{"name":"names.wast","passed":485,"failed":1},{"name":"nop.wast","passed":46,"failed":42},{"name":"return.wast","passed":73,"failed":11},{"name":"select.wast","passed":86,"failed":62},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":2,"failed":5},{"name":"start.wast","passed":9,"failed":11},{"name":"store.wast","passed":59,"failed":9},{"name":"switch.wast","passed":2,"failed":26},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":22,"failed":14},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":50,"failed":14},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":35,"failed":15},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}]
0.2.0,19344,884,[{"name":"address.wast","passed":181,"failed":79},{"name":"align.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":112,"failed":0},{"name":"block.wast","passed":220,"failed":3},{"name":"br.wast","passed":97,"failed":0},{"name":"br_if.wast","passed":118,"failed":0},{"name":"br_table.wast","passed":171,"failed":3},{"name":"call.wast","passed":73,"failed":18},{"name":"call_indirect.wast","passed":50,"failed":120},{"name":"comments.wast","passed":7,"failed":1},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":439,"failed":180},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":47,"failed":14},{"name":"elem.wast","passed":56,"failed":43},{"name":"endianness.wast","passed":29,"failed":40},{"name":"exports.wast","passed":92,"failed":4},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":6,"failed":2},{"name":"float_exprs.wast","passed":890,"failed":10},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":78,"failed":12},{"name":"float_misc.wast","passed":437,"failed":4},{"name":"forward.wast","passed":5,"failed":0},{"name":"func.wast","passed":168,"failed":4},{"name":"func_ptrs.wast","passed":10,"failed":26},{"name":"global.wast","passed":103,"failed":7},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":231,"failed":10},{"name":"imports.wast","passed":80,"failed":103},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":26,"failed":3},{"name":"left-to-right.wast","passed":92,"failed":4},{"name":"linking.wast","passed":29,"failed":103},{"name":"load.wast","passed":93,"failed":4},{"name":"local_get.wast","passed":36,"failed":0},{"name":"local_set.wast","passed":53,"failed":0},{"name":"local_tee.wast","passed":93,"failed":4},{"name":"loop.wast","passed":116,"failed":4},{"name":"memory.wast","passed":78,"failed":1},{"name":"memory_grow.wast","passed":91,"failed":5},{"name":"memory_redundancy.wast","passed":8,"failed":0},{"name":"memory_size.wast","passed":35,"failed":7},{"name":"memory_trap.wast","passed":180,"failed":2},{"name":"names.wast","passed":485,"failed":1},{"name":"nop.wast","passed":78,"failed":10},{"name":"return.wast","passed":84,"failed":0},{"name":"select.wast","passed":114,"failed":34},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":7,"failed":0},{"name":"start.wast","passed":11,"failed":9},{"name":"store.wast","passed":68,"failed":0},{"name":"switch.wast","passed":28,"failed":0},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":36,"failed":0},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":64,"failed":0},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":50,"failed":0},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}]
-0.3.0-alpha.0,20100,128,[{"name":"address.wast","passed":260,"failed":0},{"name":"align.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":112,"failed":0},{"name":"block.wast","passed":223,"failed":0},{"name":"br.wast","passed":97,"failed":0},{"name":"br_if.wast","passed":118,"failed":0},{"name":"br_table.wast","passed":174,"failed":0},{"name":"call.wast","passed":91,"failed":0},{"name":"call_indirect.wast","passed":169,"failed":1},{"name":"comments.wast","passed":8,"failed":0},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":619,"failed":0},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":61,"failed":0},{"name":"elem.wast","passed":86,"failed":13},{"name":"endianness.wast","passed":69,"failed":0},{"name":"exports.wast","passed":96,"failed":0},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":8,"failed":0},{"name":"float_exprs.wast","passed":900,"failed":0},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":90,"failed":0},{"name":"float_misc.wast","passed":441,"failed":0},{"name":"forward.wast","passed":5,"failed":0},{"name":"func.wast","passed":172,"failed":0},{"name":"func_ptrs.wast","passed":36,"failed":0},{"name":"global.wast","passed":110,"failed":0},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":241,"failed":0},{"name":"imports.wast","passed":108,"failed":75},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":29,"failed":0},{"name":"left-to-right.wast","passed":96,"failed":0},{"name":"linking.wast","passed":93,"failed":39},{"name":"load.wast","passed":97,"failed":0},{"name":"local_get.wast","passed":36,"failed":0},{"name":"local_set.wast","passed":53,"failed":0},{"name":"local_tee.wast","passed":97,"failed":0},{"name":"loop.wast","passed":120,"failed":0},{"name":"memory.wast","passed":79,"failed":0},{"name":"memory_grow.wast","passed":96,"failed":0},{"name":"memory_redundancy.wast","passed":8,"failed":0},{"name":"memory_size.wast","passed":42,"failed":0},{"name":"memory_trap.wast","passed":182,"failed":0},{"name":"names.wast","passed":486,"failed":0},{"name":"nop.wast","passed":88,"failed":0},{"name":"return.wast","passed":84,"failed":0},{"name":"select.wast","passed":148,"failed":0},{"name":"skip-stack-guard-page.wast","passed":11,"failed":0},{"name":"stack.wast","passed":7,"failed":0},{"name":"start.wast","passed":20,"failed":0},{"name":"store.wast","passed":68,"failed":0},{"name":"switch.wast","passed":28,"failed":0},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":36,"failed":0},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":64,"failed":0},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":50,"failed":0},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}]
+0.3.0-alpha.0,20113,115,[{"name":"address.wast","passed":260,"failed":0},{"name":"align.wast","passed":156,"failed":0},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":112,"failed":0},{"name":"block.wast","passed":223,"failed":0},{"name":"br.wast","passed":97,"failed":0},{"name":"br_if.wast","passed":118,"failed":0},{"name":"br_table.wast","passed":174,"failed":0},{"name":"call.wast","passed":91,"failed":0},{"name":"call_indirect.wast","passed":170,"failed":0},{"name":"comments.wast","passed":8,"failed":0},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":619,"failed":0},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":61,"failed":0},{"name":"elem.wast","passed":85,"failed":14},{"name":"endianness.wast","passed":69,"failed":0},{"name":"exports.wast","passed":96,"failed":0},{"name":"f32.wast","passed":2514,"failed":0},{"name":"f32_bitwise.wast","passed":364,"failed":0},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":2514,"failed":0},{"name":"f64_bitwise.wast","passed":364,"failed":0},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":8,"failed":0},{"name":"float_exprs.wast","passed":900,"failed":0},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":90,"failed":0},{"name":"float_misc.wast","passed":441,"failed":0},{"name":"forward.wast","passed":5,"failed":0},{"name":"func.wast","passed":172,"failed":0},{"name":"func_ptrs.wast","passed":36,"failed":0},{"name":"global.wast","passed":110,"failed":0},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":241,"failed":0},{"name":"imports.wast","passed":112,"failed":71},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":29,"failed":0},{"name":"left-to-right.wast","passed":96,"failed":0},{"name":"linking.wast","passed":102,"failed":30},{"name":"load.wast","passed":97,"failed":0},{"name":"local_get.wast","passed":36,"failed":0},{"name":"local_set.wast","passed":53,"failed":0},{"name":"local_tee.wast","passed":97,"failed":0},{"name":"loop.wast","passed":120,"failed":0},{"name":"memory.wast","passed":79,"failed":0},{"name":"memory_grow.wast","passed":96,"failed":0},{"name":"memory_redundancy.wast","passed":8,"failed":0},{"name":"memory_size.wast","passed":42,"failed":0},{"name":"memory_trap.wast","passed":182,"failed":0},{"name":"names.wast","passed":486,"failed":0},{"name":"nop.wast","passed":88,"failed":0},{"name":"return.wast","passed":84,"failed":0},{"name":"select.wast","passed":148,"failed":0},{"name":"skip-stack-guard-page.wast","passed":11,"failed":0},{"name":"stack.wast","passed":7,"failed":0},{"name":"start.wast","passed":20,"failed":0},{"name":"store.wast","passed":68,"failed":0},{"name":"switch.wast","passed":28,"failed":0},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":36,"failed":0},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":64,"failed":0},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":50,"failed":0},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}]
diff --git a/crates/tinywasm/tests/generated/progress-mvp.svg b/crates/tinywasm/tests/generated/progress-mvp.svg
index 86912c5..9b97cfd 100644
--- a/crates/tinywasm/tests/generated/progress-mvp.svg
+++ b/crates/tinywasm/tests/generated/progress-mvp.svg
@@ -53,12 +53,12 @@ v0.2.0 (19344)
</text>
<polyline fill="none" opacity="1" stroke="#000000" stroke-width="1" points="716,345 716,350 "/>
<text x="898" y="355" dy="0.76em" text-anchor="middle" font-family="Victor Mono" font-size="12.096774193548388" opacity="1" fill="#000000">
-v0.3.0-alpha.0 (20087)
+v0.3.0-alpha.0 (20113)
</text>
<polyline fill="none" opacity="1" stroke="#000000" stroke-width="1" points="898,345 898,350 "/>
+<rect x="812" y="56" width="172" height="288" opacity="0.5" fill="#0000FF" stroke="none"/>
<rect x="266" y="185" width="172" height="159" opacity="0.5" fill="#0000FF" stroke="none"/>
-<rect x="448" y="92" width="172" height="252" opacity="0.5" fill="#0000FF" stroke="none"/>
-<rect x="812" y="57" width="172" height="287" opacity="0.5" fill="#0000FF" stroke="none"/>
<rect x="85" y="212" width="171" height="132" opacity="0.5" fill="#0000FF" stroke="none"/>
<rect x="630" y="67" width="172" height="277" opacity="0.5" fill="#0000FF" stroke="none"/>
+<rect x="448" y="92" width="172" height="252" opacity="0.5" fill="#0000FF" stroke="none"/>
</svg>
diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs
index c90f3df..d5de50a 100644
--- a/crates/types/src/instructions.rs
+++ b/crates/types/src/instructions.rs
@@ -11,7 +11,7 @@ pub enum BlockArgs {
/// Represents a memory immediate in a WebAssembly memory instruction.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub struct MemArg {
+pub struct MemoryArg {
pub mem_addr: MemAddr,
pub align: u8,
pub align_max: u8,
@@ -82,29 +82,29 @@ pub enum Instruction {
GlobalSet(GlobalAddr),
// Memory Instructions
- I32Load(MemArg),
- I64Load(MemArg),
- F32Load(MemArg),
- F64Load(MemArg),
- I32Load8S(MemArg),
- I32Load8U(MemArg),
- I32Load16S(MemArg),
- I32Load16U(MemArg),
- I64Load8S(MemArg),
- I64Load8U(MemArg),
- I64Load16S(MemArg),
- I64Load16U(MemArg),
- I64Load32S(MemArg),
- I64Load32U(MemArg),
- I32Store(MemArg),
- I64Store(MemArg),
- F32Store(MemArg),
- F64Store(MemArg),
- I32Store8(MemArg),
- I32Store16(MemArg),
- I64Store8(MemArg),
- I64Store16(MemArg),
- I64Store32(MemArg),
+ I32Load(MemoryArg),
+ I64Load(MemoryArg),
+ F32Load(MemoryArg),
+ F64Load(MemoryArg),
+ I32Load8S(MemoryArg),
+ I32Load8U(MemoryArg),
+ I32Load16S(MemoryArg),
+ I32Load16U(MemoryArg),
+ I64Load8S(MemoryArg),
+ I64Load8U(MemoryArg),
+ I64Load16S(MemoryArg),
+ I64Load16U(MemoryArg),
+ I64Load32S(MemoryArg),
+ I64Load32U(MemoryArg),
+ I32Store(MemoryArg),
+ I64Store(MemoryArg),
+ F32Store(MemoryArg),
+ F64Store(MemoryArg),
+ I32Store8(MemoryArg),
+ I32Store16(MemoryArg),
+ I64Store8(MemoryArg),
+ I64Store16(MemoryArg),
+ I64Store32(MemoryArg),
MemorySize(MemAddr, u8),
MemoryGrow(MemAddr, u8),