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
GH-93678: reduce boilerplate and code repetition in the compiler #93682
Conversation
…to one functions to reduce unnecessary repetition
If you want to schedule another build, you need to add the " |
Sorry but I'm clueless when it comes to the compiler, so I can't give a review. |
Seems like a nice improvement in the architecture of the compiler.
If you want to schedule another build, you need to add the " |
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. |
If you want to schedule another build, you need to add the " |
If you want to schedule another build, you need to add the " |
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).