FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-104584: Fix error handling from backedge optimization by gvanrossum · Pull Request #106484 · python/cpython · GitHub

/ cpython Public

gh-104584: Fix error handling from backedge optimization - #106484

Merged
gvanrossum merged 3 commits into
python:mainfrom
gvanrossum:fix-backedge
Jul 6, 2023
Merged

gh-104584: Fix error handling from backedge optimization#106484
gvanrossum merged 3 commits into
python:mainfrom
gvanrossum:fix-backedge

Conversation

gvanrossum commented Jul 6, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

When _PyOptimizer_BackEdge returns NULL, we should restore next_instr (and stack_pointer). To accomplish this we should jump to resume_with_error instead of just error.

The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b. But the fix is real (as shown there).

While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with dis output.

This fixes a nasty bug in exception handling.
Apparently some part of the computation that determines
where the exception handler is uses next_instr,
which was pointing at the JUMP_BACKWARD instruction instead of
where the error was occurring.

Better fix for _PyOptimizer_BackEdge error handling
Offsets in debug output identifying the start of the trace
are now measured in bytes (and the text shows it).

markshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

One minor issue, otherwise LGTM

Comment thread Python/optimizer.c
gvanrossum enabled auto-merge (squash) July 6, 2023 17:48
gvanrossum merged commit 003ba71 into python:main Jul 6, 2023
gvanrossum deleted the fix-backedge branch July 6, 2023 18:39
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL