[Python-3000-checkins] r67253 - python/branches/py3k/Python/peephole.c
raymond.hettinger
python-3000-checkins at python.org
Tue Nov 18 01:07:10 CET 2008
Author: raymond.hettinger
Date: Tue Nov 18 01:07:10 2008
New Revision: 67253
Log:
Issue 2260: Small peephole optimization -- eliminate unnecessary POP_TOP /JUMP_FORWARD 1 pairs.
Modified:
python/branches/py3k/Python/peephole.c
Modified: python/branches/py3k/Python/peephole.c
==============================================================================
--- python/branches/py3k/Python/peephole.c (original)
+++ python/branches/py3k/Python/peephole.c Tue Nov 18 01:07:10 2008
@@ -430,6 +430,16 @@
cumlc = 0;
break;
+ /* Replace POP_TOP JUMP_FORWARD 1 POP_TOP
+ with NOP NOP NOP NOP POP_TOP. */
+ case POP_TOP:
+ if (UNCONDITIONAL_JUMP(codestr[i+1]) &&
+ GETJUMPTGT(codestr, i+1) == i+5 &&
+ codestr[i+4] == POP_TOP &&
+ ISBASICBLOCK(blocks,i,4))
+ memset(codestr+i, NOP, 4);
+ break;
+
/* Try to fold tuples of constants (includes a case for lists
which are only used for "in" and "not in" tests).
Skip over BUILD_SEQN 1 UNPACK_SEQN 1.
More information about the Python-3000-checkins
mailing list