gh-140104: Set next_instr properly in the JIT during exceptions#140233
gh-140104: Set next_instr properly in the JIT during exceptions#140233Fidget-Spinner merged 8 commits intopython:mainfrom
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.
| 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. |
|
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. |
…pythonGH-140233) Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com> Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Fixes #140104
UnboundLocalErrorfor same code with JIT on or off #140104