-
Notifications
You must be signed in to change notification settings - Fork 19
jit: coerce a closing JUMP to the label arity only when it targets that label #1127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/retrace_outer_loop_type_flip.cranelift.jitstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bridges_compiled=0 | ||
| descr_set_absent=0 | ||
| descr_set_ambiguous=0 | ||
| descr_set_stale_absent=0 | ||
| fbw_blackhole_adopted_multi_frame=0 | ||
| fbw_blackhole_adopted_single_frame=0 | ||
| fbw_rolled_back_with_effects=0 | ||
| fbw_store_journal_rollback_failed=0 | ||
| field_pos_attached_misplaced=0 | ||
| field_pos_spec_misplaced=0 | ||
| guard_failures=590 | ||
| internal_compile_panics=0 | ||
| loops_aborted=2 | ||
| loops_compiled=1 | ||
| retraces_compiled=0 |
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/retrace_outer_loop_type_flip.dynasm.jitstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bridges_compiled=0 | ||
| descr_set_absent=0 | ||
| descr_set_ambiguous=0 | ||
| descr_set_stale_absent=0 | ||
| fbw_blackhole_adopted_multi_frame=0 | ||
| fbw_blackhole_adopted_single_frame=0 | ||
| fbw_rolled_back_with_effects=0 | ||
| fbw_store_journal_rollback_failed=0 | ||
| field_pos_attached_misplaced=0 | ||
| field_pos_spec_misplaced=0 | ||
| guard_failures=590 | ||
| internal_compile_panics=0 | ||
| loops_aborted=2 | ||
| loops_compiled=1 | ||
| retraces_compiled=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # The nested-loop twin of `retrace_accumulator_type_flip`: the accumulator flips | ||
| # int -> float in the OUTER loop, so the retrace grown for it does not close onto | ||
| # a token of its own compilation but onto the one the inner loop left behind. | ||
| # | ||
| # pyre DECLINES that close today, and the recorded `loops_aborted=2` with | ||
| # `retraces_compiled=0` is what says so: `jump_to_existing_trace` finds the match, | ||
| # and the unroll pass then discards it because the JUMP names an external target | ||
| # token, falling back to `jump_to_preamble` (unroll.py:228). pypy takes it, and | ||
| # emits the two `new_with_vtable`s plus a `jump(..., descr=TargetToken(<loop>))`. | ||
| # | ||
| # Measured 2026-08-09, admitting the close on dynasm — the backend that relocates | ||
| # every LABEL and refuses a JUMP below the first page, so the branch does name a | ||
| # real address — SIGSEGVs `exception_escape_inlined_midframe_tb_node` and adds a | ||
| # bridge plus ~200 guard failures each to `global_reassign`, | ||
| # `mapdict_unboxed_type_change_attr`, `math_isqrt_compare_bridge_resume` and | ||
| # `method_reassign_after_warmup`. Naming a live address is therefore not the whole | ||
| # precondition. This fixture is the acceptance test for whatever closes that gap: | ||
| # `loops_aborted` goes to 0 and `retraces_compiled` to 1 when it does. | ||
| # | ||
| # `pypyjit` is absent on the CPython oracle and present on PyPy and pyre, and | ||
| # `retrace_limit` defaults to 0 (`rpython/rlib/jit.py:595`), so no retrace is | ||
| # attempted at all without raising it. Guarding the import keeps the printed value | ||
| # identical across all three. `set_param` rather than an environment variable | ||
| # because the wasm guest sees no environment. | ||
| try: | ||
| import pypyjit | ||
|
|
||
| pypyjit.set_param("retrace_limit=5") | ||
| except ImportError: | ||
| pass | ||
|
|
||
|
|
||
| def f(n, m): | ||
| s = 0 | ||
| o = 0 | ||
| while o < n: | ||
| j = 0 | ||
| while j < m: | ||
| j += 1 | ||
| if o > 200: | ||
| s = s + 0.5 | ||
| else: | ||
| s = s + 1 | ||
| o += 1 | ||
| return s | ||
|
|
||
|
|
||
| print(f(600, 100)) |
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/retrace_outer_loop_type_flip.wasm.jitstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bridges_compiled=0 | ||
| descr_set_absent=0 | ||
| descr_set_ambiguous=0 | ||
| descr_set_stale_absent=0 | ||
| fbw_blackhole_adopted_multi_frame=0 | ||
| fbw_blackhole_adopted_single_frame=0 | ||
| fbw_rolled_back_with_effects=0 | ||
| fbw_store_journal_rollback_failed=0 | ||
| field_pos_attached_misplaced=0 | ||
| field_pos_spec_misplaced=0 | ||
| guard_failures=590 | ||
| internal_compile_panics=0 | ||
| loops_aborted=2 | ||
| loops_compiled=1 | ||
| retraces_compiled=0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When external closes are admitted—the stated use case for this change—distinct
TargetTokens can share the same numerictoken_idbecause it is only local to aJitCellToken;history.rsexplicitly says backend identity is the descriptor'sArcaddress. ComparingDescr::index()therefore misclassifies an external target with the same local number as this label, causing the new branch to truncate or pad its arguments and recreating the cross-token arity corruption. Compare the descriptorArcs withArc::ptr_eq/descr_identityinstead, and make the regression test use distinct descriptors with the same index.AGENTS.md reference: AGENTS.md:L231-L233
Useful? React with 👍 / 👎.