Skip to content

jit: delete the exc_edge_bridge_enabled gate and the call-site exception prologue it guarded - #1045

Merged
youknowone merged 1 commit into
mainfrom
perf-bridge
Aug 5, 2026
Merged

jit: delete the exc_edge_bridge_enabled gate and the call-site exception prologue it guarded#1045
youknowone merged 1 commit into
mainfrom
perf-bridge

Conversation

@youknowone

Copy link
Copy Markdown
Owner

Follow-up to #1038, which left this behind.

Opening the exception-edge bridge on every backend made exc_edge_bridge_enabled() return a constant true, which made call_jit.rs's if !exc_edge_bridge_enabled() prologue unreachable. That block read the backend exception cells and emitted a snapshot-less GUARD_EXCEPTION through emit_exception_bridge_prologue.

The bridge walker emits the whole SAVE_EXC_CLASS / SAVE_EXCEPTION / RESTORE_EXCEPTION / GUARD_EXCEPTION sequence itself, at the bridge-entry frame state where the guard carries a snapshot. So the dead block goes, and with it the gate and its two routing conjuncts (call_jit.rs's route_exc_edge, bridge_subwalk.rs's exc_edge_precondition).

emit_exception_bridge_prologue stays. It is the _prepare_exception_resumption (pyjitpl.py:3101) + prepare_resume_from_failure (pyjitpl.py:3132) counterpart, and its doc already describes the two-phase split it needs once pyre gains resume-data replay; deleting it would drop an upstream counterpart. Its doc now says it is off the live path and why.

The gate's doc comment carried the diagnosis that closed #1038, so its substance moves to where the read that caused it lives — bridge_subwalk's exc_edge_class, next to the pointer-width read itself. A future backend that skips the exception triple instead of lowering it hits the same wall one step later, so that is recorded there too.

Verification

Rebuilt from re-extracted LLBC at this base: check.py dynasm 378/378, wasm 374/374, cranelift 378/378.

One caveat worth stating: an earlier cranelift run reported fib_recursive at 8.1x against an 8x gate. Re-run on the same binary it measured 6.2x (exec 2.30s → 1.49s, pypy oracle 0.28s → 0.25s). That gate sits close enough to the boundary that a loaded box can trip it; the diff here is a dead-code deletion and cannot reach a recursion benchmark.

authored by Claude

…ion prologue it guarded

The gate returned a constant `true`, so `call_jit.rs`'s
`if !exc_edge_bridge_enabled()` prologue was unreachable: it read the
backend exception cells and emitted a snapshot-less GUARD_EXCEPTION through
`emit_exception_bridge_prologue`. The bridge walker emits the whole
SAVE_EXC_CLASS / SAVE_EXCEPTION / RESTORE_EXCEPTION / GUARD_EXCEPTION
sequence at the bridge-entry frame state, where the guard carries a
snapshot, so the two routing conjuncts and the gate go with it.

`emit_exception_bridge_prologue` stays as the `_prepare_exception_resumption`
+ `prepare_resume_from_failure` counterpart, with its doc noting it is off
the live path and why.

The reason the gate existed is recorded where the read that caused it lives,
in `bridge_subwalk`'s `exc_edge_class`.

check.py cranelift 377/377, dynasm 377/377, wasm 373/373.

Assisted-by: Claude
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@youknowone, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e8dc3fd9-141d-4c12-897f-f90b4b22da0c

📥 Commits

Reviewing files that changed from the base of the PR and between 2f61280 and 84a2161.

📒 Files selected for processing (4)
  • majit/majit-metainterp/src/pyjitpl.rs
  • pyre/pyre-jit-trace/src/jitcode_dispatch/bridge_subwalk.rs
  • pyre/pyre-jit-trace/src/jitcode_dispatch/mod.rs
  • pyre/pyre-jit/src/call_jit.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

🤖 Codex parity review

Static analysis of this diff vs the local RPython/PyPy sources (commit 84a2161).
Updated: 2026-08-05T04:30:18.968Z

Files in the reviewed diff
majit/majit-metainterp/src/pyjitpl.rs
pyre/pyre-jit-trace/src/jitcode_dispatch/bridge_subwalk.rs
pyre/pyre-jit-trace/src/jitcode_dispatch/mod.rs
pyre/pyre-jit/src/call_jit.rs

1. Regressions to PyPy parity introduced by this patch

None.

2. Other mismatches introduced by this patch

None.

3. Pre-existing mismatches (already present before this patch)

  • pyre/pyre-jit/src/call_jit.rs:3450 ↔ rpython/jit/metainterp/pyjitpl.py:3156: “pending exception with no routable live-frame handler” aborts bridge tracing and resumes the blackhole; upstream reconstructs the resumed frame stack, restores exception state, and continues through handle_possible_exception().

  • pyre/pyre-jit/src/call_jit.rs:3391 ↔ rpython/jit/metainterp/pyjitpl.py:2530: a catch in an inlined callee is deliberately declined (“still needs the carrier subwalk”), whereas upstream’s finishframe_exception() walks every reconstructed frame and enters the first matching callee handler. The carrier implementation is also default-off via PYRE_CARRIER_EXC_RESUME.

  • majit/majit-metainterp/src/pyjitpl.rs:12870 ↔ rpython/jit/metainterp/pyjitpl.py:3149: dormant emit_exception_bridge_prologue() records SaveExcClass/SaveException with baked constant operands, while upstream uses zero-argument record0 operations that read the runtime exception state. The new comment correctly says this path is not live, but the dormant implementation remains non-equivalent.

4. Structural adaptations

  • pyre/pyre-jit/src/call_jit.rs:3374 ↔ rpython/jit/metainterp/blackhole.py:400: Pyre locates handlers through CPython-style exception-table lookup; PyPy’s JitCode directly inspects live followed by catch_exception. This is a necessary CPython-compatible compiler/opcode adaptation, not a parity defect.

@youknowone
youknowone merged commit 22c62a7 into main Aug 5, 2026
15 of 17 checks passed
@youknowone
youknowone deleted the perf-bridge branch August 5, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant