bpo-41323: Perform 'peephole' optimizations directly on the CFG.#21517
Conversation
|
Mostly, this looks pretty good. Consider removing the peephole.c file altogether. It was originally part of compile.c and got separated out when it got too large. We can more the PyCode_Optimize() function back to compile.c. Ideally, we could drop it from the public api as part of Victor's PEP to overhaul the C API. One small loss is that the current code has macros that provide meaningful opcode groupings like UNCONDITIONAL_JUMP, CONDITIONAL_JUMP, ABSOLUTE_JUMP, and JUMPS_ON_TRUE. I always found those grouping helpful for reasoning about the code. |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 6b7019a 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Sorry, something went wrong.
pablogsal
left a comment
There was a problem hiding this comment.
This looks great and very compact! This is a very good work @markshannon ! I will do a more thorough review over the weekend but I have left some minor comments for now
Sorry, something went wrong.
7845d6f to
8551d33
Compare
July 20, 2020 09:33
|
@rhettinger The |
Sorry, something went wrong.
8551d33 to
7bc2522
Compare
July 20, 2020 09:49
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit fda0bed 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Sorry, something went wrong.
|
One final tweak. Jumps to empty blocks that were immediately followed by jumps were not being eliminated. The final commit fixes that. |
Sorry, something went wrong.
…honGH-21517) * Move 'peephole' optimizations into compile.c and perform them directly on the CFG.
…honGH-21517) * Move 'peephole' optimizations into compile.c and perform them directly on the CFG.
…honGH-21517) * Move 'peephole' optimizations into compile.c and perform them directly on the CFG.
https://bugs.python.org/issue41323