Files: 8fc026b2a62edac0dd238380f77dfa98fb0e5b33 / tests / wast / reinternalize.wast
1419 bytesRaw
1 | (module |
2 | (import "func" "internalize" (func $func.internalize (param i32 i32))) |
3 | (import "func" "externalize" (func $func.externalize (param i32) (result i32))) |
4 | (import "func" "set_gas_budget" (func $func.set_gas_budget (param i32 i32) (result i32))) |
5 | (import "test" "check" (func $check (param i32 i32))) |
6 | (import "test" "print" (func $print (param i32))) |
7 | (import "module" "self" (func $self (result i32))) |
8 | (import "module" "export" (func $exports (param i32 i32) (result i32))) |
9 | (import "memory" "externalize" (func $mem.externalize (param i32 i32) (result i32))) |
10 | (memory (export "memory") 1) |
11 | (data (i32.const 0) "callback") |
12 | (table (export "table") 1 1 anyfunc) |
13 | (func $main |
14 | (local $export_name i32) |
15 | (call $func.internalize |
16 | (i32.const 0) |
17 | (call $func.set_gas_budget |
18 | (call $exports |
19 | (call $self) |
20 | (tee_local $export_name |
21 | (call $mem.externalize (i32.const 0) (i32.const 8)))) |
22 | (i32.const 1000))) |
23 | |
24 | ;; reinternalize |
25 | (call $func.internalize |
26 | (i32.const 0) |
27 | (call $func.externalize (i32.const 0))) |
28 | |
29 | (call_indirect (param i64 i32) |
30 | (i64.const 8) |
31 | (get_local $export_name) |
32 | (i32.const 0))) |
33 | |
34 | (func $callback (param i64) (param i32) |
35 | (call $check |
36 | (i32.const 8) |
37 | (i32.wrap/i64 (get_local 0))) |
38 | (call $print (get_local 1))) |
39 | (export "main" (func $main)) |
40 | (export "callback" (func $callback))) |
41 |
Built with git-ssb-web