From 060641d51160f6bf49a049bb677f8412b5a19de3 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 22 Apr 2003 06:49:11 +0000 Subject: 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. --- Python/ceval.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Python/ceval.c') diff --git a/Python/ceval.c b/Python/ceval.c index 3ea1bdc966..7f8f65493b 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) { -- cgit v1.2.1