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-119866: Don't clearframe->stackpointer on release builds#131750

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
brandtbucher merged 2 commits intopython:mainfrombrandtbucher:null-stack-pointer
Mar 26, 2025

Conversation

brandtbucher
Copy link
Member

@brandtbucherbrandtbucher commentedMar 26, 2025
edited by bedevere-appbot
Loading

This is only useful for asserts to make sure that we're spilling and restoring the stack pointer in all the right places. Removing these frequent stores makes the interpreter0.7% faster and the JIT0.4% faster.

@brandtbucherbrandtbucher added performancePerformance or resource usage skip news interpreter-core(Objects, Python, Grammar, and Parser dirs) labelsMar 26, 2025
@brandtbucherbrandtbucher self-assigned thisMar 26, 2025
@@ -171,7 +171,9 @@ _PyFrame_GetStackPointer(_PyInterpreterFrame *frame)
{
assert(frame->stackpointer != NULL);
_PyStackRef *sp = frame->stackpointer;
#ifndef NDEBUG
Copy link
Member

@chris-eiblchris-eiblMar 26, 2025
edited
Loading

Choose a reason for hiding this comment

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

Maybe then update the comment

Havingstackpointer== NULLensuresthatinvalidvaluesarenotvisibletothecycleGC.

Seems that this was done for the cycle GC - if this is no longer needed, just remove the comment?

Out of curiousity: is it safe in release builds to let the cycle GC see invalid values?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We want to have "deferred" references on the stack, which means that the GC must be able to seeall stack values, andonly valid stack values.

Setting the stack pointer toNULL is only useful for our asserts, which are sprinkled throughout to make sure that we're spilling and restoring in the correct places. Basically, the GC should never see an invalid stack pointer. On debug builds, we make this easier to detect by setting invalid stack pointers toNULL and checking for this.

Either way, I'll update the comment.

chris-eibl reacted with heart emoji
@brandtbucherbrandtbucherenabled auto-merge (squash)March 26, 2025 18:33
@brandtbucherbrandtbucher merged commit4b3d5b6 intopython:mainMar 26, 2025
41 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@chris-eiblchris-eiblchris-eibl left review comments

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

@markshannonmarkshannonAwaiting requested review from markshannon

Assignees

@brandtbucherbrandtbucher

Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usageskip news
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@brandtbucher@Fidget-Spinner@chris-eibl

[8]ページ先頭

©2009-2025 Movatter.jp