Parent: #146 Blocks: #429 Depends on: #431 (completed) Related: #132, #133 Children: #435, #436, #437, #438, #439 (completed)
Make guarded optimized execution resumable and precisely collectable. Side exits must reconstruct exact bytecode state; exceptions, traps, and GC safepoints must not lose or invent observable work.
Acceptance
- Define OSR entry eligibility and immutable frame-state metadata at every guard, call, exception edge, and safepoint.
- Reconstruct locals, operand stack, accumulator, handlers, and exact step/IP state on deoptimization.
- Emit precise stack maps for movable GC values and validate relocation while optimized frames are live.
- Preserve catch/finally edges, termination, watchdog, debugger, and interpreter/baseline fallback behavior.
- Support invalidation-at-poll resume without executing stale optimized facts past the invalidation point.
- Pass focused deopt/OSR/exception/GC tests, normal/no-GIL differential runs, and relevant sanitizer gates.
Landed checkpoints
- #435: exact loop OSR entry, cycle-safe backedge copies, multi-iteration execution, budget/checkpoint accounting, and generation invalidation resume.
- #436: exact handler-aware recovery for throws, abrupt completions, all call/construct shapes, and interpreter-owned effects.
- #437: complete at
057a2ef/ae26011with deopt-indexed frame/scratch maps, fail-closed active-native publication, live moving compaction, and normal/no-GIL/TSan relocation evidence. - #438: complete through
48bfe60/b80e81f/3d78eafwith general reducible regions, fused nested loops, exact internal block checks, edge-owned copies, and per-header moving safepoints; irreducible two-entry control rejects before publication. - #439: complete through
628b262/b6d1b62with executable runtime effects and five-way native finally dispatch, exact nested propagation, fail-closed malformed completion handling, and focused/broad TSan evidence.
Completion checkpoint
Exact reconstruction, live moving-GC integration, runtime effects, and completion dispatch are complete. Recovery-only object locals avoid Number guards, occupy marked loop scratch slots, move during real optimized execution, and resume deterministically in single-mutator and no-GIL TSan gates. Native finally dispatch preserves exact state and consumes normal, throw, return, break, and continue completions once, including remaining outer catch/finally handlers.
The final #439 batch passes 7/7 focused full-root native-finally tests and the broad JIT gate at 164/164 under TSan, with zero failures, skips, or leaks. Exact cooperative-stop, expired-watchdog, and shell-timeout delivery after optimizer checkpoint exits is covered through 89fc073. Backend and broad differential completion remains #434.