Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-115999: Don't take a reason in unspecialize#127030

Merged
mpage merged 2 commits intopython:mainpython/cpython:mainfrom
mpage:gh-115999-dont-pass-reason-to-unspecializempage/cpython:gh-115999-dont-pass-reason-to-unspecializeCopy head branch name to clipboard
Nov 20, 2024
Merged

gh-115999: Don't take a reason in unspecialize#127030
mpage merged 2 commits intopython:mainpython/cpython:mainfrom
mpage:gh-115999-dont-pass-reason-to-unspecializempage/cpython:gh-115999-dont-pass-reason-to-unspecializeCopy head branch name to clipboard

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
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.