diff options
-rw-r--r-- | src/wasm/wasm-binary.cpp | 37 | ||||
-rw-r--r-- | test/atomics.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/atomics64.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/binaryen.js/debug-info.js.txt | 2 | ||||
-rw-r--r-- | test/duplicate_types.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/export-import.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/grow_memory.wast.fromBinary | 4 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary | 136 | ||||
-rw-r--r-- | test/kitchen_sink.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/memory-import.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/memory-import64.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/min.wast.fromBinary | 8 | ||||
-rw-r--r-- | test/mutable-global.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/polymorphic_stack.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/reference-types.wast.fromBinary | 40 | ||||
-rw-r--r-- | test/reg_switch.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/signext.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/subtypes.wast.fromBinary | 28 | ||||
-rw-r--r-- | test/table-import.wast.fromBinary | 2 | ||||
-rw-r--r-- | test/tail-call.wast.fromBinary | 4 | ||||
-rw-r--r-- | test/typed-function-references.wast.fromBinary | 34 |
21 files changed, 177 insertions, 140 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 0ddc11320..0f5a03117 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -685,6 +685,27 @@ void WasmBinaryWriter::writeNames() { } } + // type names + { + std::vector<HeapType> namedTypes; + for (auto& kv : typeIndices) { + auto type = kv.first; + if (wasm->typeNames.count(type)) { + namedTypes.push_back(type); + } + } + if (!namedTypes.empty()) { + auto substart = + startSubsection(BinaryConsts::UserSections::Subsection::NameType); + o << U32LEB(namedTypes.size()); + for (auto type : namedTypes) { + o << U32LEB(typeIndices[type]); + writeEscapedName(wasm->typeNames[type].name.str); + } + finishSubsection(substart); + } + } + // table names { std::vector<std::pair<Index, Table*>> tablesWithNames; @@ -2805,6 +2826,22 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) { } } } + } else if (nameType == BinaryConsts::UserSections::Subsection::NameType) { + auto num = getU32LEB(); + NameProcessor processor; + for (size_t i = 0; i < num; i++) { + auto index = getU32LEB(); + auto rawName = getInlineString(); + auto name = processor.process(rawName); + if (index < types.size()) { + wasm.typeNames[types[index]].name = name; + } else { + std::cerr << "warning: type index out of bounds in name section, " + "type subsection: " + << std::string(rawName.str) << " at index " + << std::to_string(index) << std::endl; + } + } } else if (nameType == BinaryConsts::UserSections::Subsection::NameTable) { auto num = getU32LEB(); NameProcessor processor; diff --git a/test/atomics.wast.fromBinary b/test/atomics.wast.fromBinary index c9ce94c70..e3f773b83 100644 --- a/test/atomics.wast.fromBinary +++ b/test/atomics.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_none (func)) + (type $0 (func)) (memory $0 (shared 23 256)) (func $atomic-loadstore (local $0 i32) diff --git a/test/atomics64.wast.fromBinary b/test/atomics64.wast.fromBinary index fc405c15c..2661142cf 100644 --- a/test/atomics64.wast.fromBinary +++ b/test/atomics64.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_none (func)) + (type $0 (func)) (memory $0 (shared i64 23 256)) (func $atomic-loadstore (local $0 i32) diff --git a/test/binaryen.js/debug-info.js.txt b/test/binaryen.js/debug-info.js.txt index 4cbe177b8..1d557b337 100644 --- a/test/binaryen.js/debug-info.js.txt +++ b/test/binaryen.js/debug-info.js.txt @@ -12,7 +12,7 @@ debugInfo=false === with debug info === debugInfo=true (module - (type $none_=>_none (func)) + (type $v (func)) (memory $0 0) (export "test" (func $test)) (func $test diff --git a/test/duplicate_types.wast.fromBinary b/test/duplicate_types.wast.fromBinary index adc0a3ea2..2c444d3c2 100644 --- a/test/duplicate_types.wast.fromBinary +++ b/test/duplicate_types.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $i32_=>_none (func (param i32))) + (type $0 (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (func $f0 (param $0 i32) (nop) diff --git a/test/export-import.wast.fromBinary b/test/export-import.wast.fromBinary index b260f8064..d73486e08 100644 --- a/test/export-import.wast.fromBinary +++ b/test/export-import.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_none (func)) + (type $v (func)) (import "env" "test2" (global $test2 i32)) (import "env" "test1" (func $test1)) (export "test1" (func $test1)) diff --git a/test/grow_memory.wast.fromBinary b/test/grow_memory.wast.fromBinary index 82b5b18af..1071d7b4b 100644 --- a/test/grow_memory.wast.fromBinary +++ b/test/grow_memory.wast.fromBinary @@ -1,6 +1,6 @@ (module - (type $none_=>_i32 (func (result i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) + (type $1 (func (result i32))) + (type $0 (func (param i32) (result i32))) (memory $0 1) (export "memory" (memory $0)) (export "grow" (func $0)) diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary index 303038693..78e01e494 100644 --- a/test/heap-types.wast.fromBinary +++ b/test/heap-types.wast.fromBinary @@ -1,105 +1,105 @@ (module - (type ${i32_f32_f64} (struct (field i32) (field f32) (field f64))) - (type ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref null ${i32_f32_f64})) (field (mut (ref null ${i32_f32_f64}))))) - (type $[ref?|[mut:f64]|] (array (ref null $[mut:f64]))) - (type $[mut:f64] (array (mut f64))) + (type $struct.A (struct (field i32) (field f32) (field f64))) + (type $struct.B (struct (field i8) (field (mut i16)) (field (ref null $struct.A)) (field (mut (ref null $struct.A))))) + (type $matrix (array (ref null $vector))) + (type $vector (array (mut f64))) (type $anyref_=>_none (func (param anyref))) - (type ${} (struct )) - (type ${mut:f32} (struct (field (mut f32)))) + (type $parent (struct )) + (type $struct.C (struct (field (mut f32)))) (type $none_=>_none (func)) - (type $rtt_1_${}_=>_none (func (param (rtt 1 ${})))) - (type $rtt_${}_=>_none (func (param (rtt ${})))) - (type $ref?|{i32_f32_f64}|_=>_ref?|{i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}| (func (param (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})))) - (type $ref?|[mut:f64]|_=>_ref?|[ref?|[mut:f64]|]| (func (param (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|])))) - (type ${i32} (struct (field i32))) - (type ${i32_i64} (struct (field i32) (field i64))) - (type $[mut:i32] (array (mut i32))) - (type $[mut:i8] (array (mut i8))) - (global $rttparent (rtt 0 ${}) (rtt.canon ${})) - (global $rttchild (rtt 1 ${i32}) (rtt.sub ${i32} + (type $rtt_1_$parent_=>_none (func (param (rtt 1 $parent)))) + (type $rtt_$parent_=>_none (func (param (rtt $parent)))) + (type $ref?|$struct.A|_=>_ref?|$struct.B| (func (param (ref null $struct.A)) (result (ref null $struct.B)))) + (type $ref?|$vector|_=>_ref?|$matrix| (func (param (ref null $vector)) (result (ref null $matrix)))) + (type $child (struct (field i32))) + (type $grandchild (struct (field i32) (field i64))) + (type $words (array (mut i32))) + (type $bytes (array (mut i8))) + (global $rttparent (rtt 0 $parent) (rtt.canon $parent)) + (global $rttchild (rtt 1 $child) (rtt.sub $child (global.get $rttparent) )) - (global $rttgrandchild (rtt 2 ${i32_i64}) (rtt.sub ${i32_i64} + (global $rttgrandchild (rtt 2 $grandchild) (rtt.sub $grandchild (global.get $rttchild) )) - (func $structs (param $x (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})) - (local $tA (ref null ${i32_f32_f64})) - (local $tB (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})) - (local $tc (ref null ${mut:f32})) - (local $tv (ref null $[ref?|[mut:f64]|])) - (local $tm (ref null $[mut:f64])) + (func $structs (param $x (ref null $struct.A)) (result (ref null $struct.B)) + (local $tA (ref null $struct.A)) + (local $tB (ref null $struct.B)) + (local $tc (ref null $struct.C)) + (local $tv (ref null $matrix)) + (local $tm (ref null $vector)) (drop (local.get $x) ) (drop - (struct.get ${i32_f32_f64} 0 + (struct.get $struct.A 0 (local.get $x) ) ) (drop - (struct.get ${i32_f32_f64} 1 + (struct.get $struct.A 1 (local.get $x) ) ) (drop - (struct.get ${i32_f32_f64} 2 + (struct.get $struct.A 2 (local.get $x) ) ) (drop - (struct.get ${i32_f32_f64} 2 + (struct.get $struct.A 2 (local.get $x) ) ) (drop - (struct.get_u ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0 + (struct.get_u $struct.B 0 (local.get $tB) ) ) (drop - (struct.get_s ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0 + (struct.get_s $struct.B 0 (local.get $tB) ) ) (drop - (ref.null ${i32_f32_f64}) + (ref.null $struct.A) ) (drop - (block $label$1 (result (ref null ${i32_f32_f64})) + (block $label$1 (result (ref null $struct.A)) (local.get $x) ) ) (drop - (if (result (ref null ${i32_f32_f64})) + (if (result (ref null $struct.A)) (i32.const 1) (local.get $x) (local.get $x) ) ) (drop - (loop $label$4 (result (ref null ${i32_f32_f64})) + (loop $label$4 (result (ref null $struct.A)) (local.get $x) ) ) (drop - (select (result (ref null ${i32_f32_f64})) + (select (result (ref null $struct.A)) (local.get $x) (local.get $x) (i32.const 1) ) ) - (struct.set ${mut:f32} 0 - (ref.null ${mut:f32}) + (struct.set $struct.C 0 + (ref.null $struct.C) (f32.const 100) ) (drop - (struct.new_default_with_rtt ${i32_f32_f64} - (rtt.canon ${i32_f32_f64}) + (struct.new_default_with_rtt $struct.A + (rtt.canon $struct.A) ) ) (drop - (struct.new_with_rtt ${i32_f32_f64} - (rtt.canon ${i32_f32_f64}) + (struct.new_with_rtt $struct.A + (rtt.canon $struct.A) (i32.const 1) (f32.const 2.3450000286102295) (f64.const 3.14159) @@ -107,91 +107,91 @@ ) (unreachable) ) - (func $arrays (param $x (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|])) - (local $tv (ref null $[ref?|[mut:f64]|])) - (local $tm (ref null $[mut:i32])) - (local $tb (ref null $[mut:i8])) - (local $tw (ref null $[mut:f64])) + (func $arrays (param $x (ref null $vector)) (result (ref null $matrix)) + (local $tv (ref null $matrix)) + (local $tm (ref null $words)) + (local $tb (ref null $bytes)) + (local $tw (ref null $vector)) (drop - (array.new_with_rtt $[mut:f64] - (rtt.canon $[mut:f64]) + (array.new_with_rtt $vector + (rtt.canon $vector) (i32.const 3) (f64.const 3.14159) ) ) (drop - (array.new_default_with_rtt $[ref?|[mut:f64]|] - (rtt.canon $[ref?|[mut:f64]|]) + (array.new_default_with_rtt $matrix + (rtt.canon $matrix) (i32.const 10) ) ) (drop - (array.get $[mut:f64] + (array.get $vector (local.get $x) (i32.const 2) ) ) - (array.set $[mut:f64] + (array.set $vector (local.get $x) (i32.const 2) (f64.const 2.18281828) ) (drop - (array.len $[mut:f64] + (array.len $vector (local.get $x) ) ) (drop - (array.get $[mut:i32] + (array.get $words (local.get $tm) (i32.const 1) ) ) (drop - (array.get_u $[mut:i8] + (array.get_u $bytes (local.get $tb) (i32.const 2) ) ) (drop - (array.get_s $[mut:i8] + (array.get_s $bytes (local.get $tb) (i32.const 3) ) ) (unreachable) ) - (func $rtt-param-with-depth (param $rtt (rtt 1 ${})) + (func $rtt-param-with-depth (param $rtt (rtt 1 $parent)) (nop) ) - (func $rtt-param-without-depth (param $rtt (rtt ${})) + (func $rtt-param-without-depth (param $rtt (rtt $parent)) (nop) ) (func $rtt-operations - (local $temp.A (ref null ${i32_f32_f64})) + (local $temp.A (ref null $struct.A)) (drop - (ref.test ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} - (ref.null ${i32_f32_f64}) - (rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}) + (ref.test $struct.B + (ref.null $struct.A) + (rtt.canon $struct.B) ) ) (drop - (ref.cast ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} - (ref.null ${i32_f32_f64}) - (rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}) + (ref.cast $struct.B + (ref.null $struct.A) + (rtt.canon $struct.B) ) ) (drop - (block $label$1 (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})) + (block $label$1 (result (ref null $struct.B)) (local.set $temp.A (br_on_cast $label$1 - (ref.null ${i32_f32_f64}) - (rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}) + (ref.null $struct.A) + (rtt.canon $struct.B) ) ) (block $label$2 (drop - (ref.null ${i32_f32_f64}) + (ref.null $struct.A) ) (unreachable) ) diff --git a/test/kitchen_sink.wast.fromBinary b/test/kitchen_sink.wast.fromBinary index 11f5a2e53..e0d20d32f 100644 --- a/test/kitchen_sink.wast.fromBinary +++ b/test/kitchen_sink.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_i32 (func (result i32))) + (type $0 (func (result i32))) (memory $0 4096 4096) (data (i32.const 1026) "\14\00") (func $kitchensink (result i32) diff --git a/test/memory-import.wast.fromBinary b/test/memory-import.wast.fromBinary index 66554b97a..e03f853d0 100644 --- a/test/memory-import.wast.fromBinary +++ b/test/memory-import.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_i32 (func (result i32))) + (type $0 (func (result i32))) (import "env" "memory" (memory $0 1 1)) (func $foo (result i32) (i32.load offset=13 diff --git a/test/memory-import64.wast.fromBinary b/test/memory-import64.wast.fromBinary index fc3e57875..c89e3a6ca 100644 --- a/test/memory-import64.wast.fromBinary +++ b/test/memory-import64.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_i32 (func (result i32))) + (type $0 (func (result i32))) (import "env" "memory" (memory $0 i64 1 1)) (func $foo (result i32) (i32.load offset=13 diff --git a/test/min.wast.fromBinary b/test/min.wast.fromBinary index fd4cb4a8e..9cf86f2a7 100644 --- a/test/min.wast.fromBinary +++ b/test/min.wast.fromBinary @@ -1,8 +1,8 @@ (module - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $f32_=>_f32 (func (param f32) (result f32))) - (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) + (type $2 (func (param i32) (result i32))) + (type $3 (func (param i32 i32 i32) (result i32))) + (type $0 (func (param f32) (result f32))) + (type $1 (func (param i32 i32) (result f32))) (memory $0 256 256) (export "floats" (func $floats)) (func $floats (param $f f32) (result f32) diff --git a/test/mutable-global.wast.fromBinary b/test/mutable-global.wast.fromBinary index 04be75288..1a4730a1e 100644 --- a/test/mutable-global.wast.fromBinary +++ b/test/mutable-global.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_none (func)) + (type $0 (func)) (import "env" "global-mut" (global $global-mut (mut i32))) (func $foo (global.set $global-mut diff --git a/test/polymorphic_stack.wast.fromBinary b/test/polymorphic_stack.wast.fromBinary index 1265bd080..1bbbaff3f 100644 --- a/test/polymorphic_stack.wast.fromBinary +++ b/test/polymorphic_stack.wast.fromBinary @@ -1,7 +1,7 @@ (module (type $none_=>_i32 (func (result i32))) (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) + (type $FUNCSIG$ii (func (param i32) (result i32))) (type $i32_=>_none (func (param i32))) (import "env" "table" (table $timport$0 9 9 funcref)) (func $break-and-binary (result i32) diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary index 02be5171e..283a1efe3 100644 --- a/test/reference-types.wast.fromBinary +++ b/test/reference-types.wast.fromBinary @@ -1,9 +1,9 @@ (module (type $none_=>_anyref (func (result anyref))) - (type $anyref_=>_none (func (param anyref))) - (type $funcref_=>_none (func (param funcref))) + (type $sig_anyref (func (param anyref))) + (type $sig_funcref (func (param funcref))) (type $none_=>_funcref (func (result funcref))) - (type $externref_=>_none (func (param externref))) + (type $sig_externref (func (param externref))) (type $none_=>_externref (func (result externref))) (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) @@ -191,71 +191,71 @@ (call $take_anyref (ref.func $foo) ) - (call_indirect $0 (type $externref_=>_none) + (call_indirect $0 (type $sig_externref) (local.get $local_funcref) (i32.const 0) ) - (call_indirect $0 (type $externref_=>_none) + (call_indirect $0 (type $sig_externref) (global.get $global_externref) (i32.const 0) ) - (call_indirect $0 (type $externref_=>_none) + (call_indirect $0 (type $sig_externref) (ref.null extern) (i32.const 0) ) - (call_indirect $0 (type $funcref_=>_none) + (call_indirect $0 (type $sig_funcref) (local.get $local_externref) (i32.const 1) ) - (call_indirect $0 (type $funcref_=>_none) + (call_indirect $0 (type $sig_funcref) (global.get $global_funcref) (i32.const 1) ) - (call_indirect $0 (type $funcref_=>_none) + (call_indirect $0 (type $sig_funcref) (ref.null func) (i32.const 1) ) - (call_indirect $0 (type $funcref_=>_none) + (call_indirect $0 (type $sig_funcref) (ref.func $foo) (i32.const 1) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (local.get $local_anyref) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (global.get $global_anyref) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (ref.null any) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (local.get $local_funcref) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (global.get $global_externref) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (ref.null extern) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (local.get $local_externref) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (global.get $global_funcref) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (ref.null func) (i32.const 3) ) - (call_indirect $0 (type $anyref_=>_none) + (call_indirect $0 (type $sig_anyref) (ref.func $foo) (i32.const 3) ) diff --git a/test/reg_switch.wast.fromBinary b/test/reg_switch.wast.fromBinary index 3cd9a0793..8cbd99645 100644 --- a/test/reg_switch.wast.fromBinary +++ b/test/reg_switch.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_none (func)) + (type $0 (func)) (memory $0 0) (func $0 (if diff --git a/test/signext.wast.fromBinary b/test/signext.wast.fromBinary index 7b4efa4fe..bb1f2bcf3 100644 --- a/test/signext.wast.fromBinary +++ b/test/signext.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_none (func)) + (type $0 (func)) (func $signext (local $0 i32) (local $1 i64) diff --git a/test/subtypes.wast.fromBinary b/test/subtypes.wast.fromBinary index 44f441f42..d169a4086 100644 --- a/test/subtypes.wast.fromBinary +++ b/test/subtypes.wast.fromBinary @@ -1,30 +1,30 @@ (module - (type ${ref?|i31|} (struct (field (ref null i31)))) - (type $[i32] (array i32)) - (type $ref?|{ref?|i31|}|_ref?|{anyref}|_=>_none (func (param (ref null ${ref?|i31|}) (ref null ${anyref})))) - (type $ref?|{ref?|i31|}|_ref?|{ref?|i31|_anyref}|_=>_none (func (param (ref null ${ref?|i31|}) (ref null ${ref?|i31|_anyref})))) - (type $ref?|[i32]|_ref?|[i32]|_=>_none (func (param (ref null $[i32]) (ref null $[i32])))) - (type $ref?|[ref?|i31|]|_ref?|[anyref]|_=>_none (func (param (ref null $[ref?|i31|]) (ref null $[anyref])))) - (type ${anyref} (struct (field anyref))) - (type ${ref?|i31|_anyref} (struct (field (ref null i31)) (field anyref))) - (type $[anyref] (array anyref)) - (type $[ref?|i31|] (array (ref null i31))) - (func $foo (param $no-null (ref null $[i32])) (param $yes-null (ref null $[i32])) + (type $struct-i31 (struct (field (ref null i31)))) + (type $vector-i32 (array i32)) + (type $ref?|$struct-i31|_ref?|$struct-any|_=>_none (func (param (ref null $struct-i31) (ref null $struct-any)))) + (type $ref?|$struct-i31|_ref?|$struct-i31_any|_=>_none (func (param (ref null $struct-i31) (ref null $struct-i31_any)))) + (type $ref?|$vector-i32|_ref?|$vector-i32|_=>_none (func (param (ref null $vector-i32) (ref null $vector-i32)))) + (type $ref?|$vector-i31|_ref?|$vector-any|_=>_none (func (param (ref null $vector-i31) (ref null $vector-any)))) + (type $struct-any (struct (field anyref))) + (type $struct-i31_any (struct (field (ref null i31)) (field anyref))) + (type $vector-any (array anyref)) + (type $vector-i31 (array (ref null i31))) + (func $foo (param $no-null (ref null $vector-i32)) (param $yes-null (ref null $vector-i32)) (local.set $no-null (local.get $yes-null) ) ) - (func $bar (param $v-i31 (ref null $[ref?|i31|])) (param $v-any (ref null $[anyref])) + (func $bar (param $v-i31 (ref null $vector-i31)) (param $v-any (ref null $vector-any)) (local.set $v-any (local.get $v-i31) ) ) - (func $baz (param $s-i31 (ref null ${ref?|i31|})) (param $s-any (ref null ${anyref})) + (func $baz (param $s-i31 (ref null $struct-i31)) (param $s-any (ref null $struct-any)) (local.set $s-any (local.get $s-i31) ) ) - (func $boo (param $s-i31 (ref null ${ref?|i31|})) (param $s-i31_any (ref null ${ref?|i31|_anyref})) + (func $boo (param $s-i31 (ref null $struct-i31)) (param $s-i31_any (ref null $struct-i31_any)) (local.set $s-i31 (local.get $s-i31_any) ) diff --git a/test/table-import.wast.fromBinary b/test/table-import.wast.fromBinary index 5cf03f48a..d55857a45 100644 --- a/test/table-import.wast.fromBinary +++ b/test/table-import.wast.fromBinary @@ -1,5 +1,5 @@ (module - (type $none_=>_none (func)) + (type $0 (func)) (import "env" "table" (table $timport$0 1 1 funcref)) (elem (i32.const 0) $foo) (memory $0 0) diff --git a/test/tail-call.wast.fromBinary b/test/tail-call.wast.fromBinary index 58fad5d61..81a5c4f9f 100644 --- a/test/tail-call.wast.fromBinary +++ b/test/tail-call.wast.fromBinary @@ -1,12 +1,12 @@ (module - (type $none_=>_none (func)) + (type $void (func)) (table $0 1 1 funcref) (elem (i32.const 0) $foo) (func $foo (return_call $bar) ) (func $bar - (return_call_indirect $0 (type $none_=>_none) + (return_call_indirect $0 (type $void) (i32.const 0) ) ) diff --git a/test/typed-function-references.wast.fromBinary b/test/typed-function-references.wast.fromBinary index fb13b73c4..b6dfd2a5d 100644 --- a/test/typed-function-references.wast.fromBinary +++ b/test/typed-function-references.wast.fromBinary @@ -1,13 +1,13 @@ (module (type $none_=>_none (func)) - (type $none_=>_anyref_f32_anyref_f32 (func (result anyref f32 anyref f32))) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $ref?|i32_->_i32|_=>_i32 (func (param (ref null $i32_=>_i32)) (result i32))) - (type $none_=>_eqref (func (result eqref))) + (type $mixed_results (func (result anyref f32 anyref f32))) + (type $i32-i32 (func (param i32) (result i32))) + (type $ref?|$i32-i32|_=>_i32 (func (param (ref null $i32-i32)) (result i32))) + (type $=>eqref (func (result eqref))) (type $none_=>_i32 (func (result i32))) - (type $none_=>_anyref (func (result anyref))) - (type $none_=>_i32_ref?|none_->_anyref_f32_anyref_f32|_f64 (func (result i32 (ref null $none_=>_anyref_f32_anyref_f32) f64))) - (type $f64_=>_ref?|none_->_eqref| (func (param f64) (result (ref null $none_=>_eqref)))) + (type $=>anyref (func (result anyref))) + (type $none_=>_i32_ref?|$mixed_results|_f64 (func (result i32 (ref null $mixed_results) f64))) + (type $f64_=>_ref_null<_->_eqref> (func (param f64) (result (ref null $=>eqref)))) (func $call-ref (call_ref (ref.func $call-ref) @@ -24,20 +24,20 @@ (ref.func $call-ref-more) ) ) - (func $call_from-param (param $f (ref null $i32_=>_i32)) (result i32) + (func $call_from-param (param $f (ref null $i32-i32)) (result i32) (call_ref (i32.const 42) (local.get $f) ) ) - (func $call_from-param-null (param $f (ref null $i32_=>_i32)) (result i32) + (func $call_from-param-null (param $f (ref null $i32-i32)) (result i32) (call_ref (i32.const 42) (local.get $f) ) ) (func $call_from-local-null (result i32) - (local $f (ref null $i32_=>_i32)) + (local $f (ref null $i32-i32)) (local.set $f (ref.func $call-ref-more) ) @@ -46,21 +46,21 @@ (local.get $f) ) ) - (func $ref-in-sig (param $0 f64) (result (ref null $none_=>_eqref)) - (ref.null $none_=>_eqref) + (func $ref-in-sig (param $0 f64) (result (ref null $=>eqref)) + (ref.null $=>eqref) ) (func $type-only-in-tuple-local (local $x i32) (local $1 f64) - (local $2 (ref null $none_=>_anyref)) + (local $2 (ref null $=>anyref)) (nop) ) (func $type-only-in-tuple-block - (local $0 (i32 (ref null $none_=>_anyref_f32_anyref_f32) f64)) - (local $1 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $0 (i32 (ref null $mixed_results) f64)) + (local $1 (ref null $mixed_results)) (local $2 i32) (local.set $0 - (block $label$1 (result i32 (ref null $none_=>_anyref_f32_anyref_f32) f64) + (block $label$1 (result i32 (ref null $mixed_results) f64) (unreachable) ) ) @@ -72,7 +72,7 @@ ) ) (drop - (block (result (ref null $none_=>_anyref_f32_anyref_f32)) + (block (result (ref null $mixed_results)) (local.set $1 (tuple.extract 1 (local.get $0) |