Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 32402:1c2baae14828 legacy-trunk
Move NOP to end of code transformation.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Thu, 24 Jun 2004 09:25:39 +0000 |
| parents | 6bc6abba8659 |
| children | 87d196e1c2d0 |
line wrap: on
line diff
--- a/Python/compile.c Thu Jun 24 06:03:59 2004 +0000 +++ b/Python/compile.c Thu Jun 24 09:25:39 2004 +0000 @@ -392,7 +392,8 @@ opcode = codestr[i]; switch (opcode) { - /* Replace UNARY_NOT JUMP_IF_FALSE with NOP JUMP_IF_TRUE */ + /* Replace UNARY_NOT JUMP_IF_FALSE POP_TOP with + with JUMP_IF_TRUE POP_TOP NOP */ case UNARY_NOT: if (codestr[i+1] != JUMP_IF_FALSE || codestr[i+4] != POP_TOP || @@ -401,8 +402,11 @@ tgt = GETJUMPTGT(codestr, (i+1)); if (codestr[tgt] != POP_TOP) continue; - codestr[i] = NOP; - codestr[i+1] = JUMP_IF_TRUE; + j = GETARG(codestr, i+1) + 1; + codestr[i] = JUMP_IF_TRUE; + SETARG(codestr, i, j); + codestr[i+3] = POP_TOP; + codestr[i+4] = NOP; break; /* not a is b --> a is not b
