-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
GH-93678: reduce boilerplate and code repetition in the compiler #93682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-93678: reduce boilerplate and code repetition in the compiler #93682
Conversation
…to one functions to reduce unnecessary repetition
|
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit f8a0767 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
Sorry but I'm clueless when it comes to the compiler, so I can't give a review. |
markshannon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a nice improvement in the architecture of the compiler.
|
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 7670a7c 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
brandtbucher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks nice.
One thing I noticed is that the new design creates lots of temporary location structs (at least one for every instruction emitted by the frontend, I think). Could we instead keep just one struct on the compiler unit, and maybe have a static "no location" struct, and just pass references to those into basicblock_addop instead?
Yeah I guess we could pass them by reference. I'm now working on replacing the four fields by the struct in the instr and compiler unit structs, will push that in a bit. |
|
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 9b5dc34 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 414e26a 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
markshannon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement in clarity.
sweeneyde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100 lines shorter 🎉
It might be easier to review the individual commits separately.
The code generation part of the compiler has several functions which are slight variations of each other. Part of this is due to the evolution of the code when accurate line number information was added.
This PR tidies this up to simplify the code. Having just one basicblock_addop function that knows how to handle all the HAS_ARG, !HAS_ARG and JUMP cases is a step towards being able to feed bytecode instruction sequences and turn them into basicblocks (without having to differentiate between the three types).