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-115999: Don't take a reason in unspecialize #127030

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

mpage
Copy link
Contributor

@mpage mpage commented Nov 19, 2024

We only want to compute the reason if stats are enabled. Optimizing compilers should optimize this away for us (gcc and clang do), but it's better to be safe than sorry.

We only want to compute the reason if stats are enabled. Optimizing
compilers should optimize this away for us (gcc and clang do), but
it's better to be safe than sorry.
Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

lgtm, because it just move back to previous version.

Sharing my one of idea is (I didn't take a look deeply if it is possible or not):

  • providing two version of xxxx_op_fail_kind function based Py_STATS and if Py_STATS is disabled, just return dummy value like -1,
  • Inside unspecialize(_Py_CODEUNIT *instr, int reason), if the reason is just dummy value than calculate nothing.

@mpage mpage merged commit 32428cf into python:main Nov 20, 2024
37 checks passed
@mpage mpage deleted the gh-115999-dont-pass-reason-to-unspecialize branch November 20, 2024 22:54
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
Don't take a reason in unspecialize

We only want to compute the reason if stats are enabled. Optimizing
compilers should optimize this away for us (gcc and clang do), but
it's better to be safe than sorry.
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.

2 participants