mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-18 01:11:32 +00:00
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:
@ -8,14 +8,14 @@
|
||||
(global $std/gc-integration/a_ref (mut i32) (i32.const 24))
|
||||
(global $std/gc-integration/b_ref (mut i32) (i32.const 32))
|
||||
(global $std/gc-integration/i (mut i32) (i32.const 0))
|
||||
(table 1 1 anyfunc)
|
||||
(elem (i32.const 0) $start~anonymous|0)
|
||||
(table 2 2 anyfunc)
|
||||
(elem (i32.const 0) $null $start~anonymous|1)
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\15\00\00\00s\00t\00d\00/\00g\00c\00-\00i\00n\00t\00e\00g\00r\00a\00t\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 $iv) (param $0 i32)
|
||||
(func $start~anonymous|1 (; 1 ;) (; has Stack IR ;) (type $iv) (param $0 i32)
|
||||
(set_global $std/gc-integration/i
|
||||
(i32.add
|
||||
(get_global $std/gc-integration/i)
|
||||
@ -59,22 +59,25 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~iterateRoots (; 3 ;) (; has Stack IR ;) (type $FUNCSIG$v)
|
||||
(func $null (; 3 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
(func $~iterateRoots (; 4 ;) (; has Stack IR ;) (type $FUNCSIG$v)
|
||||
(call_indirect (type $iv)
|
||||
(i32.const 8)
|
||||
(i32.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(call_indirect (type $iv)
|
||||
(get_global $std/gc-integration/B.d)
|
||||
(i32.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(call_indirect (type $iv)
|
||||
(get_global $std/gc-integration/a_ref)
|
||||
(i32.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(call_indirect (type $iv)
|
||||
(get_global $std/gc-integration/b_ref)
|
||||
(i32.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user