KOS_OP_POP_WITH
Style: NOARG (argument unused in current
opcodes.incl).Behaviour: Store the body value on the node; call exit (no-exception form); auto-await if needed; pop the owned segment; pop dyn node; push the stored body value. When exit returns an awaitable: step via
kos_with_exit_start_await; on sync completion (r==0) callkos_complete_pending_with_exitto consume the exit result and push the body value; on suspend returnsEVAL_AWAIT(awaitable); on resume, revive callskos_complete_pending_with_exitso the with-expression value is the body’s (exit return is never left on stack). On exception unwind (via no-region path or dyn_pop_top_with): call exit(exc_info); if swallow then clear exception, pop block, pop node, pushNone, set frame PC toKosDynWith_RESUME_PC(node)(the instruction after POP_WITH), resume; else pop block, pop node, re-raise.Invariants: Top of chain must be KOS_DYN_WITH. With-expression value is the body’s value, or
Nonewhen exit swallowed an exception; exit return is used only for swallow logic and is never the value seen by RETURN.