-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-140104: Set next_instr properly in the JIT during exceptions #140233
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
gh-140104: Set next_instr properly in the JIT during exceptions #140233
Conversation
Co-Authored-By: devdanzin <74280297+devdanzin@users.noreply.github.com>
|
This PR fixes all correctness bugs found by the fuzzer so far, thank you! |
|
Tailcall CI is broken for x86_64-pc-windows-msvc and aarch64-pc-windows-msvc. Updating Unfortunately, I cannot test aarch64. Hopefully, this fixes it as well. Would have liked to fail it during compiling like x86_64, not at runtime, though? |
Co-Authored-By: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
|
|
Python/ceval_macros.h
Outdated
| next_instr = frame->instr_ptr; \ | ||
| /* gh-140104: The exception handler expects frame->instr_ptr | ||
| to be pointing to next_instr, not this_instr! */ \ | ||
| next_instr = frame->instr_ptr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[frame->instr_ptr->op.code]]; \ |
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.
| next_instr = frame->instr_ptr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[frame->instr_ptr->op.code]]; \ | |
| next_instr = frame->instr_ptr + 1; |
Just +1 to compensate for the the -1 in label(exception_unwind)
Pointing to the next instruction does work, but it is unnecessary. As long as next_inst -1 points into the current instruction, unwinding works correctly.
|
When you're done making the requested changes, leave the comment: |
|
The code looks good now. |
markshannon
left a comment
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.
Thanks
|
Thanks @Fidget-Spinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Sorry, @Fidget-Spinner, I could not cleanly backport this to |
|
GH-140687 is a backport of this pull request to the 3.14 branch. |
…pythonGH-140233) Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com> Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
|
…ring exceptions (pythonGH-140233) (pythonGH-140687)" This reverts commit 2e21672.
|
GH-141495 is a backport of this pull request to the 3.14 branch. |
Fixes #140104
UnboundLocalErrorfor same code with JIT on or off #140104