Skip to content

gh-145866: Implement POP_ITER as macro op using POP_TOP#146185

Open
bkap123 wants to merge 4 commits intopython:mainfrom
bkap123:pop-iter-macro-op
Open

gh-145866: Implement POP_ITER as macro op using POP_TOP#146185
bkap123 wants to merge 4 commits intopython:mainfrom
bkap123:pop-iter-macro-op

Conversation

@bkap123
Copy link
Contributor

@bkap123 bkap123 commented Mar 19, 2026

As the JIT can optimize _POP_TOP uops, I implemented POP_TOP for the POP_ITER instruction. I am fairly confident that this is the right solution but I am new to the JIT and would welcome any feedback.

As the JIT can optimize `_POP_TOP` uops, I implemented `POP_TOP` for
the `POP_ITER` instruction. I am fairly confident that this is the right
solution but I am new to the JIT and would welcome any feedback.

def test_pop_iter(self):
def testfunc(n):
for _ in range(n):
Copy link
Member

@Fidget-Spinner Fidget-Spinner Mar 20, 2026

Choose a reason for hiding this comment

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

This test seems wrong. It's not testing for POP_ITER, or at least it's not in the trace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think I should change? When I wrote the test, I just wanted to make sure that a POP_ITER instruction would be converted into only one _POP_TOP uop as that was the goal of the original issue. Maybe it might be helpful to rename the test to something like test_pop_iter_uop_expansion?

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.

2 participants