summaryrefslogtreecommitdiffstats
path: root/Lib/opcode.py
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@gmail.com>2009-02-28 19:03:21 (GMT)
committerJeffrey Yasskin <jyasskin@gmail.com>2009-02-28 19:03:21 (GMT)
commit68d68520061a5a4aa3437f8c74ba383b2da50280 (patch)
treeaaade0afac9b9369b58c5642e2635fa319f61c02 /Lib/opcode.py
parentde28d6841e60d75ce7644ca527448f73376ec48e (diff)
downloadcpython-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 'Lib/opcode.py')
-rw-r--r--Lib/opcode.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py
index d41383b..24d5dcc 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -146,9 +146,11 @@ name_op('IMPORT_NAME', 107) # Index in name list
name_op('IMPORT_FROM', 108) # Index in name list
jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip
-jrel_op('JUMP_IF_FALSE', 111) # ""
-jrel_op('JUMP_IF_TRUE', 112) # ""
-jabs_op('JUMP_ABSOLUTE', 113) # Target byte offset from beginning of code
+jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code
+jabs_op('JUMP_IF_TRUE_OR_POP', 112) # ""
+jabs_op('JUMP_ABSOLUTE', 113) # ""
+jabs_op('POP_JUMP_IF_FALSE', 114) # ""
+jabs_op('POP_JUMP_IF_TRUE', 115) # ""
name_op('LOAD_GLOBAL', 116) # Index in name list