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-137573: Check C stack depth before stack allocating JIT optimizer struct#137676

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

Closed

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commentedAug 12, 2025
edited by bedevere-appbot
Loading

@Fidget-Spinner
Copy link
Member

Just so I'm clear: you plan to move this to the thread state later but only on main right? So that we don't change the struct layout in an rc for 3.14?

markshannonand others added2 commitsAugust 13, 2025 11:44
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@Fidget-Spinner
Copy link
Member

Can you please add aPy_NO_INLINE to the_PyOptimizer_Optimize function too? I don't think this will fix it as if it's inlined, the alloca might be hoisted out to the main interpreter loop by the compiler.

@markshannon
Copy link
MemberAuthor

Can you please add aPy_NO_INLINE to the_PyOptimizer_Optimize function too? I don't think this will fix it as if it's inlined, the alloca might be hoisted out to the main interpreter loop by the compiler.

Yes, but not in this PR as it seems unrelated

Fidget-Spinner reacted with thumbs up emoji

@markshannon
Copy link
MemberAuthor

Just so I'm clear: you plan to move this to the thread state later but only on main right? So that we don't change the struct layout in an rc for 3.14?

Yes, that's the plan.

@markshannonmarkshannon added the needs backport to 3.14bugs and security fixes labelAug 13, 2025
OPT_STAT_INC(optimizer_attempts);
/* Make sure we have enough C stack space for the optimizer */
intmargin=1+sizeof(JitOptContext)/_PyOS_STACK_MARGIN_BYTES;
if (_Py_ReachedRecursionLimitWithMargin(_PyThreadState_GET(),margin)) {

Choose a reason for hiding this comment

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

To work properly, theoptimize_uops function or this function must be markedPy_NO_INLINE as well.

Otherwise, the compiler can just inline the functions and hoist the alloca above the check, making the check useless.

@markshannon
Copy link
MemberAuthor

We've already started moving the buffers to the heap, so this won't be needed.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@AA-TurnerAA-TurnerAA-Turner left review comments

@Fidget-SpinnerFidget-SpinnerFidget-Spinner left review comments

@tomasr8tomasr8Awaiting requested review from tomasr8tomasr8 is a code owner

Assignees

@Fidget-SpinnerFidget-Spinner

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@markshannon@Fidget-Spinner@AA-Turner

[8]ページ先頭

©2009-2025 Movatter.jp