v8/third_party/wasm-api/example/hostref.wat
Jakob Kummerow 2d17bf79d5 [wasm-c-api] Roll 3094fe2: Implement Global::get/set for refs
Change-Id: Ibab34553f1499bd5dee7cf7477284783cc0660fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1763534
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63318}
2019-08-21 15:54:59 +00:00

25 lines
654 B
Plaintext

(module
(import "" "f" (func $fun (param anyref) (result anyref)))
(global $glob (export "global") (mut anyref) (ref.null))
(table $tab (export "table") 10 anyref)
(func (export "global.set") (param $r anyref)
(global.set $glob (local.get $r))
)
(func (export "global.get") (result anyref)
(global.get $glob)
)
(func (export "table.set") (param $i i32) (param $r anyref)
(table.set $tab (local.get $i) (local.get $r))
)
(func (export "table.get") (param $i i32) (result anyref)
(table.get $tab (local.get $i))
)
(func (export "func.call") (param $r anyref) (result anyref)
(call $fun (local.get $r))
)
)