diff options
author | Raymond Hettinger <python@rcn.com> | 2003-04-22 06:49:11 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-04-22 06:49:11 (GMT) |
commit | 060641d51160f6bf49a049bb677f8412b5a19de3 (patch) | |
tree | 1ad7d568e797a6387b7f0792f5286f901b8f4f32 /Python/ceval.c | |
parent | 0c83348d5c110a6ca706219019e97d5cefe2fddb (diff) | |
download | cpython-060641d51160f6bf49a049bb677f8412b5a19de3.zip cpython-060641d51160f6bf49a049bb677f8412b5a19de3.tar.gz cpython-060641d51160f6bf49a049bb677f8412b5a19de3.tar.bz2 |
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 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 3ea1bdc..7f8f654 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -873,6 +873,9 @@ eval_frame(PyFrameObject *f) /* case STOP_CODE: this is an error! */ + case NOP: + goto fast_next_opcode; + case LOAD_FAST: x = GETLOCAL(oparg); if (x != NULL) { |