FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-106529: Split FOR_ITER_{LIST,TUPLE} into uops by gvanrossum · Pull Request #106696 · python/cpython · GitHub

/ cpython Public

gh-106529: Split FOR_ITER_{LIST,TUPLE} into uops - #106696

Merged
gvanrossum merged 13 commits into
python:mainfrom
gvanrossum:for-iter-list-tuple
Jul 14, 2023
Merged

gh-106529: Split FOR_ITER_{LIST,TUPLE} into uops#106696
gvanrossum merged 13 commits into
python:mainfrom
gvanrossum:for-iter-list-tuple

Conversation

gvanrossum commented Jul 12, 2023
edited
Loading

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

@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.

gvanrossum changed the title gh-106529: Split FOR_ITER_LIST into uops gh-106529: Split FOR_ITER_{LIST,TUPLE} into uops Jul 12, 2023
Comment thread Python/bytecodes.c Outdated
Comment thread Python/bytecodes.c Outdated
Comment thread Python/bytecodes.c Outdated
Comment thread Python/optimizer.c Outdated
Comment thread Python/optimizer.c
_Py_CODEUNIT *initial_instr = instr;
int trace_length = 0;
int max_length = buffer_size;
int reserved = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The point of reserve is to make sure that you won't error out in the middle of an opcode's translation to uops?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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).

Copy link
Copy Markdown
Member Author

Assuming the tests pass this time I'll just merge.

gvanrossum merged commit 025995f into python:main Jul 14, 2023
gvanrossum deleted the for-iter-list-tuple branch July 14, 2023 00:27
kgdiem pushed a commit to kgdiem/cpython that referenced this pull request Jul 14, 2023
Also rename `_ITER_EXHAUSTED_XXX` to `_IS_ITER_EXHAUSTED_XXX` to make it clear this is a test.
gvanrossum added a commit that referenced this pull request Jul 15, 2023
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL