Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Fidget-Spinner commentedAug 12, 2025
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? |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Fidget-Spinner commentedAug 13, 2025
Can you please add a |
markshannon commentedAug 13, 2025
Yes, but not in this PR as it seems unrelated |
markshannon commentedAug 13, 2025
Yes, that's the plan. |
| 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)) { |
There was a problem hiding this comment.
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 commentedSep 18, 2025
We've already started moving the buffers to the heap, so this won't be needed. |
Uh oh!
There was an error while loading.Please reload this page.