diff options
author | Raymond Hettinger <python@rcn.com> | 2003-04-22 06:49:11 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-04-22 06:49:11 +0000 |
commit | 559061965b3f79aa08fdece81bd40e93353dc390 (patch) | |
tree | ae5ec9f415b04bc130cd76fe7cf2fc0437bcbe6a /Lib/opcode.py | |
parent | 6eabb997182e86ccf04b3196ceb282b0e40bde46 (diff) | |
download | cpython-559061965b3f79aa08fdece81bd40e93353dc390.tar.gz |
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.
Diffstat (limited to 'Lib/opcode.py')
-rw-r--r-- | Lib/opcode.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py index cfde5f803b..15f92a740e 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -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) |