GeezerVison is showing github.com — GH-98831: Refactor generate_cases.py by gvanrossum · Pull Request #99408 · python/cpython
Conversation
gvanrossum
commented
Nov 12, 2022
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Had to refactor the parser a bit for this.
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Objects/ directory.
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Objects/dictobject.c.
… venvs (pythonGH-99206)
Check to see if `base_executable` exists. If it does not, attempt
to use known alternative names of the python binary to find an
executable in the path specified by `home`.
If no alternative is found, previous behavior is preserved.
Signed-off-by: Vincent Fazio <[email protected]>
Signed-off-by: Vincent Fazio <[email protected]>
This was a bin subtle, esp. BINARY_SUBSCR_DICT (which plays games
with refcounts) and BINARY_SUBSCR_GETITEM (which ends with a goto).
|
My expectation at this point is that converting the majority of instructions to non-legacy form (cache and stack effects) will be a big project, even if we skip opcodes needing arrays or conditional stack effects.
The good news is that it can be parallelized -- each family can be done independently from any others, so anyone who wants to can pick a family and convert it, as long as it doesn't require fixing the generator (it's probably best if I stay on top of that).
I don't know how much we need to do before we can start experimenting with "macro" opcodes (see faster-cpython/ideas#491). Possibly we can start with an example like the one Mark wrote up in the DSL definition.
|
binbjz reacted with hooray emoji
erlend-aasland reacted with eyes emoji
All reactions
-
🎉
1 reaction
-
👀
1 reaction
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
markshannon
commented
Nov 15, 2022
•
edited by gvanrossum
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
I won't attempt a review of this PR, but a few comments on how I'd like the tool(s) to look.
- This is a compiler, so it should be built like one: Dumb IR(s) and multiple passes.
- Any methods on IR classes should be simple query method. Put all processing in the passes.
A possible design:
- Tokenizer: Tokenize the whole input file, so that locations are correct.
- Parser: Parse instructions
- Analyzer: Group and check families, check stack effects. Compute necessary labels and tables, instruction size, etc.
- Code gen: Generate C code as stream of tokens and strings
- Formatter: Format resulting C code, inserting
#line directives and whitespace where needed.
Then, when we want to generate a trace interpreter, a register interpreter, compiler front-end, etc. we can re-use the tokenizer, parser, and formatter.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks, I'll try to use that as a north star. In the meantime I am hoping to keep things working the way they were as much as possible to avoid disrupting other work. I have half the analyzer in this refactor, what's missing is a design for the IR to target.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I'm starting over from scratch now GH-99313 is merged.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 16, 2022
Reviewers
markshannon
Awaiting requested review from markshannon
markshannon will be requested when the pull request is marked ready for review
markshannon is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|