diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/opcode.py | 8 | ||||
-rw-r--r-- | Lib/test/test_peepholer.py | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py index 9484d1e..86ebc5c5 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -131,9 +131,11 @@ name_op('IMPORT_NAME', 108) # Index in name list name_op('IMPORT_FROM', 109) # 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 diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py index f3e240e..1543f3b 100644 --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -19,14 +19,14 @@ def dis_single(line): class TestTranforms(unittest.TestCase): def test_unot(self): - # UNARY_NOT JUMP_IF_FALSE POP_TOP --> JUMP_IF_TRUE POP_TOP' + # UNARY_NOT POP_JUMP_IF_FALSE --> POP_JUMP_IF_TRUE' def unot(x): if not x == 2: del x asm = disassemble(unot) - for elem in ('UNARY_NOT', 'JUMP_IF_FALSE'): + for elem in ('UNARY_NOT', 'POP_JUMP_IF_FALSE'): self.assert_(elem not in asm) - for elem in ('JUMP_IF_TRUE', 'POP_TOP'): + for elem in ('POP_JUMP_IF_TRUE',): self.assert_(elem in asm) def test_elim_inversion_of_is_or_in(self): @@ -64,13 +64,13 @@ class TestTranforms(unittest.TestCase): self.assert_('LOAD_GLOBAL' not in disassemble(f)) def test_while_one(self): - # Skip over: LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP + # Skip over: LOAD_CONST trueconst POP_JUMP_IF_FALSE xx def f(): while 1: pass return list asm = disassemble(f) - for elem in ('LOAD_CONST', 'JUMP_IF_FALSE'): + for elem in ('LOAD_CONST', 'POP_JUMP_IF_FALSE'): self.assert_(elem not in asm) for elem in ('JUMP_ABSOLUTE',): self.assert_(elem in asm) |