Files: 885e05bd77e55f9846f83ccd30e285c5566e6f38 / tests / wast / link.wast
1642 bytesRaw
1 | (module |
2 | (import "memory" "externalize" (func $mem.externalize (param i32 i32) (result i32))) |
3 | (import "storage" "get" (func $storage.get (result i32))) |
4 | (import "storage" "set" (func $storage.set (param i32))) |
5 | (import "elem" "externalize" (func $elem.externalize (param i32 i32) (result i32))) |
6 | (import "elem" "internalize" (func $elem.internalize (param i32 i32 i32 i32))) |
7 | (import "elem" "length" (func $elem.length (param i32) (result i32))) |
8 | (import "func" "internalize" (func $func.internalize (param i32 i32))) |
9 | (import "link" "wrap" (func $link.wrap (param i32) (result i32))) |
10 | (import "link" "unwrap" (func $link.unwrap (param i32 i32))) |
11 | |
12 | (memory (export "memory") 1) |
13 | (data (i32.const 0) "hello world") |
14 | (table (export "table") 1 1 anyfunc) |
15 | (elem (i32.const 0) $callback) |
16 | (global $egressRef (mut i32) (i32.const 0)) |
17 | |
18 | (func $main |
19 | (i32.store |
20 | (i32.const 0) |
21 | (call $link.wrap |
22 | (call $mem.externalize (i32.const 0) (i32.const 11)))) |
23 | |
24 | (call $storage.set |
25 | (call $elem.externalize (i32.const 0) (i32.const 1)))) |
26 | |
27 | (func $load (param $egress i32) |
28 | (set_global $egressRef (get_local $egress)) |
29 | |
30 | (call $elem.internalize |
31 | (i32.const 0) |
32 | (call $elem.length (call $storage.get)) |
33 | (call $storage.get) |
34 | (i32.const 0)) |
35 | |
36 | (call $link.unwrap |
37 | (i32.load (i32.const 0)) |
38 | (i32.const 0))) |
39 | |
40 | (func $callback (param $ref i32) |
41 | (call $func.internalize |
42 | (i32.const 0) |
43 | (get_global $egressRef)) |
44 | |
45 | (call_indirect (param i32) |
46 | (get_local $ref) |
47 | (i32.const 0)) |
48 | ) |
49 | |
50 | (export "main" (func $main)) |
51 | (export "load" (func $load))) |
52 |
Built with git-ssb-web