summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/tinywasm/src/func.rs12
-rw-r--r--crates/tinywasm/src/instance.rs8
-rw-r--r--crates/tinywasm/src/runtime/executor/mod.rs87
-rw-r--r--crates/tinywasm/src/runtime/stack/call_stack.rs22
-rw-r--r--crates/tinywasm/src/store.rs12
-rw-r--r--crates/tinywasm/tests/generated/mvp.csv2
-rw-r--r--crates/tinywasm/tests/generated/progress-mvp.svg4
7 files changed, 72 insertions, 75 deletions
diff --git a/crates/tinywasm/src/func.rs b/crates/tinywasm/src/func.rs
index 9f9d95a..8518af0 100644
--- a/crates/tinywasm/src/func.rs
+++ b/crates/tinywasm/src/func.rs
@@ -27,7 +27,7 @@ impl FuncHandle {
// 1. Assert: funcs[func_addr] exists
// 2. let func_inst be the functiuon instance funcs[func_addr]
- let func_inst = store.get_func(self.addr as usize)?;
+ let func_inst = store.get_func(self.addr as usize)?.clone();
// 3. Let func_ty be the function type
let func_ty = &self.ty;
@@ -52,18 +52,18 @@ impl FuncHandle {
}
}
- let wasm_func = match &func_inst.func {
+ let locals = match &func_inst.func {
crate::Function::Host(h) => {
let func = h.func.clone();
let ctx = FuncContext { store, module: &self.module };
return (func)(ctx, params);
}
- crate::Function::Wasm(ref f) => f,
+ crate::Function::Wasm(ref f) => f.locals.to_vec(),
};
// 6. Let f be the dummy frame
- debug!("locals: {:?}", wasm_func.locals);
- let call_frame = CallFrame::new(self.addr as usize, params, wasm_func.locals.to_vec(), self.module.id());
+ debug!("locals: {:?}", locals);
+ let call_frame = CallFrame::new(func_inst, params, locals);
// 7. Push the frame f to the call stack
// & 8. Push the values to the stack (Not needed since the call frame owns the values)
@@ -71,7 +71,7 @@ impl FuncHandle {
// 9. Invoke the function instance
let runtime = store.runtime();
- runtime.exec(store, &mut stack, self.module.clone())?;
+ runtime.exec(store, &mut stack)?;
// Once the function returns:
let result_m = func_ty.results.len();
diff --git a/crates/tinywasm/src/instance.rs b/crates/tinywasm/src/instance.rs
index aa94efa..d7298af 100644
--- a/crates/tinywasm/src/instance.rs
+++ b/crates/tinywasm/src/instance.rs
@@ -81,7 +81,7 @@ impl ModuleInstance {
mem_addrs: addrs.memories.into_boxed_slice(),
global_addrs: addrs.globals.into_boxed_slice(),
elem_addrs,
- data_addrs: data_addrs,
+ data_addrs,
func_start: data.start_func,
imports: data.imports,
exports: data.exports,
@@ -111,11 +111,7 @@ impl ModuleInstance {
&self.0.func_addrs
}
- pub(crate) fn _global_addrs(&self) -> &[GlobalAddr] {
- &self.0.global_addrs
- }
-
- pub(crate) fn func_ty_addrs(&self) -> &[FuncType] {
+ pub(crate) fn func_tys(&self) -> &[FuncType] {
&self.0.types
}
diff --git a/crates/tinywasm/src/runtime/executor/mod.rs b/crates/tinywasm/src/runtime/executor/mod.rs
index 42a2dc0..38d59d5 100644
--- a/crates/tinywasm/src/runtime/executor/mod.rs
+++ b/crates/tinywasm/src/runtime/executor/mod.rs
@@ -15,32 +15,32 @@ use macros::*;
use traits::*;
impl DefaultRuntime {
- pub(crate) fn exec(&self, store: &mut Store, stack: &mut Stack, module: ModuleInstance) -> Result<()> {
- log::debug!("func_addrs: {:?}", module.func_addrs());
- log::debug!("func_ty_addrs: {:?}", module.func_ty_addrs().len());
- log::debug!("store funcs: {:?}", store.data.funcs.len());
-
+ pub(crate) fn exec(&self, store: &mut Store, stack: &mut Stack) -> Result<()> {
// The current call frame, gets updated inside of exec_one
let mut cf = stack.call_stack.pop()?;
- // The function to execute, gets updated from ExecResult::Call
- let mut func_inst = store.get_func(cf.func_ptr)?.clone();
+ let mut func_inst = cf.func_instance.clone();
let mut wasm_func = func_inst.assert_wasm().expect("exec expected wasm function");
+
+ // The function to execute, gets updated from ExecResult::Call
let mut instrs = &wasm_func.instructions;
- let mut current_module = module;
+ let mut current_module = store
+ .get_module_instance(func_inst.owner)
+ .expect("exec expected module instance to exist for function")
+ .clone();
while let Some(instr) = instrs.get(cf.instr_ptr) {
match exec_one(&mut cf, instr, instrs, stack, store, &current_module)? {
// Continue execution at the new top of the call stack
ExecResult::Call => {
cf = stack.call_stack.pop()?;
- func_inst = store.get_func(cf.func_ptr)?.clone();
- wasm_func = func_inst.assert_wasm().expect("call expected wasm function");
+ func_inst = cf.func_instance.clone();
+ wasm_func = func_inst.assert_wasm().expect("exec expected wasm function");
instrs = &wasm_func.instructions;
- if cf.module != current_module.id() {
- current_module.swap(store.get_module_instance(cf.module).unwrap().clone());
+ if cf.func_instance.owner != current_module.id() {
+ current_module.swap(store.get_module_instance(cf.func_instance.owner).unwrap().clone());
}
continue;
@@ -135,10 +135,10 @@ fn exec_one(
log::info!("start call");
// prepare the call frame
let func_idx = module.resolve_func_addr(*v);
- let func_inst = store.get_func(func_idx as usize)?;
+ let func_inst = store.get_func(func_idx as usize)?.clone();
- let func = match &func_inst.func {
- crate::Function::Wasm(ref f) => f,
+ let (locals, ty) = match &func_inst.func {
+ crate::Function::Wasm(ref f) => (f.locals.to_vec(), f.ty.clone()),
crate::Function::Host(host_func) => {
let func = host_func.func.clone();
log::info!("Getting params: {:?}", host_func.ty.params);
@@ -150,8 +150,11 @@ fn exec_one(
}
};
- let params = stack.values.pop_n_rev(func.ty.params.len())?;
- let call_frame = CallFrame::new_raw(func_idx as usize, &params, func.locals.to_vec(), func_inst._owner);
+ let params = stack.values.pop_n_rev(ty.params.len())?;
+ log::info!("call: current fn owner: {:?}", module.id());
+ log::info!("call: func owner: {:?}", func_inst.owner);
+
+ let call_frame = CallFrame::new_raw(func_inst, &params, locals);
// push the call frame
cf.instr_ptr += 1; // skip the call instruction
@@ -163,29 +166,39 @@ fn exec_one(
}
CallIndirect(type_addr, table_addr) => {
- let table_idx = module.resolve_table_addr(*table_addr);
- let table = store.get_table(table_idx as usize)?;
-
- // TODO: currently, the type resolution is subtlely broken for imported functions
-
- let call_ty = module.func_ty(*type_addr);
-
- let func_idx = stack.values.pop_t::<u32>()?;
+ let table = store.get_table(module.resolve_table_addr(*table_addr) as usize)?;
+ let table_idx = stack.values.pop_t::<u32>()?;
// verify that the table is of the right type, this should be validated by the parser already
assert!(table.borrow().kind.element_type == ValType::RefFunc, "table is not of type funcref");
- let func_ref = table
- .borrow()
- .get(func_idx as usize)?
- .addr()
- .ok_or_else(|| Trap::UninitializedElement { index: func_idx as usize })?;
+ let func_ref = {
+ table
+ .borrow()
+ .get(table_idx as usize)?
+ .addr()
+ .ok_or(Trap::UninitializedElement { index: table_idx as usize })?
+ };
- let func_inst = store.get_func(func_ref as usize)?;
+ let func_inst = store.get_func(func_ref as usize)?.clone();
let func_ty = func_inst.func.ty();
- let func = match &func_inst.func {
- crate::Function::Wasm(ref f) => f,
+ log::info!("type_addr: {}", type_addr);
+ log::info!("types: {:?}", module.func_tys());
+ let call_ty = module.func_ty(*type_addr);
+
+ log::info!("call_indirect: current fn owner: {:?}", module.id());
+ log::info!("call_indirect: func owner: {:?}", func_inst.owner);
+
+ if func_ty != call_ty {
+ log::error!("indirect call type mismatch: {:?} != {:?}", func_ty, call_ty);
+ return Err(
+ Trap::IndirectCallTypeMismatch { actual: func_ty.clone(), expected: call_ty.clone() }.into()
+ );
+ }
+
+ let locals = match &func_inst.func {
+ crate::Function::Wasm(ref f) => f.locals.to_vec(),
crate::Function::Host(host_func) => {
let func = host_func.func.clone();
let params = stack.values.pop_params(&func_ty.params)?;
@@ -195,14 +208,8 @@ fn exec_one(
}
};
- if func_ty != call_ty {
- return Err(
- Trap::IndirectCallTypeMismatch { actual: func_ty.clone(), expected: call_ty.clone() }.into()
- );
- }
-
let params = stack.values.pop_n_rev(func_ty.params.len())?;
- let call_frame = CallFrame::new_raw(func_ref as usize, &params, func.locals.to_vec(), func_inst._owner);
+ let call_frame = CallFrame::new_raw(func_inst, &params, locals);
// push the call frame
cf.instr_ptr += 1; // skip the call instruction
diff --git a/crates/tinywasm/src/runtime/stack/call_stack.rs b/crates/tinywasm/src/runtime/stack/call_stack.rs
index b1c4f67..1bcd474 100644
--- a/crates/tinywasm/src/runtime/stack/call_stack.rs
+++ b/crates/tinywasm/src/runtime/stack/call_stack.rs
@@ -1,6 +1,6 @@
-use crate::{runtime::RawWasmValue, BlockType, Error, LabelFrame, Result, Trap};
-use alloc::{boxed::Box, vec::Vec};
-use tinywasm_types::{ModuleInstanceAddr, ValType, WasmValue};
+use crate::{runtime::RawWasmValue, BlockType, Error, FunctionInstance, LabelFrame, Result, Trap};
+use alloc::{boxed::Box, rc::Rc, vec::Vec};
+use tinywasm_types::{ValType, WasmValue};
use super::blocks::Labels;
@@ -52,9 +52,9 @@ impl CallStack {
#[derive(Debug, Clone)]
pub(crate) struct CallFrame {
- pub(crate) module: ModuleInstanceAddr,
pub(crate) instr_ptr: usize,
- pub(crate) func_ptr: usize,
+ // pub(crate) module: ModuleInstanceAddr,
+ pub(crate) func_instance: Rc<FunctionInstance>,
pub(crate) labels: Labels,
pub(crate) locals: Box<[RawWasmValue]>,
@@ -109,10 +109,9 @@ impl CallFrame {
}
pub(crate) fn new_raw(
- func_ptr: usize,
+ func_instance_ptr: Rc<FunctionInstance>,
params: &[RawWasmValue],
local_types: Vec<ValType>,
- module: ModuleInstanceAddr,
) -> Self {
let mut locals = Vec::with_capacity(local_types.len() + params.len());
locals.extend(params.iter().cloned());
@@ -120,25 +119,22 @@ impl CallFrame {
Self {
instr_ptr: 0,
- func_ptr,
+ func_instance: func_instance_ptr,
local_count: locals.len(),
locals: locals.into_boxed_slice(),
labels: Labels::default(),
- module,
}
}
pub(crate) fn new(
- func_ptr: usize,
+ func_instance_ptr: Rc<FunctionInstance>,
params: &[WasmValue],
local_types: Vec<ValType>,
- module: ModuleInstanceAddr,
) -> Self {
CallFrame::new_raw(
- func_ptr,
+ func_instance_ptr,
&params.iter().map(|v| RawWasmValue::from(*v)).collect::<Vec<_>>(),
local_types,
- module,
)
}
diff --git a/crates/tinywasm/src/store.rs b/crates/tinywasm/src/store.rs
index 4d33476..9bbb125 100644
--- a/crates/tinywasm/src/store.rs
+++ b/crates/tinywasm/src/store.rs
@@ -121,7 +121,7 @@ impl Store {
self.data.funcs.push(Rc::new(FunctionInstance {
func: Function::Wasm(func),
_type_idx: type_idx,
- _owner: idx,
+ owner: idx,
}));
func_addrs.push((i + func_count) as FuncAddr);
}
@@ -303,7 +303,7 @@ impl Store {
}
pub(crate) fn add_func(&mut self, func: Function, type_idx: TypeAddr, idx: ModuleInstanceAddr) -> Result<FuncAddr> {
- self.data.funcs.push(Rc::new(FunctionInstance { func, _type_idx: type_idx, _owner: idx }));
+ self.data.funcs.push(Rc::new(FunctionInstance { func, _type_idx: type_idx, owner: idx }));
Ok(self.data.funcs.len() as FuncAddr - 1)
}
@@ -388,7 +388,7 @@ impl Store {
pub struct FunctionInstance {
pub(crate) func: Function,
pub(crate) _type_idx: TypeAddr,
- pub(crate) _owner: ModuleInstanceAddr, // index into store.module_instances, none for host functions
+ pub(crate) owner: ModuleInstanceAddr, // index into store.module_instances, none for host functions
}
// TODO: check if this actually helps
@@ -442,10 +442,8 @@ impl TableInstance {
let val = self.get(addr)?.addr();
Ok(match self.kind.element_type {
- ValType::RefFunc => val.map(|v| WasmValue::RefFunc(v)).unwrap_or(WasmValue::RefNull(ValType::RefFunc)),
- ValType::RefExtern => {
- val.map(|v| WasmValue::RefExtern(v)).unwrap_or(WasmValue::RefNull(ValType::RefExtern))
- }
+ ValType::RefFunc => val.map(WasmValue::RefFunc).unwrap_or(WasmValue::RefNull(ValType::RefFunc)),
+ ValType::RefExtern => val.map(WasmValue::RefExtern).unwrap_or(WasmValue::RefNull(ValType::RefExtern)),
_ => unimplemented!("unsupported table type: {:?}", self.kind.element_type),
})
}
diff --git a/crates/tinywasm/tests/generated/mvp.csv b/crates/tinywasm/tests/generated/mvp.csv
index a8dd2b5..5a34eba 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,20151,103,[{"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":91,"failed":8},{"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":108,"failed":24},{"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":"table.wast","passed":19,"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":"unreached-valid.wast","passed":7,"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,20160,94,[{"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":91,"failed":8},{"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":117,"failed":15},{"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":"table.wast","passed":19,"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":"unreached-valid.wast","passed":7,"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 a7c27e4..6168c6d 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 (20140)
+v0.3.0-alpha.0 (20151)
</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="630" y="68" width="172" height="276" 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="85" y="212" width="171" height="132" opacity="0.5" fill="#0000FF" stroke="none"/>
+<rect x="266" y="185" width="172" height="159" opacity="0.5" fill="#0000FF" stroke="none"/>
</svg>