(module $example (type $func (;0;) (func)) (type $cont (;1;) (cont $func)) (type $cont-func (;2;) (func (param (ref $cont)))) (type $cont-cont (;3;) (cont $cont-func)) (type $func-cont-func-func (;4;) (func (param (ref $func) (ref $cont-func)))) (type $func-cont-func-cont (;5;) (cont $func-cont-func-func)) (type (;6;) (func (param i32))) (import "spectest" "print_i32" (func $log (;0;) (type 6))) (export "main" (func $main)) (elem (;0;) declare func $main $thread1 $thread2 $thread3) (func $main (;1;) (type $func-cont-func-func) (param $yield (ref $func)) (param $fork (ref $cont-func)) i32.const 0 call $log local.get $yield local.get $fork ref.func $thread1 cont.new $func-cont-func-cont cont.bind $func-cont-func-cont $cont local.get $fork call_ref $cont-func i32.const 1 call $log local.get $yield local.get $fork ref.func $thread2 cont.new $func-cont-func-cont cont.bind $func-cont-func-cont $cont local.get $fork call_ref $cont-func i32.const 2 call $log local.get $yield local.get $fork ref.func $thread3 cont.new $func-cont-func-cont cont.bind $func-cont-func-cont $cont local.get $fork call_ref $cont-func i32.const 3 call $log ) (func $thread1 (;2;) (type $func-cont-func-func) (param $yield (ref $func)) (param $fork (ref $cont-func)) i32.const 10 call $log local.get $yield call_ref $func i32.const 11 call $log local.get $yield call_ref $func i32.const 12 call $log ) (func $thread2 (;3;) (type $func-cont-func-func) (param $yield (ref $func)) (param $fork (ref $cont-func)) i32.const 20 call $log local.get $yield call_ref $func i32.const 21 call $log local.get $yield call_ref $func i32.const 22 call $log ) (func $thread3 (;4;) (type $func-cont-func-func) (param $yield (ref $func)) (param $fork (ref $cont-func)) i32.const 30 call $log local.get $yield call_ref $func i32.const 31 call $log local.get $yield call_ref $func i32.const 32 call $log ) )