mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +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
|
@ -294,6 +294,13 @@ Core and builtins
|
|||
value, but according to PEP 237 it really needs to be 1 now. This
|
||||
will be backported to Python 2.2.3 a well. (SF #660455)
|
||||
|
||||
- Added several bytecode optimizations. Provides speed-ups to
|
||||
inverted in/is tests, inverted jumps, while 1 loops, and jumps to
|
||||
unconditional jumps.
|
||||
|
||||
- Added a new opcode, NOP, which is used in some of the bytecode
|
||||
transformations.
|
||||
|
||||
- int(s, base) sometimes sign-folds hex and oct constants; it only
|
||||
does this when base is 0 and s.strip() starts with a '0'. When the
|
||||
sign is actually folded, as in int("0xffffffff", 0) on a 32-bit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue