Skip to content
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-113710: Backedge counter improvements. #115166

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Feb 8, 2024

The PR clarifies the handling of counters and triggering of the optimizer in JUMP_BACKWARD.

This PR:

  • Clarifies the manual 2s complement conversion.
  • Avoids relying on truncation to 16 bits
  • Does the shifting and offset calculation when setting the optimizer, rather than on every back edge.
  • Hides the handling of the NULL/default optimizer.

Python/pystate.c Outdated Show resolved Hide resolved
Co-authored-by: Erlend E. Aasland <[email protected]>
@markshannon markshannon merged commit f9f6156 into python:main Feb 13, 2024
49 checks passed
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
@gvanrossum
Copy link
Member

@markshannon FWIW, even after this PR I find it hard to follow how the Tier 2 optimization backoff counters are managed. The bit fiddling is exceedingly complicated. Maybe we should have some macros for these, like we do for specialization counters.

@markshannon markshannon deleted the clarify-backedge-counter branch August 6, 2024 10:17
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