Skip to content

gh-145866: Convert SET_UPDATE to leave its inputs on the stack to be cleaned up by _POP_TOP#145979

Open
Sacul0457 wants to merge 3 commits intopython:mainfrom
Sacul0457:Optimize_SET_UPDATE
Open

gh-145866: Convert SET_UPDATE to leave its inputs on the stack to be cleaned up by _POP_TOP#145979
Sacul0457 wants to merge 3 commits intopython:mainfrom
Sacul0457:Optimize_SET_UPDATE

Conversation

@Sacul0457
Copy link
Contributor

@Sacul0457 Sacul0457 commented Mar 15, 2026

Comment on lines +2172 to +2176
i = iterable;
DEAD(iterable);
if (err < 0) {
ERROR_NO_POP();
}
Copy link
Member

Choose a reason for hiding this comment

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

i should transfer ownership only after the error branch case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, should I do the same for this too?

Copy link
Member

@Fidget-Spinner Fidget-Spinner Mar 15, 2026

Choose a reason for hiding this comment

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

Yes please. It doesn't affect the generated code at the moment, but it does affect the correctness/reasoning.

The reasoning is as follows:

  1. We call ERROR_NO_POP in the error branch, implying everything on the stack is a live value.
  2. However, the current code marks the stack value as dead before the ERROR_NO_POP.
  3. and 2. are contradicting each other.

@Sacul0457
Copy link
Contributor Author

I believe the failure isn't related to the pr

Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks.

@Fidget-Spinner
Copy link
Member

@Sacul0457 after this PR, can you please raise a PR to add your name (if you feel comfortable) to https://docs.python.org/dev/whatsnew/3.15.html#upgraded-jit-compiler ?

Specifically, the section on More JIT optimizations, should say

(Contributed by Ken Jin, Donghee Na, Zheao Li, Hai Zhu, Savannah Ostrowski, Reiden Ong, , Noam Cohen, Tomas Roun, PuQing, and Cajetan Rodrigues in ....)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants