Uh oh!
There was an error while loading. Please reload this page.
gh-106529: Split FOR_ITER_{LIST,TUPLE} into uops - #106696
Conversation
gvanrossum
commented
Jul 12, 2023
@iritkatriel Do you have time to look at the reservation code? The rest is on auto-pilot (I'm going to add FOR_ITER_TUPLE to the same PR. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| _Py_CODEUNIT *initial_instr = instr; | ||
| int trace_length = 0; | ||
| int max_length = buffer_size; | ||
| int reserved = 0; |
There was a problem hiding this comment.
The point of reserve is to make sure that you won't error out in the middle of an opcode's translation to uops?
There was a problem hiding this comment.
Correct. I'd rather reserve space ahead than having to bail out in the middle and undo some work already done (the undoing feels more brittle).
gvanrossum
commented
Jul 13, 2023
Assuming the tests pass this time I'll just merge. |
Also rename `_ITER_EXHAUSTED_XXX` to `_IS_ITER_EXHAUSTED_XXX` to make it clear this is a test.
The Tier 2 opcode _IS_ITER_EXHAUSTED_LIST (and _TUPLE) didn't set it->it_seq to NULL, causing a subtle bug that resulted in test_exhausted_iterator in list_tests.py to fail when running all tests with -Xuops. The bug was introduced in gh-106696. Added this as an explicit test. Also fixed the dependencies for ceval.o -- it depends on executor_cases.c.h.
Same recipe as FOR_ITER_RANGE. I refactored the Tier 2 transformation code to handle similar cases. I had to fix a bug in the space reservation code, and decided to add some macros and an extra guard rail for that.