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

@ -4,9 +4,9 @@
(type $v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(global $~argc (mut i32) (i32.const 0))
(global $call-optional/optIndirect (mut i32) (i32.const 0))
(table 1 1 anyfunc)
(elem (i32.const 0) $call-optional/opt|trampoline)
(global $call-optional/optIndirect (mut i32) (i32.const 1))
(table 2 2 anyfunc)
(elem (i32.const 0) $null $call-optional/opt|trampoline)
(memory $0 1)
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00o\00p\00t\00i\00o\00n\00a\00l\00.\00t\00s")
(export "memory" (memory $0))
@ -177,4 +177,7 @@
)
)
)
(func $null (; 4 ;) (; has Stack IR ;) (type $v)
(nop)
)
)