- i32.eq ;; don't check if "await-exit" is true
- br_if $check_awaiter
- get_local $eax
- i32.load8_u
- i32.const 2
- i32.and
- i32.eqz ;; (FLAGS & 2) => awaiter, run it
- br_if $check_awaiter
- get_local $eax
- i32.const 2
- i32.add
- i32.load8_u
+ i32.eq ;; halt if awaiting
+ br_if $await_exit
+ block $no_awaiter
+ get_local $eax
+ i32.load8_u
+ i32.const 2
+ i32.and
+ i32.eqz ;; (FLAGS & 2) => awaiter, run it
+ br_if $no_awaiter
+ get_local $eax
+ i32.const 2
+ i32.add
+ i32.load8_u
+ tee_local $eax
+ call $push
+ get_global $channel_table_p
+ get_global $channel_entry_size
+ get_local $eax
+ i32.mul
+ i32.add
+ tee_local $eax
+ get_local $eax
+ i32.load8_u
+ i32.const 254
+ i32.and
+ i32.store8 ;; toggle off runflag
+ call $pop
+ call $main
+ get_local $channel_in
+ call $close_channel
+ return
+ end