-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-144681: Fix JIT trace builder assertion failure when conditional branch jump target coincides with fallthrough target #144742
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
+16
−2
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1373bd1
fix bug
cocolato 4b107f5
📜🤖 Added by blurb_it.
blurb-it[bot] efdba4f
address code review
cocolato 1870e2f
Merge branch 'main' into fix-gh-144681
cocolato c36251c
Merge branch 'main' into fix-gh-144681
cocolato aa8ef2e
Merge branch 'main' into fix-gh-144681
markshannon d84ef06
Merge branch 'main' into fix-gh-144681
cocolato 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
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Core_and_Builtins/2026-02-12-12-39-50.gh-issue-144681.Ns2OT2.rst
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 @@ | ||
| Fix a JIT assertion failure when a conditional branch jumps to the same target as the fallthrough path. |
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -800,7 +800,12 @@ _PyJit_translate_single_bytecode_to_trace( | |||||
| _Py_CODEUNIT *computed_next_instr = computed_next_instr_without_modifiers + (computed_next_instr_without_modifiers->op.code == NOT_TAKEN); | ||||||
| _Py_CODEUNIT *computed_jump_instr = computed_next_instr_without_modifiers + oparg; | ||||||
| assert(next_instr == computed_next_instr || next_instr == computed_jump_instr); | ||||||
| int jump_happened = computed_jump_instr == next_instr; | ||||||
| int jump_happened; | ||||||
| if (computed_next_instr == computed_jump_instr) { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then there is no need to change behavior depending on how long the branch is. |
||||||
| jump_happened = target_instr[1].cache & 1; | ||||||
| } else { | ||||||
| jump_happened = computed_jump_instr == next_instr; | ||||||
| } | ||||||
| assert(jump_happened == (target_instr[1].cache & 1)); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_happened]; | ||||||
| ADD_TO_TRACE(uopcode, 0, 0, INSTR_IP(jump_happened ? computed_next_instr : computed_jump_instr, old_code)); | ||||||
|
|
||||||
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.
The direction of the jump is always recorded.