Skip to content

JIT: implement OSR exits, deoptimization, and precise GC #432

Description

@chrisbbreuer

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions