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