diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2009-02-28 19:03:21 (GMT) |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2009-02-28 19:03:21 (GMT) |
commit | 68d68520061a5a4aa3437f8c74ba383b2da50280 (patch) | |
tree | aaade0afac9b9369b58c5642e2635fa319f61c02 /Doc | |
parent | de28d6841e60d75ce7644ca527448f73376ec48e (diff) | |
download | cpython-68d68520061a5a4aa3437f8c74ba383b2da50280.zip cpython-68d68520061a5a4aa3437f8c74ba383b2da50280.tar.gz cpython-68d68520061a5a4aa3437f8c74ba383b2da50280.tar.bz2 |
Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
POP_JUMP_IF_{TRUE,FALSE} and JUMP_IF_{TRUE,FALSE}_OR_POP. This avoids executing
a POP_TOP on each conditional and sometimes allows the peephole optimizer to
skip a JUMP_ABSOLUTE entirely. It speeds up list comprehensions significantly.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/dis.rst | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 3dd528b..6b7ed1e 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -664,16 +664,26 @@ the more significant byte last. Increments bytecode counter by *delta*. -.. opcode:: JUMP_IF_TRUE (delta) +.. opcode:: POP_JUMP_IF_TRUE (target) - If TOS is true, increment the bytecode counter by *delta*. TOS is left on the - stack. + If TOS is true, sets the bytecode counter to *target*. TOS is popped. -.. opcode:: JUMP_IF_FALSE (delta) +.. opcode:: POP_JUMP_IF_FALSE (target) - If TOS is false, increment the bytecode counter by *delta*. TOS is not - changed. + If TOS is false, sets the bytecode counter to *target*. TOS is popped. + + +.. opcode:: JUMP_IF_TRUE_OR_POP (target) + + If TOS is true, sets the bytecode counter to *target* and leaves TOS + on the stack. Otherwise (TOS is false), TOS is popped. + + +.. opcode:: JUMP_IF_FALSE_OR_POP (target) + + If TOS is false, sets the bytecode counter to *target* and leaves + TOS on the stack. Otherwise (TOS is true), TOS is popped. .. opcode:: JUMP_ABSOLUTE (target) |