Always add a null function at table index zero

This allows function references (a table index internally) to be nullable
This commit is contained in:
dcodeIO
2018-09-17 01:48:35 +02:00
parent 9613d29d93
commit 16d1a833dd
170 changed files with 973 additions and 368 deletions

View File

@ -7,8 +7,8 @@
(global $inlining/constantGlobal i32 (i32.const 1))
(global $~argc (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 36))
(table 1 1 anyfunc)
(elem (i32.const 0) $inlining/test_funcs~anonymous|0)
(table 2 2 anyfunc)
(elem (i32.const 0) $null $inlining/test_funcs~anonymous|1)
(memory $0 1)
(data (i32.const 8) "\0b\00\00\00i\00n\00l\00i\00n\00i\00n\00g\00.\00t\00s\00")
(export "memory" (memory $0))
@ -21,7 +21,7 @@
(i32.const 2)
)
)
(func $inlining/test_funcs~anonymous|0 (; 2 ;) (type $ii) (param $0 i32) (result i32)
(func $inlining/test_funcs~anonymous|1 (; 2 ;) (type $ii) (param $0 i32) (result i32)
(get_local $0)
)
(func $inlining/test_funcs (; 3 ;) (type $v)
@ -290,7 +290,7 @@
(call_indirect (type $ii)
(i32.const 2)
(block $inlining/func_fe|inlined.0 (result i32)
(i32.const 0)
(i32.const 1)
)
)
)
@ -384,4 +384,6 @@
)
(call $inlining/test_funcs)
)
(func $null (; 5 ;) (type $v)
)
)