| 1 |
(module |
| 2 |
(rec |
| 3 |
(type $ft (;0;) (func (param (ref null $ct)))) |
| 4 |
(type $ct (;1;) (cont $ft)) |
| 5 |
) |
| 6 |
(type (;2;) (func (param i32))) |
| 7 |
(type (;3;) (func)) |
| 8 |
(type (;4;) (func (result i32))) |
| 9 |
(import "spectest" "print_i32" (func $print-i32 (;0;) (type 2))) |
| 10 |
(tag $swap (;0;) (type 3)) |
| 11 |
(global $fi (;0;) (mut i32) i32.const 0) |
| 12 |
(global $gi (;1;) (mut i32) i32.const 1) |
| 13 |
(export "init" (func $init)) |
| 14 |
(elem (;0;) declare func $f $g) |
| 15 |
(func $init (;1;) (type 4) (result i32) |
| 16 |
ref.func $g |
| 17 |
cont.new $ct |
| 18 |
ref.func $f |
| 19 |
cont.new $ct |
| 20 |
resume $ct (on $swap switch) |
| 21 |
i32.const 42 |
| 22 |
return |
| 23 |
) |
| 24 |
(func $f (;2;) (type $ft) (param $nextk (ref null $ct)) |
| 25 |
(local (ref null $ct)) |
| 26 |
local.get $nextk |
| 27 |
local.set 1 |
| 28 |
global.get $fi |
| 29 |
call $print-i32 |
| 30 |
local.get 1 |
| 31 |
switch $ct $swap |
| 32 |
local.set 1 |
| 33 |
global.get $fi |
| 34 |
call $print-i32 |
| 35 |
local.get 1 |
| 36 |
switch $ct $swap |
| 37 |
drop |
| 38 |
) |
| 39 |
(func $g (;3;) (type $ft) (param $nextk (ref null $ct)) |
| 40 |
(local (ref null $ct)) |
| 41 |
local.get $nextk |
| 42 |
local.set 1 |
| 43 |
global.get $gi |
| 44 |
call $print-i32 |
| 45 |
local.get 1 |
| 46 |
switch $ct $swap |
| 47 |
local.set 1 |
| 48 |
global.get $gi |
| 49 |
call $print-i32 |
| 50 |
) |
| 51 |
) |