diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-06-28 03:18:59 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-06-28 03:18:59 +0000 |
commit | 00fe8a7b2317f11bff754c73a87b69445fe0b33d (patch) | |
tree | 6ccb074fdc9313be1446b6ea9f5ce755611baaa8 /Python/peephole.c | |
parent | 4fee4f2ee8d210731b0d0aea14ffecdc28c5afca (diff) | |
download | cpython-00fe8a7b2317f11bff754c73a87b69445fe0b33d.tar.gz |
Merged revisions 72912,72920,72940 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72912 | benjamin.peterson | 2009-05-25 08:13:44 -0500 (Mon, 25 May 2009) | 5 lines
add a SETUP_WITH opcode
It speeds up the with statement and correctly looks up the special
methods involved.
........
r72920 | benjamin.peterson | 2009-05-25 15:12:57 -0500 (Mon, 25 May 2009) | 1 line
take into account the fact that SETUP_WITH pushes a finally block
........
r72940 | benjamin.peterson | 2009-05-26 07:49:59 -0500 (Tue, 26 May 2009) | 1 line
teach the peepholer about SETUP_WITH
........
Diffstat (limited to 'Python/peephole.c')
-rw-r--r-- | Python/peephole.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/peephole.c b/Python/peephole.c index de1b2aca0d..23735b0a31 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -251,6 +251,7 @@ markblocks(unsigned char *code, Py_ssize_t len) case SETUP_LOOP: case SETUP_EXCEPT: case SETUP_FINALLY: + case SETUP_WITH: j = GETJUMPTGT(code, i); blocks[j] = 1; break; @@ -566,6 +567,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_LOOP: case SETUP_EXCEPT: case SETUP_FINALLY: + case SETUP_WITH: tgt = GETJUMPTGT(codestr, i); /* Replace JUMP_* to a RETURN into just a RETURN */ if (UNCONDITIONAL_JUMP(opcode) && @@ -648,6 +650,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case SETUP_LOOP: case SETUP_EXCEPT: case SETUP_FINALLY: + case SETUP_WITH: j = addrmap[GETARG(codestr, i) + i + 3] - addrmap[i] - 3; SETARG(codestr, i, j); break; |