Issue 41323: Perform "peephole" optimization directly on control-flow graph. (original) (raw)
Issue41323
Created on 2020-07-17 10:27 by Mark.Shannon, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 21517 | merged | Mark.Shannon,2020-07-17 10:38 | |
PR 25419 | merged | methane,2021-04-15 01:17 |
Messages (4) | ||
---|---|---|
msg373811 - (view) | Author: Mark Shannon (Mark.Shannon) * ![]() |
Date: 2020-07-17 10:27 |
Currently we perform various bytecode improvements as a pass on the code objects after generating the code object. This requires parsing the bytecode to find instructions, recreating the CFG, and rewriting the line number table. If we perform the optimizations directly on the CFG we can avoid all that additional work. This would save hundreds of lines of code and avoid coupling the optimization to the line number table format. | ||
msg373848 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2020-07-17 19:00 |
+1 This looks like a nice improvement. I've long wanted the optimizations to be moved upstream. At the time the peephole logic was first written, operating directly on the code object was the only option that kept optimizations separate from the core compiler logic. But disassembling and reassembling bytecode was always awkward — it is nice to no longer have to do so. | ||
msg374606 - (view) | Author: Mark Shannon (Mark.Shannon) * ![]() |
Date: 2020-07-30 09:03 |
New changeset 6e8128f02e1d36e38e5866f9dc36e051caa47bc9 by Mark Shannon in branch 'master': bpo-41323: Perform 'peephole' optimizations directly on the CFG. (GH-21517) https://github.com/python/cpython/commit/6e8128f02e1d36e38e5866f9dc36e051caa47bc9 | ||
msg391165 - (view) | Author: Inada Naoki (methane) * ![]() |
Date: 2021-04-16 05:01 |
New changeset 8a232c7b17a2e41ae14d8bb7937ddfea69301dce by Inada Naoki in branch 'master': bpo-41323: compiler: Reuse tuple in constant tuple folding (GH-25419) https://github.com/python/cpython/commit/8a232c7b17a2e41ae14d8bb7937ddfea69301dce |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:33 | admin | set | github: 85495 |
2021-04-16 05:01:32 | methane | set | messages: + |
2021-04-15 01:17:16 | methane | set | nosy: + methanepull_requests: + <pull%5Frequest24150> |
2020-07-30 09:04:04 | Mark.Shannon | set | status: open -> closedresolution: fixedstage: patch review -> resolved |
2020-07-30 09:03:27 | Mark.Shannon | set | messages: + |
2020-07-19 06:13:34 | rhettinger | set | nosy: + tim.peters |
2020-07-17 19:00:00 | rhettinger | set | nosy: + rhettingermessages: + |
2020-07-17 18:45:38 | brett.cannon | set | nosy: + vstinner |
2020-07-17 10:38:08 | Mark.Shannon | set | keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest20653> |
2020-07-17 10:27:02 | Mark.Shannon | create |