Mercurial > cpython-lru_cache-weakref
comparison Python/ceval.c @ 28716:ab4fbf8ebab3 legacy-trunk
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.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Tue, 22 Apr 2003 06:49:11 +0000 |
| parents | a4154dd5939a |
| children | 3df0cf16defc |
comparison
equal
deleted
inserted
replaced
| 28715:1d8e84d96dde | 28716:ab4fbf8ebab3 |
|---|---|
| 870 It is essential that any operation that fails sets either | 870 It is essential that any operation that fails sets either |
| 871 x to NULL, err to nonzero, or why to anything but WHY_NOT, | 871 x to NULL, err to nonzero, or why to anything but WHY_NOT, |
| 872 and that no operation that succeeds does this! */ | 872 and that no operation that succeeds does this! */ |
| 873 | 873 |
| 874 /* case STOP_CODE: this is an error! */ | 874 /* case STOP_CODE: this is an error! */ |
| 875 | |
| 876 case NOP: | |
| 877 goto fast_next_opcode; | |
| 875 | 878 |
| 876 case LOAD_FAST: | 879 case LOAD_FAST: |
| 877 x = GETLOCAL(oparg); | 880 x = GETLOCAL(oparg); |
| 878 if (x != NULL) { | 881 if (x != NULL) { |
| 879 Py_INCREF(x); | 882 Py_INCREF(x); |
