gh-118926: Spill deferred references to stack in cases generator#122748
gh-118926: Spill deferred references to stack in cases generator#122748colesbury merged 5 commits into
Conversation
This automatically spills the results from `_PyStackRef_FromPyObjectNew` to the in-memory stack so that the deferred references are visible to the GC before we make any possibly escaping call. Co-authored-by: Ken Jin <kenjin@python.org>
|
@markshannon, this is the spilling logic split out from: I've updated it to handle the changes to the stack from #122286. This required tracking output local variables in the stack before emitting tokens for a uop. I've also moved the analysis to analyzer.py. |
Sorry, something went wrong.
markshannon
left a comment
There was a problem hiding this comment.
The stack shouldn't have "outputs" (or inputs) as it should model the state of the stack only.
The outputs (or inputs) are properties of the uops and instructions.
That can be fixed by passing the output variables to flush_single_var instead of caching them on the stack.
Note:
I think the correct long term approach to handling stack spilling is to lazily spill when code escapes. But that involves considerably deeper analysis.
Although this PR doesn't do that, it doesn't prevent us from doing in future. So I am happy to merge it once the above issue is fixed.
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: And if you don't make the requested changes, you will be poked with soft cushions! |
Sorry, something went wrong.
|
@markshannon, would you please take another look at it. I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
Sorry, something went wrong.
markshannon
left a comment
There was a problem hiding this comment.
Thanks for bearing with me on this one.
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @colesbury for commit ae1c018 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
Sorry, something went wrong.
python#122748) This automatically spills the results from `_PyStackRef_FromPyObjectNew` to the in-memory stack so that the deferred references are visible to the GC before we make any possibly escaping call. Co-authored-by: Ken Jin <kenjin@python.org>
This automatically spills the results from
_PyStackRef_FromPyObjectNewto the in-memory stack so that the deferred references are visible to the GC before we make any possibly escaping call.