mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
Improved the bytecode optimizer.
* Can now test for basic blocks. * Optimize inverted comparisions. * Optimize unary_not followed by a conditional jump. * Added a new opcode, NOP, to keep code size constant. * Applied NOP to previous transformations where appropriate. Note, the NOP would not be necessary if other functions were added to re-target jump addresses and update the co_lnotab mapping. That would yield slightly faster and cleaner bytecode at the expense of optimizer simplicity and of keeping it decoupled from the line-numbering structure.
This commit is contained in:
parent
0c83348d5c
commit
060641d511
5 changed files with 97 additions and 9 deletions
|
@ -49,6 +49,8 @@ def_op('ROT_THREE', 3)
|
|||
def_op('DUP_TOP', 4)
|
||||
def_op('ROT_FOUR', 5)
|
||||
|
||||
def_op('NOP', 9)
|
||||
|
||||
def_op('UNARY_POSITIVE', 10)
|
||||
def_op('UNARY_NEGATIVE', 11)
|
||||
def_op('UNARY_NOT', 12)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue