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,25 +4,25 @@
(type $v (func))
(type $i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(global $function-expression/f1 (mut i32) (i32.const 0))
(global $function-expression/f1 (mut i32) (i32.const 1))
(global $~argc (mut i32) (i32.const 0))
(global $function-expression/f2 (mut i32) (i32.const 1))
(global $function-expression/f3 (mut i32) (i32.const 2))
(global $function-expression/f4 (mut i32) (i32.const 3))
(table 4 4 anyfunc)
(elem (i32.const 0) $start~anonymous|0 $start~anonymous|0 $start~someName|2 $start~anonymous|3)
(global $function-expression/f2 (mut i32) (i32.const 2))
(global $function-expression/f3 (mut i32) (i32.const 3))
(global $function-expression/f4 (mut i32) (i32.const 4))
(table 5 5 anyfunc)
(elem (i32.const 0) $start~someName|3 $start~anonymous|1 $start~anonymous|1 $start~someName|3 $start~anonymous|4)
(memory $0 1)
(data (i32.const 8) "\16\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00e\00x\00p\00r\00e\00s\00s\00i\00o\00n\00.\00t\00s")
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $start~anonymous|0 (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32)
(func $start~anonymous|1 (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32)
(get_local $0)
)
(func $start~someName|2 (; 2 ;) (; has Stack IR ;) (type $v)
(func $start~someName|3 (; 2 ;) (; has Stack IR ;) (type $v)
(nop)
)
(func $start~anonymous|3 (; 3 ;) (; has Stack IR ;) (type $i) (result i32)
(func $start~anonymous|4 (; 3 ;) (; has Stack IR ;) (type $i) (result i32)
(i32.const 1)
)
(func $start (; 4 ;) (; has Stack IR ;) (type $v)