Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

GH-139922: Tail calling for MSVC (VS 2026)#143068

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Fidget-Spinner merged 11 commits intopython:mainfromchris-eibl:msvc-tail-call-new
Dec 22, 2025

Conversation

@chris-eibl
Copy link
Member

@chris-eiblchris-eibl commentedDec 22, 2025
edited by bedevere-appbot
Loading

So much has happened on main that I started fresh over and sqash merged the needed things from#139962 onto latest main (mostly because I wanted to use it for my own experiments on main again).

Based on@markshannon's work in#142228 I've factored out_Py_VectorCallInstrumentation_StackRefSteal, because then@Fidget-Spinner's#138115 is not needed in this PR and can be done in a follow-up. An alternative would be to keep it and pasststate into thePy_*_StackRefSteal functions.

@Fidget-Spinner
Copy link
Member

In the future, please communicate if you want to supercede a PR for other contributors. It's often considered not good etiquette to take over another person's PR unless they explicitly allow it. However, I'm more than happy to let you take over the PR in this case.

chris-eibl reacted with thumbs up emoji

// MSVC fails during a tail call release build with loads of
// error C4737: Unable to perform required tail call.
// without using Py_NO_INLINE here, but PGO works fine.
#if defined(_MSC_VER) && !defined(__clang__) && _Py_TAIL_CALL_INTERP && !defined(_Py_USING_PGO)
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It needed lots of trial and error to come up with this unintuive minimal change needed to convince MSVC that the local variable passed by reference intoresult here does not escape the tail call.

Using it as an return value inPyMapping_GetOptionalItem2 is more explicit, but might have other drawbacks?

@chris-eibl
Copy link
MemberAuthor

In the future, please communicate if you want to supercede a PR for other contributors. It's often considered not good etiquette to take over another person's PR unless they explicitly allow it. However, I'm more than happy to let you take over the PR in this case.

Sorry, wasn't ment as superseding, more as a follow up and maybe just a draft for new discussions. Thought about you're gonna take whatever deems appropriate back into your original PR ...

If this here is going to fly, I'd like to include you and Brandt as authors for the commits, but don't know how atm ...

@hugovk
Copy link
Member

If this here is going to fly, I'd like to include you and Brandt as authors for the commits, but don't know how atm ...

Co-authored-by is the way:

https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors

chris-eibl reacted with heart emoji

@Fidget-Spinner
Copy link
Member

If this here is going to fly, I'd like to include you and Brandt as authors for the commits, but don't know how atm ...

Oh I'm happy to be superseded. If you'd like to attribute commit history though, you can just push a trivial commit with the co-author info like Hugo pointed out, and when I squash and merge I'll use that.

chris-eibl reacted with thumbs up emoji

Co-Authored-By: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>Co-Authored-By: Brandt Bucher <brandt@python.org>
@Fidget-Spinner
Copy link
Member

Try pullingmain in, I fixed a JIT bug there that should turn the JIT CI green again.

@chris-eibl
Copy link
MemberAuthor

Co-authored-by is the way:

Done

chris-eibland others added2 commitsDecember 22, 2025 17:44
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
I could not add this one to batch, so have to do it separatelyCo-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@chris-eibl
Copy link
MemberAuthor

https://github.com/python/cpython/actions/runs/20437258430/job/58722460806 failed inbetween
test_extractall_none_gid (test.test_tarfile.NoneInfoExtractTests_Tar.test_extractall_none_gid) ... Windows fatal exception: access violation
(but got green when rerunning the failed test) even though pulling in main.

I've found this:#143073

Hopefully, this will fix it ...

try to fix "Native Windows MSVC (release)"
@Fidget-Spinner
Copy link
Member

Fidget-Spinner commentedDec 22, 2025
edited
Loading

Just ignore the JIT problems for now. The new JIT executor management has a known bug#143026

chris-eibl reacted with thumbs up emoji

@Fidget-SpinnerFidget-Spinner added the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelDec 22, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@Fidget-Spinner for commitda1adaf 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F143068%2Fmerge

If you want to schedule another build, you need to add the🔨 test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelDec 22, 2025
@Fidget-Spinner
Copy link
Member

Fidget-Spinner commentedDec 22, 2025
edited
Loading

Copy link
Member

@Fidget-SpinnerFidget-Spinner left a comment

Choose a reason for hiding this comment

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

Once again:

  • This PR is the successor of one that has been up for 2 months already#139962 . We've had enough discussion there to get a sensing of what we want.
  • Refleak tests are green, performance results are within noise for the default (computed goto) interpreter.
  • This PR adds CI for the new configuration, which is also green.
  • I have discussed this feature with the other core devs a few months back on our bi-weekly perf meetings. Everyone was in agreement that adding scopes to MSVC is fine as it isn't that invasive.
  • This PR is the minimal changeset required to get TC working on MSVC.
  • It uses the techniques suggested by Mark in the other PR (just adding scopes and commenting on them). So I expect he should be okay with the overall design I hope. I understand he might disagree on some of the smaller changes.
  • It LGTM, from my review of the changes.

Therefore, I'm merging this PR.

Any follow-ups can be done on future PRs. Any discussion about the design can be done on the issue itself.

chris-eibl reacted with thumbs up emojistonebig reacted with heart emoji
@Fidget-SpinnerFidget-Spinner merged commitbe3c131 intopython:mainDec 22, 2025
94 of 95 checks passed
@chris-eiblchris-eibl deleted the msvc-tail-call-new branchDecember 26, 2025 17:45
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@hugovkhugovkhugovk left review comments

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@ezio-melottiezio-melottiAwaiting requested review from ezio-melottiezio-melotti is a code owner

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@chris-eibl@Fidget-Spinner@hugovk@bedevere-bot

[8]ページ先頭

©2009-2026 Movatter.jp