Skip to content

gh-98831: add variable stack effect support to cases generator - #101309

Merged
iritkatriel merged 4 commits into
python:mainfrom
iritkatriel:metadata
Jan 25, 2023
Merged

gh-98831: add variable stack effect support to cases generator#101309
iritkatriel merged 4 commits into
python:mainfrom
iritkatriel:metadata

Conversation

@iritkatriel

@iritkatrieliritkatriel commented Jan 25, 2023

Copy link
Copy Markdown
Member

@iritkatriel

Copy link
Copy Markdown
MemberAuthor

We’ll want something more efficient than this. Maybe generate a function with a switch statement for each value?

Comment threadPython/opcode_metadata.h Outdated
@gvanrossum

Copy link
Copy Markdown
Member

We’ll want something more efficient than this. Maybe generate a function with a switch statement for each value?

Yes. Read this after writing my response. :-)

@gvanrossumgvanrossum left a comment

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.

Very nice, just one request and one suggestion.

Comment threadTools/cases_generator/generate_cases.py Outdated
self.out.emit(f" case {instr.name}:")
self.out.emit(f" return {effect};")
self.out.emit(" default:")
self.out.emit(" Py_UNREACHABLE();")

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.

If you make this return -1; then you can drop all the cases that return -1, making the function much shorter.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There won't be any -1's when we finish. We could group all cases with the same value if we want.

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.

Ah, makes sense. LGTM then.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@iritkatriel@gvanrossum@bedevere-bot