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

@ -15,8 +15,8 @@
(global $~argc (mut i32) (i32.const 0))
(global $std/gc-object/obj (mut i32) (i32.const 0))
(global $~started (mut i32) (i32.const 0))
(table 3 3 anyfunc)
(elem (i32.const 0) $~lib/collector/itcm/__gc_mark $std/gc-object/Custom~gc $std/gc-object/Base~gc)
(table 4 4 anyfunc)
(elem (i32.const 0) $null $~lib/collector/itcm/__gc_mark $std/gc-object/Custom~gc $std/gc-object/Base~gc)
(memory $0 0)
(export "memory" (memory $0))
(export "table" (table $0))
@ -434,7 +434,7 @@
(i32.const 24)
)
)
(i32.const 1)
(i32.const 2)
)
(call $~lib/collector/itcm/ManagedObject#set:color
(get_local $0)
@ -469,7 +469,7 @@
)
(call_indirect (type $iv)
(get_local $0)
(i32.const 2)
(i32.const 3)
)
(call $~lib/collector/itcm/__gc_mark
(i32.load
@ -567,10 +567,13 @@
)
(call $~lib/gc/gc.collect)
)
(func $~iterateRoots (; 19 ;) (; has Stack IR ;) (type $FUNCSIG$v)
(func $null (; 19 ;) (; has Stack IR ;) (type $v)
(nop)
)
(func $~iterateRoots (; 20 ;) (; has Stack IR ;) (type $FUNCSIG$v)
(call_indirect (type $iv)
(get_global $std/gc-object/obj)
(i32.const 0)
(i32.const 1)
)
)
)