From 69781b4244a9485837b5eda473533e5c280068c0 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 6 Jun 2023 13:58:42 -0700 Subject: [PATCH 01/15] Make boolean conversions in branches explicit --- Lib/importlib/_bootstrap_external.py | 3 +- Lib/test/test_compile.py | 8 +- Lib/test/test_compiler_codegen.py | 3 +- Lib/test/test_dis.py | 212 +++++++++--------- Lib/test/test_peepholer.py | 9 +- Python/bytecodes.c | 26 +-- Python/compile.c | 23 +- Python/flowgraph.c | 89 ++++++-- Python/generated_cases.c.h | 324 +++++++++++++-------------- 9 files changed, 357 insertions(+), 340 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index cca0f82be49523..fda8fa8aeda99d 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -446,6 +446,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.12b1 3530 (Shrink the LOAD_SUPER_ATTR caches) # Python 3.12b1 3531 (Add PEP 695 changes) # Python 3.13a1 3550 (Plugin optimizer support) +# Python 3.13a1 3551 (Make the conversion to boolean in jumps explicit) # Python 3.14 will start with 3600 @@ -462,7 +463,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3550).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3551).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 784c0550cc09b1..373033d51bb8da 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -1292,19 +1292,19 @@ def test_multiline_boolean_expression(self): """) compiled_code, _ = self.check_positions_against_ast(snippet) # jump if a is true: - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', line=1, end_line=1, column=4, end_column=5, occurrence=1) # jump if b is false: - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', line=2, end_line=2, column=5, end_column=6, occurrence=1) # jump if c is false: - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', line=2, end_line=2, column=15, end_column=16, occurrence=2) # compare d and 0 self.assertOpcodeSourcePositionIs(compiled_code, 'COMPARE_OP', line=4, end_line=4, column=8, end_column=13, occurrence=1) # jump if comparison it True - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', line=4, end_line=4, column=8, end_column=13, occurrence=2) def test_multiline_assert(self): diff --git a/Lib/test/test_compiler_codegen.py b/Lib/test/test_compiler_codegen.py index ea57df9cd2400b..8f36411d5a9487 100644 --- a/Lib/test/test_compiler_codegen.py +++ b/Lib/test/test_compiler_codegen.py @@ -18,7 +18,8 @@ def test_if_expression(self): expected = [ ('RESUME', 0, 0), ('LOAD_CONST', 0, 1), - ('POP_JUMP_IF_FALSE', false_lbl := self.Label(), 1), + ('UNARY_NOT', 0, 1), + ('POP_JUMP_IF_TRUE', false_lbl := self.Label(), 1), ('LOAD_CONST', 1, 1), ('JUMP', exit_lbl := self.Label()), false_lbl, diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index affba12985548f..820a710e6df525 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -486,7 +486,8 @@ def _with(c): %3d >> PUSH_EXC_INFO WITH_EXCEPT_START - POP_JUMP_IF_TRUE 1 (to 42) + UNARY_NOT + POP_JUMP_IF_FALSE 1 (to 44) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -565,7 +566,8 @@ async def _asyncwith(c): JUMP_BACKWARD_NO_INTERRUPT 5 (to 90) >> CLEANUP_THROW >> END_SEND - POP_JUMP_IF_TRUE 1 (to 108) + UNARY_NOT + POP_JUMP_IF_FALSE 1 (to 110) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -1653,14 +1655,13 @@ def _prepare_test_cases(): Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=36, starts_line=None, is_jump_target=False, positions=None), ] - expected_opinfo_jumpy = [ Instruction(opname='RESUME', opcode=151, arg=0, argval=0, argrepr='', offset=0, starts_line=1, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='range', argrepr='NULL + range', offset=2, starts_line=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', offset=12, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=14, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=22, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='FOR_ITER', opcode=93, arg=28, argval=84, argrepr='to 84', offset=24, starts_line=None, is_jump_target=True, positions=None), + Instruction(opname='FOR_ITER', opcode=93, arg=30, argval=88, argrepr='to 88', offset=24, starts_line=None, is_jump_target=True, positions=None), Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=28, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=30, starts_line=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=40, starts_line=None, is_jump_target=False, positions=None), @@ -1669,105 +1670,112 @@ def _prepare_test_cases(): Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=52, starts_line=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=54, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=56, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=66, argrepr='to 66', offset=60, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=21, argval=24, argrepr='to 24', offset=62, starts_line=6, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=66, starts_line=7, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=68, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=70, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=80, argrepr='to 80', offset=74, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=28, argval=24, argrepr='to 24', offset=76, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=80, starts_line=8, is_jump_target=True, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=12, argval=108, argrepr='to 108', offset=82, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='END_FOR', opcode=4, arg=None, argval=None, argrepr='', offset=84, starts_line=3, is_jump_target=True, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=86, starts_line=10, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=96, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=98, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=106, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=108, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=33, argval=178, argrepr='to 178', offset=110, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=112, starts_line=12, is_jump_target=True, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=122, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=124, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=132, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=134, starts_line=13, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=136, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=138, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=142, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=144, starts_line=14, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=146, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=148, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=158, argrepr='to 158', offset=152, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=25, argval=108, argrepr='to 108', offset=154, starts_line=15, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=158, starts_line=16, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=160, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=162, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=170, argrepr='to 170', offset=166, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=15, argval=200, argrepr='to 200', offset=168, starts_line=17, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=170, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=178, argrepr='to 178', offset=172, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=33, argval=112, argrepr='to 112', offset=174, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=178, starts_line=19, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=188, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=190, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=198, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=200, starts_line=20, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=202, starts_line=21, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=204, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=206, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=68, argrepr='to 68', offset=62, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=22, argval=24, argrepr='to 24', offset=64, starts_line=6, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=68, starts_line=7, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=70, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=72, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=76, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=84, argrepr='to 84', offset=78, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=30, argval=24, argrepr='to 24', offset=80, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=84, starts_line=8, is_jump_target=True, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=12, argval=112, argrepr='to 112', offset=86, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='END_FOR', opcode=4, arg=None, argval=None, argrepr='', offset=88, starts_line=3, is_jump_target=True, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=90, starts_line=10, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=100, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=102, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=110, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=112, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=36, argval=190, argrepr='to 190', offset=116, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=118, starts_line=12, is_jump_target=True, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=128, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=130, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=138, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=140, starts_line=13, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=142, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=144, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=148, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=150, starts_line=14, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=152, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=154, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=158, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=166, argrepr='to 166', offset=160, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=27, argval=112, argrepr='to 112', offset=162, starts_line=15, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=166, starts_line=16, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=168, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=170, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=174, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=180, argrepr='to 180', offset=176, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=16, argval=212, argrepr='to 212', offset=178, starts_line=17, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=180, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=182, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=190, argrepr='to 190', offset=184, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=36, argval=118, argrepr='to 118', offset=186, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=190, starts_line=19, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=200, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=202, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=210, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=212, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=214, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=216, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=218, starts_line=26, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=228, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=230, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=238, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=240, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=242, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=244, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=246, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=254, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=256, starts_line=28, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=266, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=268, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=276, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=278, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=280, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=282, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=288, argrepr='to 288', offset=284, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=286, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=288, starts_line=None, is_jump_target=True, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=290, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=292, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=294, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=22, argval=256, argrepr='to 256', offset=296, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=300, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=302, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=304, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=306, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=308, starts_line=22, is_jump_target=False, positions=None), - Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=318, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=352, argrepr='to 352', offset=320, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=322, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=324, starts_line=23, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=334, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=336, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=344, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=346, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=48, argval=256, argrepr='to 256', offset=348, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=352, starts_line=22, is_jump_target=True, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=354, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=356, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=358, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=360, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=362, starts_line=28, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=372, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=374, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=382, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=384, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=386, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=388, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=390, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=212, starts_line=20, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=214, starts_line=21, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=216, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=218, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=222, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=224, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=226, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=228, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=230, starts_line=26, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=240, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=242, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=250, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=252, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=254, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=256, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=258, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=266, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=268, starts_line=28, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=278, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=280, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=288, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=290, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=292, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=294, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=296, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=302, argrepr='to 302', offset=298, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=300, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=302, starts_line=None, is_jump_target=True, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=304, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=306, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=308, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=23, argval=268, argrepr='to 268', offset=310, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=314, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=316, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=318, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=320, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=322, starts_line=22, is_jump_target=False, positions=None), + Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=332, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=366, argrepr='to 366', offset=334, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=336, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=338, starts_line=23, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=348, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=350, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=358, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=360, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=49, argval=268, argrepr='to 268', offset=362, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=366, starts_line=22, is_jump_target=True, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=368, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=370, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=372, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=374, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=376, starts_line=28, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=386, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=388, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=396, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=398, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=400, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=402, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=404, starts_line=None, is_jump_target=False, positions=None), ] # One last piece of inspect fodder to check the default line number handling diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py index 255e9280421423..81e615281aea93 100644 --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -72,9 +72,8 @@ def test_unot(self): def unot(x): if not x == 2: del x - self.assertNotInBytecode(unot, 'UNARY_NOT') - self.assertNotInBytecode(unot, 'POP_JUMP_IF_FALSE') - self.assertInBytecode(unot, 'POP_JUMP_IF_TRUE') + self.assertNotInBytecode(unot, 'POP_JUMP_IF_TRUE') + self.assertInBytecode(unot, 'POP_JUMP_IF_FALSE') self.check_lnotab(unot) def test_elim_inversion_of_is_or_in(self): @@ -386,14 +385,14 @@ def f(a, b, c): and c) self.check_jump_targets(f) self.check_lnotab(f) - self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_FALSE'), 2) + self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_TRUE'), 2) # POP_JUMP_IF_TRUE to POP_JUMP_IF_TRUE --> POP_JUMP_IF_TRUE to non-jump def f(a, b, c): return ((a or b) or c) self.check_jump_targets(f) self.check_lnotab(f) - self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_TRUE'), 2) + self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_FALSE'), 2) # JUMP_IF_FALSE_OR_POP to JUMP_IF_TRUE_OR_POP --> POP_JUMP_IF_FALSE to non-jump def f(a, b, c): return ((a and b) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 9fcf69b34153f9..cf0187168cd9d6 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2146,35 +2146,17 @@ dummy_func( } inst(POP_JUMP_IF_FALSE, (cond -- )) { + assert(PyBool_Check(cond)); if (Py_IsFalse(cond)) { JUMPBY(oparg); } - else if (!Py_IsTrue(cond)) { - int err = PyObject_IsTrue(cond); - DECREF_INPUTS(); - if (err == 0) { - JUMPBY(oparg); - } - else { - ERROR_IF(err < 0, error); - } - } } inst(POP_JUMP_IF_TRUE, (cond -- )) { + assert(PyBool_Check(cond)); if (Py_IsTrue(cond)) { JUMPBY(oparg); } - else if (!Py_IsFalse(cond)) { - int err = PyObject_IsTrue(cond); - DECREF_INPUTS(); - if (err > 0) { - JUMPBY(oparg); - } - else { - ERROR_IF(err < 0, error); - } - } } inst(POP_JUMP_IF_NOT_NONE, (value -- )) { @@ -3401,7 +3383,7 @@ dummy_func( inst(INSTRUMENTED_POP_JUMP_IF_TRUE, ( -- )) { PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); + int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); ERROR_IF(err < 0, error); _Py_CODEUNIT *here = next_instr-1; @@ -3412,7 +3394,7 @@ dummy_func( inst(INSTRUMENTED_POP_JUMP_IF_FALSE, ( -- )) { PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); + int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); ERROR_IF(err < 0, error); _Py_CODEUNIT *here = next_instr-1; diff --git a/Python/compile.c b/Python/compile.c index 4fa1ee55bf764f..34a138ebab1348 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2823,11 +2823,13 @@ compiler_jump_if(struct compiler *c, location loc, ADDOP_I(c, LOC(e), SWAP, 2); ADDOP_I(c, LOC(e), COPY, 2); ADDOP_COMPARE(c, LOC(e), asdl_seq_GET(e->v.Compare.ops, i)); - ADDOP_JUMP(c, LOC(e), POP_JUMP_IF_FALSE, cleanup); + ADDOP(c, LOC(e), UNARY_NOT); + ADDOP_JUMP(c, LOC(e), POP_JUMP_IF_TRUE, cleanup); } VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n)); ADDOP_COMPARE(c, LOC(e), asdl_seq_GET(e->v.Compare.ops, n)); - ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next); + ADDOP(c, LOC(e), UNARY_NOT); + ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_FALSE : POP_JUMP_IF_TRUE, next); NEW_JUMP_TARGET_LABEL(c, end); ADDOP_JUMP(c, NO_LOCATION, JUMP, end); @@ -2850,7 +2852,8 @@ compiler_jump_if(struct compiler *c, location loc, /* general implementation */ VISIT(c, expr, e); - ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next); + ADDOP(c, LOC(e), UNARY_NOT); + ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_FALSE : POP_JUMP_IF_TRUE, next); return SUCCESS; } @@ -4202,9 +4205,9 @@ compiler_boolop(struct compiler *c, expr_ty e) location loc = LOC(e); assert(e->kind == BoolOp_kind); if (e->v.BoolOp.op == And) - jumpi = POP_JUMP_IF_FALSE; - else jumpi = POP_JUMP_IF_TRUE; + else + jumpi = POP_JUMP_IF_FALSE; NEW_JUMP_TARGET_LABEL(c, end); s = e->v.BoolOp.values; n = asdl_seq_LEN(s) - 1; @@ -4212,6 +4215,7 @@ compiler_boolop(struct compiler *c, expr_ty e) for (i = 0; i < n; ++i) { VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i)); ADDOP_I(c, loc, COPY, 1); + ADDOP(c, loc, UNARY_NOT); ADDOP_JUMP(c, loc, jumpi, end); ADDOP(c, loc, POP_TOP); } @@ -4519,7 +4523,8 @@ compiler_compare(struct compiler *c, expr_ty e) ADDOP_I(c, loc, COPY, 2); ADDOP_COMPARE(c, loc, asdl_seq_GET(e->v.Compare.ops, i)); ADDOP_I(c, loc, COPY, 1); - ADDOP_JUMP(c, loc, POP_JUMP_IF_FALSE, cleanup); + ADDOP(c, loc, UNARY_NOT); + ADDOP_JUMP(c, loc, POP_JUMP_IF_TRUE, cleanup); ADDOP(c, loc, POP_TOP); } VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n)); @@ -5754,7 +5759,8 @@ compiler_visit_keyword(struct compiler *c, keyword_ty k) static int compiler_with_except_finish(struct compiler *c, jump_target_label cleanup) { NEW_JUMP_TARGET_LABEL(c, suppress); - ADDOP_JUMP(c, NO_LOCATION, POP_JUMP_IF_TRUE, suppress); + ADDOP(c, NO_LOCATION, UNARY_NOT); + ADDOP_JUMP(c, NO_LOCATION, POP_JUMP_IF_FALSE, suppress); ADDOP_I(c, NO_LOCATION, RERAISE, 2); USE_LABEL(c, suppress); @@ -7162,7 +7168,8 @@ compiler_pattern_value(struct compiler *c, pattern_ty p, pattern_context *pc) } VISIT(c, expr, value); ADDOP_COMPARE(c, LOC(p), Eq); - RETURN_IF_ERROR(jump_to_fail_pop(c, LOC(p), pc, POP_JUMP_IF_FALSE)); + ADDOP(c, LOC(p), UNARY_NOT); + RETURN_IF_ERROR(jump_to_fail_pop(c, LOC(p), pc, POP_JUMP_IF_TRUE)); return SUCCESS; } diff --git a/Python/flowgraph.c b/Python/flowgraph.c index f8039a4985d948..80e4d0b0b5a577 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1116,6 +1116,36 @@ get_const_value(int opcode, int oparg, PyObject *co_consts) return Py_NewRef(constant); } +// Steals a reference to newconst. +static int +add_const(PyObject *newconst, PyObject *consts, PyObject *const_cache) +{ + if (_PyCompile_ConstCacheMergeOne(const_cache, &newconst) < 0) { + Py_DECREF(newconst); + return -1; + } + + Py_ssize_t index; + for (index = 0; index < PyList_GET_SIZE(consts); index++) { + if (PyList_GET_ITEM(consts, index) == newconst) { + break; + } + } + if (index == PyList_GET_SIZE(consts)) { + if ((size_t)index >= (size_t)INT_MAX - 1) { + PyErr_SetString(PyExc_OverflowError, "too many constants"); + Py_DECREF(newconst); + return -1; + } + if (PyList_Append(consts, newconst)) { + Py_DECREF(newconst); + return -1; + } + } + Py_DECREF(newconst); + return index; +} + /* Replace LOAD_CONST c1, LOAD_CONST c2 ... LOAD_CONST cn, BUILD_TUPLE n with LOAD_CONST (c1, c2, ... cn). The consts table must still be in list form so that the @@ -1153,33 +1183,14 @@ fold_tuple_on_constants(PyObject *const_cache, } PyTuple_SET_ITEM(newconst, i, constant); } - if (_PyCompile_ConstCacheMergeOne(const_cache, &newconst) < 0) { - Py_DECREF(newconst); + int index = add_const(newconst, consts, const_cache); + if (index < 0) { return ERROR; } - - Py_ssize_t index; - for (index = 0; index < PyList_GET_SIZE(consts); index++) { - if (PyList_GET_ITEM(consts, index) == newconst) { - break; - } - } - if (index == PyList_GET_SIZE(consts)) { - if ((size_t)index >= (size_t)INT_MAX - 1) { - Py_DECREF(newconst); - PyErr_SetString(PyExc_OverflowError, "too many constants"); - return ERROR; - } - if (PyList_Append(consts, newconst)) { - Py_DECREF(newconst); - return ERROR; - } - } - Py_DECREF(newconst); for (int i = 0; i < n; i++) { INSTR_SET_OP0(&inst[i], NOP); } - INSTR_SET_OP1(&inst[n], LOAD_CONST, (int)index); + INSTR_SET_OP1(&inst[n], LOAD_CONST, index); return SUCCESS; } @@ -1432,17 +1443,39 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); } break; + case UNARY_NOT: + cnt = get_const_value(opcode, oparg, consts); + if (cnt == NULL) { + goto error; + } + is_true = PyObject_IsTrue(cnt); + Py_DECREF(cnt); + if (is_true == -1) { + goto error; + } + cnt = PyBool_FromLong(!is_true); + int index = add_const(cnt, consts, const_cache); + if (index < 0) { + return ERROR; + } + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP1(&bb->b_instr[i + 1], LOAD_CONST, index); + break; case IS_OP: cnt = get_const_value(opcode, oparg, consts); if (cnt == NULL) { goto error; } - int jump_op = i+2 < bb->b_iused ? bb->b_instr[i+2].i_opcode : 0; + int invert = i + 2 < bb->b_iused && bb->b_instr[i + 2].i_opcode == UNARY_NOT; + int jump_op = i + invert + 2 < bb->b_iused ? bb->b_instr[i + invert + 2].i_opcode : 0; if (Py_IsNone(cnt) && (jump_op == POP_JUMP_IF_FALSE || jump_op == POP_JUMP_IF_TRUE)) { unsigned char nextarg = bb->b_instr[i+1].i_oparg; INSTR_SET_OP0(inst, NOP); INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); - bb->b_instr[i+2].i_opcode = nextarg ^ (jump_op == POP_JUMP_IF_FALSE) ? + if (invert) { + INSTR_SET_OP0(&bb->b_instr[i + 2], NOP); + } + bb->b_instr[i + invert + 2].i_opcode = nextarg ^ invert ^ (jump_op == POP_JUMP_IF_FALSE) ? POP_JUMP_IF_NOT_NONE : POP_JUMP_IF_NONE; } Py_DECREF(cnt); @@ -1454,6 +1487,14 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) } break; } + case IS_OP: + case CONTAINS_OP: + if (nextop == UNARY_NOT) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP1(&bb->b_instr[i + 1], opcode, !oparg); + continue; + } + break; /* Try to fold tuples of constants. Skip over BUILD_TUPLE(1) UNPACK_SEQUENCE(1). Replace BUILD_TUPLE(2) UNPACK_SEQUENCE(2) with SWAP(2). diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index a47d5ba88a1abc..f3fbb905bfbc3d 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -3195,101 +3195,79 @@ PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; #line 2149 "Python/bytecodes.c" + assert(PyBool_Check(cond)); if (Py_IsFalse(cond)) { JUMPBY(oparg); } - else if (!Py_IsTrue(cond)) { - int err = PyObject_IsTrue(cond); - #line 3204 "Python/generated_cases.c.h" - Py_DECREF(cond); - #line 2155 "Python/bytecodes.c" - if (err == 0) { - JUMPBY(oparg); - } - else { - if (err < 0) goto pop_1_error; - } - } - #line 3214 "Python/generated_cases.c.h" + #line 3203 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2165 "Python/bytecodes.c" + #line 2156 "Python/bytecodes.c" + assert(PyBool_Check(cond)); if (Py_IsTrue(cond)) { JUMPBY(oparg); } - else if (!Py_IsFalse(cond)) { - int err = PyObject_IsTrue(cond); - #line 3227 "Python/generated_cases.c.h" - Py_DECREF(cond); - #line 2171 "Python/bytecodes.c" - if (err > 0) { - JUMPBY(oparg); - } - else { - if (err < 0) goto pop_1_error; - } - } - #line 3237 "Python/generated_cases.c.h" + #line 3215 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2181 "Python/bytecodes.c" + #line 2163 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3246 "Python/generated_cases.c.h" + #line 3224 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2183 "Python/bytecodes.c" + #line 2165 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3251 "Python/generated_cases.c.h" + #line 3229 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2188 "Python/bytecodes.c" + #line 2170 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3263 "Python/generated_cases.c.h" + #line 3241 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2193 "Python/bytecodes.c" + #line 2175 "Python/bytecodes.c" } - #line 3267 "Python/generated_cases.c.h" + #line 3245 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2197 "Python/bytecodes.c" + #line 2179 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3280 "Python/generated_cases.c.h" + #line 3258 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2206 "Python/bytecodes.c" + #line 2188 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3293 "Python/generated_cases.c.h" + #line 3271 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3300,16 +3278,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2214 "Python/bytecodes.c" + #line 2196 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3309 "Python/generated_cases.c.h" + #line 3287 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2219 "Python/bytecodes.c" + #line 2201 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3317,7 +3295,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3321 "Python/generated_cases.c.h" + #line 3299 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3326,10 +3304,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2229 "Python/bytecodes.c" + #line 2211 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3333 "Python/generated_cases.c.h" + #line 3311 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3339,10 +3317,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2235 "Python/bytecodes.c" + #line 2217 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3346 "Python/generated_cases.c.h" + #line 3324 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3353,11 +3331,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2241 "Python/bytecodes.c" + #line 2223 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3361 "Python/generated_cases.c.h" + #line 3339 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3366,14 +3344,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2247 "Python/bytecodes.c" + #line 2229 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3373 "Python/generated_cases.c.h" + #line 3351 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2250 "Python/bytecodes.c" + #line 2232 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3377 "Python/generated_cases.c.h" + #line 3355 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3381,7 +3359,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2254 "Python/bytecodes.c" + #line 2236 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3404,11 +3382,11 @@ if (iter == NULL) { goto error; } - #line 3408 "Python/generated_cases.c.h" + #line 3386 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2277 "Python/bytecodes.c" + #line 2259 "Python/bytecodes.c" } - #line 3412 "Python/generated_cases.c.h" + #line 3390 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3419,7 +3397,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2296 "Python/bytecodes.c" + #line 2278 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3450,7 +3428,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3454 "Python/generated_cases.c.h" + #line 3432 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3458,7 +3436,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2329 "Python/bytecodes.c" + #line 2311 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3484,14 +3462,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3488 "Python/generated_cases.c.h" + #line 3466 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2357 "Python/bytecodes.c" + #line 2339 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3511,7 +3489,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3515 "Python/generated_cases.c.h" + #line 3493 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3521,7 +3499,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2379 "Python/bytecodes.c" + #line 2361 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3541,7 +3519,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3545 "Python/generated_cases.c.h" + #line 3523 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3551,7 +3529,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2401 "Python/bytecodes.c" + #line 2383 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3569,7 +3547,7 @@ if (next == NULL) { goto error; } - #line 3573 "Python/generated_cases.c.h" + #line 3551 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3578,7 +3556,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2421 "Python/bytecodes.c" + #line 2403 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3594,14 +3572,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3598 "Python/generated_cases.c.h" + #line 3576 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2439 "Python/bytecodes.c" + #line 2421 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3624,16 +3602,16 @@ Py_DECREF(enter); goto error; } - #line 3628 "Python/generated_cases.c.h" + #line 3606 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2462 "Python/bytecodes.c" + #line 2444 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3637 "Python/generated_cases.c.h" + #line 3615 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3645,7 +3623,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2472 "Python/bytecodes.c" + #line 2454 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3671,16 +3649,16 @@ Py_DECREF(enter); goto error; } - #line 3675 "Python/generated_cases.c.h" + #line 3653 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2498 "Python/bytecodes.c" + #line 2480 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3684 "Python/generated_cases.c.h" + #line 3662 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3692,7 +3670,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2507 "Python/bytecodes.c" + #line 2489 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3713,7 +3691,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3717 "Python/generated_cases.c.h" + #line 3695 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3722,7 +3700,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2530 "Python/bytecodes.c" + #line 2512 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3732,7 +3710,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3736 "Python/generated_cases.c.h" + #line 3714 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3746,7 +3724,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2542 "Python/bytecodes.c" + #line 2524 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3763,7 +3741,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3767 "Python/generated_cases.c.h" + #line 3745 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3777,7 +3755,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2561 "Python/bytecodes.c" + #line 2543 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3787,7 +3765,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3791 "Python/generated_cases.c.h" + #line 3769 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3801,7 +3779,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2573 "Python/bytecodes.c" + #line 2555 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3815,7 +3793,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3819 "Python/generated_cases.c.h" + #line 3797 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3824,16 +3802,16 @@ } TARGET(KW_NAMES) { - #line 2589 "Python/bytecodes.c" + #line 2571 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3832 "Python/generated_cases.c.h" + #line 3810 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2595 "Python/bytecodes.c" + #line 2577 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3846,7 +3824,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3850 "Python/generated_cases.c.h" + #line 3828 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3856,7 +3834,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2640 "Python/bytecodes.c" + #line 2622 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3938,7 +3916,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3942 "Python/generated_cases.c.h" + #line 3920 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3950,7 +3928,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2728 "Python/bytecodes.c" + #line 2710 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3960,7 +3938,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3964 "Python/generated_cases.c.h" + #line 3942 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3969,7 +3947,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2740 "Python/bytecodes.c" + #line 2722 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3995,7 +3973,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3999 "Python/generated_cases.c.h" + #line 3977 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4003,7 +3981,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2768 "Python/bytecodes.c" + #line 2750 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4039,7 +4017,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4043 "Python/generated_cases.c.h" + #line 4021 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4047,7 +4025,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2806 "Python/bytecodes.c" + #line 2788 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4057,7 +4035,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4061 "Python/generated_cases.c.h" + #line 4039 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4070,7 +4048,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2818 "Python/bytecodes.c" + #line 2800 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4081,7 +4059,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4085 "Python/generated_cases.c.h" + #line 4063 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4095,7 +4073,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2832 "Python/bytecodes.c" + #line 2814 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4106,7 +4084,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4110 "Python/generated_cases.c.h" + #line 4088 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4120,7 +4098,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2846 "Python/bytecodes.c" + #line 2828 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4142,7 +4120,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4146 "Python/generated_cases.c.h" + #line 4124 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4156,7 +4134,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2871 "Python/bytecodes.c" + #line 2853 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4184,7 +4162,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4188 "Python/generated_cases.c.h" + #line 4166 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4198,7 +4176,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2902 "Python/bytecodes.c" + #line 2884 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4230,7 +4208,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4234 "Python/generated_cases.c.h" + #line 4212 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4244,7 +4222,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2937 "Python/bytecodes.c" + #line 2919 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4276,7 +4254,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4280 "Python/generated_cases.c.h" + #line 4258 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4290,7 +4268,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2972 "Python/bytecodes.c" + #line 2954 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4315,7 +4293,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4319 "Python/generated_cases.c.h" + #line 4297 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4328,7 +4306,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2999 "Python/bytecodes.c" + #line 2981 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4355,7 +4333,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4359 "Python/generated_cases.c.h" + #line 4337 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4367,7 +4345,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3029 "Python/bytecodes.c" + #line 3011 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4385,14 +4363,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4389 "Python/generated_cases.c.h" + #line 4367 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3049 "Python/bytecodes.c" + #line 3031 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4423,7 +4401,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4427 "Python/generated_cases.c.h" + #line 4405 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4436,7 +4414,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3083 "Python/bytecodes.c" + #line 3065 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4465,7 +4443,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4469 "Python/generated_cases.c.h" + #line 4447 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4478,7 +4456,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3115 "Python/bytecodes.c" + #line 3097 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4507,7 +4485,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4511 "Python/generated_cases.c.h" + #line 4489 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4520,7 +4498,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3147 "Python/bytecodes.c" + #line 3129 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4548,7 +4526,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4552 "Python/generated_cases.c.h" + #line 4530 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4558,9 +4536,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3178 "Python/bytecodes.c" + #line 3160 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4564 "Python/generated_cases.c.h" + #line 4542 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4569,7 +4547,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3182 "Python/bytecodes.c" + #line 3164 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4631,14 +4609,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4635 "Python/generated_cases.c.h" + #line 4613 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3244 "Python/bytecodes.c" + #line 3226 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4642 "Python/generated_cases.c.h" + #line 4620 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4653,7 +4631,7 @@ PyObject *kwdefaults = (oparg & MAKE_FUNCTION_KWDEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & MAKE_FUNCTION_DEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0))] : NULL; PyObject *func; - #line 3254 "Python/bytecodes.c" + #line 3236 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4682,14 +4660,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4686 "Python/generated_cases.c.h" + #line 4664 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3285 "Python/bytecodes.c" + #line 3267 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4710,7 +4688,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4714 "Python/generated_cases.c.h" + #line 4692 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4718,15 +4696,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3308 "Python/bytecodes.c" + #line 3290 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4724 "Python/generated_cases.c.h" + #line 4702 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3310 "Python/bytecodes.c" + #line 3292 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4730 "Python/generated_cases.c.h" + #line 4708 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4737,7 +4715,7 @@ PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? stack_pointer[-((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))] : NULL; PyObject *value = stack_pointer[-(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))]; PyObject *result; - #line 3314 "Python/bytecodes.c" + #line 3296 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4772,7 +4750,7 @@ Py_DECREF(value); Py_XDECREF(fmt_spec); if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - #line 4776 "Python/generated_cases.c.h" + #line 4754 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4781,10 +4759,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3351 "Python/bytecodes.c" + #line 3333 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4788 "Python/generated_cases.c.h" + #line 4766 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4796,7 +4774,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3356 "Python/bytecodes.c" + #line 3338 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4811,12 +4789,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4815 "Python/generated_cases.c.h" + #line 4793 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3371 "Python/bytecodes.c" + #line 3353 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4820 "Python/generated_cases.c.h" + #line 4798 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4826,16 +4804,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3376 "Python/bytecodes.c" + #line 3358 "Python/bytecodes.c" assert(oparg >= 2); - #line 4832 "Python/generated_cases.c.h" + #line 4810 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3380 "Python/bytecodes.c" + #line 3362 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4847,54 +4825,54 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4851 "Python/generated_cases.c.h" + #line 4829 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3394 "Python/bytecodes.c" + #line 3376 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4857 "Python/generated_cases.c.h" + #line 4835 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3398 "Python/bytecodes.c" + #line 3380 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4864 "Python/generated_cases.c.h" + #line 4842 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3403 "Python/bytecodes.c" + #line 3385 "Python/bytecodes.c" PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); + int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); if (err < 0) goto error; _Py_CODEUNIT *here = next_instr-1; assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4879 "Python/generated_cases.c.h" + #line 4857 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3414 "Python/bytecodes.c" + #line 3396 "Python/bytecodes.c" PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); + int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); if (err < 0) goto error; _Py_CODEUNIT *here = next_instr-1; assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4893 "Python/generated_cases.c.h" + #line 4871 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3425 "Python/bytecodes.c" + #line 3407 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4906,12 +4884,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4910 "Python/generated_cases.c.h" + #line 4888 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3439 "Python/bytecodes.c" + #line 3421 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4923,30 +4901,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4927 "Python/generated_cases.c.h" + #line 4905 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3453 "Python/bytecodes.c" + #line 3435 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4938 "Python/generated_cases.c.h" + #line 4916 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3461 "Python/bytecodes.c" + #line 3443 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4945 "Python/generated_cases.c.h" + #line 4923 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3466 "Python/bytecodes.c" + #line 3448 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4952 "Python/generated_cases.c.h" + #line 4930 "Python/generated_cases.c.h" } From 5289c7f69e7e2ba75cafa076da55dd9f179cae7c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 6 Jun 2023 16:47:13 -0700 Subject: [PATCH 02/15] Specialize UNARY_NOT --- Include/internal/pycore_code.h | 7 + Include/internal/pycore_opcode.h | 21 +- Include/opcode.h | 5 + Lib/opcode.py | 10 + Lib/test/test_dis.py | 212 +++--- Python/bytecodes.c | 78 ++- Python/generated_cases.c.h | 1033 +++++++++++++++++------------- Python/opcode_metadata.h | 27 +- Python/opcode_targets.h | 10 +- Python/specialize.c | 105 ++- 10 files changed, 921 insertions(+), 587 deletions(-) diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index ef940b54b2b086..13975202712a38 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -101,6 +101,12 @@ typedef struct { #define INLINE_CACHE_ENTRIES_SEND CACHE_ENTRIES(_PySendCache) +typedef struct { + uint16_t counter; +} _PyUnaryNotCache; + +#define INLINE_CACHE_ENTRIES_UNARY_NOT CACHE_ENTRIES(_PyUnaryNotCache) + // Borrowed references to common callables: struct callable_cache { PyObject *isinstance; @@ -246,6 +252,7 @@ extern void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr, int oparg); extern void _Py_Specialize_ForIter(PyObject *iter, _Py_CODEUNIT *instr, int oparg); extern void _Py_Specialize_Send(PyObject *receiver, _Py_CODEUNIT *instr); +extern void _Py_Specialize_UnaryNot(PyObject *value, _Py_CODEUNIT *instr); /* Finalizer function for static codeobjects used in deepfreeze.py */ extern void _PyStaticCode_Fini(PyCodeObject *co); diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h index 15c8dcfdbe1c70..1373b3165e1114 100644 --- a/Include/internal/pycore_opcode.h +++ b/Include/internal/pycore_opcode.h @@ -32,6 +32,7 @@ const uint32_t _PyOpcode_Jump[9] = { }; const uint8_t _PyOpcode_Caches[256] = { + [UNARY_NOT] = 1, [BINARY_SUBSCR] = 1, [STORE_SUBSCR] = 1, [UNPACK_SEQUENCE] = 1, @@ -235,6 +236,11 @@ const uint8_t _PyOpcode_Deopt[256] = { [UNARY_INVERT] = UNARY_INVERT, [UNARY_NEGATIVE] = UNARY_NEGATIVE, [UNARY_NOT] = UNARY_NOT, + [UNARY_NOT_BOOL] = UNARY_NOT, + [UNARY_NOT_INT] = UNARY_NOT, + [UNARY_NOT_LIST] = UNARY_NOT, + [UNARY_NOT_NONE] = UNARY_NOT, + [UNARY_NOT_STR] = UNARY_NOT, [UNPACK_EX] = UNPACK_EX, [UNPACK_SEQUENCE] = UNPACK_SEQUENCE, [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE, @@ -416,17 +422,17 @@ static const char *const _PyOpcode_OpName[267] = { [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE", [UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", [SEND_GEN] = "SEND_GEN", - [169] = "<169>", - [170] = "<170>", + [UNARY_NOT_BOOL] = "UNARY_NOT_BOOL", + [UNARY_NOT_INT] = "UNARY_NOT_INT", [CALL] = "CALL", [KW_NAMES] = "KW_NAMES", [CALL_INTRINSIC_1] = "CALL_INTRINSIC_1", [CALL_INTRINSIC_2] = "CALL_INTRINSIC_2", [LOAD_FROM_DICT_OR_GLOBALS] = "LOAD_FROM_DICT_OR_GLOBALS", [LOAD_FROM_DICT_OR_DEREF] = "LOAD_FROM_DICT_OR_DEREF", - [177] = "<177>", - [178] = "<178>", - [179] = "<179>", + [UNARY_NOT_LIST] = "UNARY_NOT_LIST", + [UNARY_NOT_NONE] = "UNARY_NOT_NONE", + [UNARY_NOT_STR] = "UNARY_NOT_STR", [180] = "<180>", [181] = "<181>", [182] = "<182>", @@ -518,11 +524,6 @@ static const char *const _PyOpcode_OpName[267] = { #endif #define EXTRA_CASES \ - case 169: \ - case 170: \ - case 177: \ - case 178: \ - case 179: \ case 180: \ case 181: \ case 182: \ diff --git a/Include/opcode.h b/Include/opcode.h index bbf5756a352108..f3980011caf3d3 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -217,6 +217,11 @@ extern "C" { #define UNPACK_SEQUENCE_TUPLE 166 #define UNPACK_SEQUENCE_TWO_TUPLE 167 #define SEND_GEN 168 +#define UNARY_NOT_BOOL 169 +#define UNARY_NOT_INT 170 +#define UNARY_NOT_LIST 177 +#define UNARY_NOT_NONE 178 +#define UNARY_NOT_STR 179 #define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\ || ((op) == JUMP) \ diff --git a/Lib/opcode.py b/Lib/opcode.py index b33302949f2490..9383583976b3e5 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -438,6 +438,13 @@ def pseudo_op(name, op, real_ops): "SEND": [ "SEND_GEN", ], + "UNARY_NOT": [ + "UNARY_NOT_BOOL", + "UNARY_NOT_INT", + "UNARY_NOT_LIST", + "UNARY_NOT_NONE", + "UNARY_NOT_STR", + ] } _specialized_instructions = [ opcode for family in _specializations.values() for opcode in family @@ -492,6 +499,9 @@ def pseudo_op(name, op, real_ops): "JUMP_BACKWARD": { "counter": 1, }, + "UNARY_NOT": { + "counter": 1, + }, } _inline_cache_entries = [ diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 820a710e6df525..c18599a2fa0978 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -487,7 +487,7 @@ def _with(c): %3d >> PUSH_EXC_INFO WITH_EXCEPT_START UNARY_NOT - POP_JUMP_IF_FALSE 1 (to 44) + POP_JUMP_IF_FALSE 1 (to 46) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -567,7 +567,7 @@ async def _asyncwith(c): >> CLEANUP_THROW >> END_SEND UNARY_NOT - POP_JUMP_IF_FALSE 1 (to 110) + POP_JUMP_IF_FALSE 1 (to 112) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -1661,7 +1661,7 @@ def _prepare_test_cases(): Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', offset=12, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=14, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=22, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='FOR_ITER', opcode=93, arg=30, argval=88, argrepr='to 88', offset=24, starts_line=None, is_jump_target=True, positions=None), + Instruction(opname='FOR_ITER', opcode=93, arg=32, argval=92, argrepr='to 92', offset=24, starts_line=None, is_jump_target=True, positions=None), Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=28, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=30, starts_line=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=40, starts_line=None, is_jump_target=False, positions=None), @@ -1671,111 +1671,111 @@ def _prepare_test_cases(): Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=54, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=56, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=68, argrepr='to 68', offset=62, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=22, argval=24, argrepr='to 24', offset=64, starts_line=6, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=68, starts_line=7, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=70, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=72, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=76, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=84, argrepr='to 84', offset=78, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=30, argval=24, argrepr='to 24', offset=80, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=84, starts_line=8, is_jump_target=True, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=12, argval=112, argrepr='to 112', offset=86, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='END_FOR', opcode=4, arg=None, argval=None, argrepr='', offset=88, starts_line=3, is_jump_target=True, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=90, starts_line=10, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=100, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=102, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=110, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=112, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=36, argval=190, argrepr='to 190', offset=116, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=118, starts_line=12, is_jump_target=True, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=128, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=130, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=138, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=140, starts_line=13, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=142, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=144, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=148, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=150, starts_line=14, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=152, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=154, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=158, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=166, argrepr='to 166', offset=160, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=27, argval=112, argrepr='to 112', offset=162, starts_line=15, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=166, starts_line=16, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=168, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=170, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=174, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=180, argrepr='to 180', offset=176, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=16, argval=212, argrepr='to 212', offset=178, starts_line=17, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=180, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=70, argrepr='to 70', offset=64, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=23, argval=24, argrepr='to 24', offset=66, starts_line=6, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=70, starts_line=7, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=72, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=74, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=78, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=88, argrepr='to 88', offset=82, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=32, argval=24, argrepr='to 24', offset=84, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=88, starts_line=8, is_jump_target=True, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=12, argval=116, argrepr='to 116', offset=90, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='END_FOR', opcode=4, arg=None, argval=None, argrepr='', offset=92, starts_line=3, is_jump_target=True, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=94, starts_line=10, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=104, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=106, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=116, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=118, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=39, argval=202, argrepr='to 202', offset=122, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=124, starts_line=12, is_jump_target=True, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=134, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=136, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=144, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=146, starts_line=13, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=148, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=150, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=154, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=156, starts_line=14, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=158, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=160, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=164, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=174, argrepr='to 174', offset=168, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=29, argval=116, argrepr='to 116', offset=170, starts_line=15, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=174, starts_line=16, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=176, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=178, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=182, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=190, argrepr='to 190', offset=184, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=36, argval=118, argrepr='to 118', offset=186, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=190, starts_line=19, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=200, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=202, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=210, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=212, starts_line=20, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=214, starts_line=21, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=216, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=218, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=190, argrepr='to 190', offset=186, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=17, argval=224, argrepr='to 224', offset=188, starts_line=17, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=190, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=192, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=202, argrepr='to 202', offset=196, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=39, argval=124, argrepr='to 124', offset=198, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=202, starts_line=19, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=212, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=214, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=222, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=224, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=226, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=228, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=230, starts_line=26, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=240, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=242, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=250, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=252, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=254, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=256, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=258, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=266, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=268, starts_line=28, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=278, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=280, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=288, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=290, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=292, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=294, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=296, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=302, argrepr='to 302', offset=298, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=300, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=302, starts_line=None, is_jump_target=True, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=304, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=306, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=308, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=23, argval=268, argrepr='to 268', offset=310, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=314, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=316, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=318, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=320, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=322, starts_line=22, is_jump_target=False, positions=None), - Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=332, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=366, argrepr='to 366', offset=334, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=336, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=338, starts_line=23, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=348, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=350, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=358, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=360, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=49, argval=268, argrepr='to 268', offset=362, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=366, starts_line=22, is_jump_target=True, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=368, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=370, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=372, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=374, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=376, starts_line=28, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=386, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=388, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=396, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=398, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=400, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=402, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=404, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=224, starts_line=20, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=226, starts_line=21, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=228, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=230, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=234, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=236, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=238, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=240, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=242, starts_line=26, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=252, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=254, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=262, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=264, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=266, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=268, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=270, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=278, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=280, starts_line=28, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=290, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=292, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=300, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=302, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=304, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=306, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=308, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=316, argrepr='to 316', offset=312, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=314, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=316, starts_line=None, is_jump_target=True, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=318, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=320, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=322, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=24, argval=280, argrepr='to 280', offset=324, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=328, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=330, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=332, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=334, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=336, starts_line=22, is_jump_target=False, positions=None), + Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=346, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=380, argrepr='to 380', offset=348, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=350, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=352, starts_line=23, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=362, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=364, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=372, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=374, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=50, argval=280, argrepr='to 280', offset=376, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=380, starts_line=22, is_jump_target=True, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=382, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=384, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=386, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=388, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=390, starts_line=28, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=400, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=402, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=410, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=412, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=414, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=416, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=418, starts_line=None, is_jump_target=False, positions=None), ] # One last piece of inspect fodder to check the default line number handling diff --git a/Python/bytecodes.c b/Python/bytecodes.c index cf0187168cd9d6..842a396fda739f 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -260,7 +260,26 @@ dummy_func( ERROR_IF(res == NULL, error); } - inst(UNARY_NOT, (value -- res)) { + family(unary_not, INLINE_CACHE_ENTRIES_UNARY_NOT) = { + UNARY_NOT, + UNARY_NOT_BOOL, + UNARY_NOT_INT, + UNARY_NOT_LIST, + UNARY_NOT_NONE, + UNARY_NOT_STR, + }; + + inst(UNARY_NOT, (unused/1, value -- res)) { + #if ENABLE_SPECIALIZATION + _PyUnaryNotCache *cache = (_PyUnaryNotCache *)next_instr; + if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { + next_instr--; + _Py_Specialize_UnaryNot(value, next_instr); + DISPATCH_SAME_OPARG(); + } + STAT_INC(UNARY_NOT, deferred); + DECREMENT_ADAPTIVE_COUNTER(cache->counter); + #endif /* ENABLE_SPECIALIZATION */ int err = PyObject_IsTrue(value); DECREF_INPUTS(); ERROR_IF(err < 0, error); @@ -272,6 +291,63 @@ dummy_func( } } + inst(UNARY_NOT_BOOL, (unused/1, value -- res)) { + DEOPT_IF(!PyBool_Check(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (Py_IsFalse(value)) { + res = Py_True; + } + else { + res = Py_False; + } + } + + inst(UNARY_NOT_INT, (unused/1, value -- res)) { + DEOPT_IF(!PyLong_CheckExact(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (_PyLong_IsZero((PyLongObject *)value)) { + assert(_Py_IsImmortal(value)); + res = Py_True; + } + else { + DECREF_INPUTS(); + res = Py_False; + } + } + + inst(UNARY_NOT_LIST, (unused/1, value -- res)) { + DEOPT_IF(!PyList_CheckExact(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (!Py_SIZE(value)) { + res = Py_True; + } + else { + res = Py_False; + } + DECREF_INPUTS(); + } + + inst(UNARY_NOT_NONE, (unused/1, value -- res)) { + // This one is a bit weird, because we expect *some* failures: + DEOPT_IF(!Py_IsNone(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + res = Py_True; + } + + inst(UNARY_NOT_STR, (unused/1, value -- res)) { + DEOPT_IF(!PyUnicode_CheckExact(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (Py_Is(value, &_Py_STR(empty))) { + assert(_Py_IsImmortal(value)); + res = Py_True; + } + else { + assert(Py_SIZE(value)); + DECREF_INPUTS(); + res = Py_False; + } + } + inst(UNARY_INVERT, (value -- res)) { res = PyNumber_Invert(value); DECREF_INPUTS(); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index f3fbb905bfbc3d..28a97d56e1b457 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -351,13 +351,25 @@ } TARGET(UNARY_NOT) { + PREDICTED(UNARY_NOT); + static_assert(INLINE_CACHE_ENTRIES_UNARY_NOT == 1, "incorrect cache size"); PyObject *value = stack_pointer[-1]; PyObject *res; - #line 264 "Python/bytecodes.c" + #line 273 "Python/bytecodes.c" + #if ENABLE_SPECIALIZATION + _PyUnaryNotCache *cache = (_PyUnaryNotCache *)next_instr; + if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { + next_instr--; + _Py_Specialize_UnaryNot(value, next_instr); + DISPATCH_SAME_OPARG(); + } + STAT_INC(UNARY_NOT, deferred); + DECREMENT_ADAPTIVE_COUNTER(cache->counter); + #endif /* ENABLE_SPECIALIZATION */ int err = PyObject_IsTrue(value); - #line 359 "Python/generated_cases.c.h" + #line 371 "Python/generated_cases.c.h" Py_DECREF(value); - #line 266 "Python/bytecodes.c" + #line 285 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { res = Py_True; @@ -365,21 +377,118 @@ else { res = Py_False; } - #line 369 "Python/generated_cases.c.h" + #line 381 "Python/generated_cases.c.h" + stack_pointer[-1] = res; + next_instr += 1; + DISPATCH(); + } + + TARGET(UNARY_NOT_BOOL) { + PyObject *value = stack_pointer[-1]; + PyObject *res; + #line 295 "Python/bytecodes.c" + DEOPT_IF(!PyBool_Check(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (Py_IsFalse(value)) { + res = Py_True; + } + else { + res = Py_False; + } + #line 399 "Python/generated_cases.c.h" + stack_pointer[-1] = res; + next_instr += 1; + DISPATCH(); + } + + TARGET(UNARY_NOT_INT) { + PyObject *value = stack_pointer[-1]; + PyObject *res; + #line 306 "Python/bytecodes.c" + DEOPT_IF(!PyLong_CheckExact(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (_PyLong_IsZero((PyLongObject *)value)) { + assert(_Py_IsImmortal(value)); + res = Py_True; + } + else { + #line 416 "Python/generated_cases.c.h" + Py_DECREF(value); + #line 314 "Python/bytecodes.c" + res = Py_False; + } + #line 421 "Python/generated_cases.c.h" + stack_pointer[-1] = res; + next_instr += 1; + DISPATCH(); + } + + TARGET(UNARY_NOT_LIST) { + PyObject *value = stack_pointer[-1]; + PyObject *res; + #line 319 "Python/bytecodes.c" + DEOPT_IF(!PyList_CheckExact(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (!Py_SIZE(value)) { + res = Py_True; + } + else { + res = Py_False; + } + #line 439 "Python/generated_cases.c.h" + Py_DECREF(value); + stack_pointer[-1] = res; + next_instr += 1; + DISPATCH(); + } + + TARGET(UNARY_NOT_NONE) { + PyObject *value = stack_pointer[-1]; + PyObject *res; + #line 331 "Python/bytecodes.c" + // This one is a bit weird, because we expect *some* failures: + DEOPT_IF(!Py_IsNone(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + res = Py_True; + #line 454 "Python/generated_cases.c.h" + stack_pointer[-1] = res; + next_instr += 1; + DISPATCH(); + } + + TARGET(UNARY_NOT_STR) { + PyObject *value = stack_pointer[-1]; + PyObject *res; + #line 338 "Python/bytecodes.c" + DEOPT_IF(!PyUnicode_CheckExact(value), UNARY_NOT); + STAT_INC(UNARY_NOT, hit); + if (Py_Is(value, &_Py_STR(empty))) { + assert(_Py_IsImmortal(value)); + res = Py_True; + } + else { + assert(Py_SIZE(value)); + #line 472 "Python/generated_cases.c.h" + Py_DECREF(value); + #line 347 "Python/bytecodes.c" + res = Py_False; + } + #line 477 "Python/generated_cases.c.h" stack_pointer[-1] = res; + next_instr += 1; DISPATCH(); } TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 276 "Python/bytecodes.c" + #line 352 "Python/bytecodes.c" res = PyNumber_Invert(value); - #line 379 "Python/generated_cases.c.h" + #line 488 "Python/generated_cases.c.h" Py_DECREF(value); - #line 278 "Python/bytecodes.c" + #line 354 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 383 "Python/generated_cases.c.h" + #line 492 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -390,10 +499,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 294 "Python/bytecodes.c" + #line 370 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 397 "Python/generated_cases.c.h" + #line 506 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -401,13 +510,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 299 "Python/bytecodes.c" + #line 375 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 411 "Python/generated_cases.c.h" + #line 520 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -422,10 +531,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 294 "Python/bytecodes.c" + #line 370 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 429 "Python/generated_cases.c.h" + #line 538 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -433,13 +542,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 307 "Python/bytecodes.c" + #line 383 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 443 "Python/generated_cases.c.h" + #line 552 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -454,10 +563,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 294 "Python/bytecodes.c" + #line 370 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 461 "Python/generated_cases.c.h" + #line 570 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -465,13 +574,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 315 "Python/bytecodes.c" + #line 391 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 475 "Python/generated_cases.c.h" + #line 584 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -486,10 +595,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 330 "Python/bytecodes.c" + #line 406 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 493 "Python/generated_cases.c.h" + #line 602 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -497,13 +606,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 335 "Python/bytecodes.c" + #line 411 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 507 "Python/generated_cases.c.h" + #line 616 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -518,10 +627,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 330 "Python/bytecodes.c" + #line 406 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 525 "Python/generated_cases.c.h" + #line 634 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -529,13 +638,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 343 "Python/bytecodes.c" + #line 419 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 539 "Python/generated_cases.c.h" + #line 648 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -550,10 +659,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 330 "Python/bytecodes.c" + #line 406 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 557 "Python/generated_cases.c.h" + #line 666 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -561,13 +670,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 351 "Python/bytecodes.c" + #line 427 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 571 "Python/generated_cases.c.h" + #line 680 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -582,10 +691,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 366 "Python/bytecodes.c" + #line 442 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 589 "Python/generated_cases.c.h" + #line 698 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -593,13 +702,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 371 "Python/bytecodes.c" + #line 447 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; - #line 603 "Python/generated_cases.c.h" + #line 712 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -614,17 +723,17 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 366 "Python/bytecodes.c" + #line 442 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 621 "Python/generated_cases.c.h" + #line 730 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 388 "Python/bytecodes.c" + #line 464 "Python/bytecodes.c" _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; assert(true_next.op.code == STORE_FAST || true_next.op.code == STORE_FAST__LOAD_FAST); @@ -649,7 +758,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1); - #line 653 "Python/generated_cases.c.h" + #line 762 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -661,7 +770,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 426 "Python/bytecodes.c" + #line 502 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -673,12 +782,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); - #line 677 "Python/generated_cases.c.h" + #line 786 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 438 "Python/bytecodes.c" + #line 514 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 682 "Python/generated_cases.c.h" + #line 791 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -690,7 +799,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 442 "Python/bytecodes.c" + #line 518 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -703,7 +812,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; - #line 707 "Python/generated_cases.c.h" + #line 816 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -714,7 +823,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 457 "Python/bytecodes.c" + #line 533 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -727,7 +836,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; - #line 731 "Python/generated_cases.c.h" + #line 840 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -736,7 +845,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 472 "Python/bytecodes.c" + #line 548 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -750,7 +859,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 754 "Python/generated_cases.c.h" + #line 863 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -761,7 +870,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 488 "Python/bytecodes.c" + #line 564 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -775,7 +884,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); - #line 779 "Python/generated_cases.c.h" + #line 888 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -786,7 +895,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 504 "Python/bytecodes.c" + #line 580 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -794,14 +903,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } - #line 798 "Python/generated_cases.c.h" + #line 907 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 512 "Python/bytecodes.c" + #line 588 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub - #line 805 "Python/generated_cases.c.h" + #line 914 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -813,7 +922,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 519 "Python/bytecodes.c" + #line 595 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -836,15 +945,15 @@ JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 840 "Python/generated_cases.c.h" + #line 949 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 544 "Python/bytecodes.c" + #line 620 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; - #line 848 "Python/generated_cases.c.h" + #line 957 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -853,13 +962,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 549 "Python/bytecodes.c" + #line 625 "Python/bytecodes.c" int err = PySet_Add(set, v); - #line 859 "Python/generated_cases.c.h" + #line 968 "Python/generated_cases.c.h" Py_DECREF(v); - #line 551 "Python/bytecodes.c" + #line 627 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 863 "Python/generated_cases.c.h" + #line 972 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -872,7 +981,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 562 "Python/bytecodes.c" + #line 638 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -887,13 +996,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); - #line 891 "Python/generated_cases.c.h" + #line 1000 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 577 "Python/bytecodes.c" + #line 653 "Python/bytecodes.c" if (err) goto pop_3_error; - #line 897 "Python/generated_cases.c.h" + #line 1006 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -903,7 +1012,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 581 "Python/bytecodes.c" + #line 657 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -920,7 +1029,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 924 "Python/generated_cases.c.h" + #line 1033 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -930,13 +1039,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 600 "Python/bytecodes.c" + #line 676 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; - #line 940 "Python/generated_cases.c.h" + #line 1049 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -945,15 +1054,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 608 "Python/bytecodes.c" + #line 684 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); - #line 952 "Python/generated_cases.c.h" + #line 1061 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 611 "Python/bytecodes.c" + #line 687 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 957 "Python/generated_cases.c.h" + #line 1066 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -961,14 +1070,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 615 "Python/bytecodes.c" + #line 691 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); - #line 968 "Python/generated_cases.c.h" + #line 1077 "Python/generated_cases.c.h" Py_DECREF(value); - #line 618 "Python/bytecodes.c" + #line 694 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 972 "Python/generated_cases.c.h" + #line 1081 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -977,15 +1086,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 622 "Python/bytecodes.c" + #line 698 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); - #line 984 "Python/generated_cases.c.h" + #line 1093 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 625 "Python/bytecodes.c" + #line 701 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 989 "Python/generated_cases.c.h" + #line 1098 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -993,7 +1102,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 629 "Python/bytecodes.c" + #line 705 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -1011,12 +1120,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } - #line 1015 "Python/generated_cases.c.h" + #line 1124 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 649 "Python/bytecodes.c" + #line 725 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); STACK_SHRINK(1); // Since we're not going to DISPATCH() @@ -1027,12 +1136,12 @@ assert(!_PyErr_Occurred(tstate)); _Py_LeaveRecursiveCallTstate(tstate); return retval; - #line 1031 "Python/generated_cases.c.h" + #line 1140 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 662 "Python/bytecodes.c" + #line 738 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1045,12 +1154,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1049 "Python/generated_cases.c.h" + #line 1158 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 677 "Python/bytecodes.c" + #line 753 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1067,11 +1176,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1071 "Python/generated_cases.c.h" + #line 1180 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 696 "Python/bytecodes.c" + #line 772 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1085,11 +1194,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1089 "Python/generated_cases.c.h" + #line 1198 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 712 "Python/bytecodes.c" + #line 788 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1107,13 +1216,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1111 "Python/generated_cases.c.h" + #line 1220 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 732 "Python/bytecodes.c" + #line 808 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1126,16 +1235,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1130 "Python/generated_cases.c.h" + #line 1239 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 745 "Python/bytecodes.c" + #line 821 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1137 "Python/generated_cases.c.h" + #line 1246 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 750 "Python/bytecodes.c" + #line 826 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1148,7 +1257,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1152 "Python/generated_cases.c.h" + #line 1261 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1156,7 +1265,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 765 "Python/bytecodes.c" + #line 841 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1200,7 +1309,7 @@ } } - #line 1204 "Python/generated_cases.c.h" + #line 1313 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; PREDICT(LOAD_CONST); @@ -1211,16 +1320,16 @@ PREDICTED(GET_AWAITABLE); PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 812 "Python/bytecodes.c" + #line 888 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1222 "Python/generated_cases.c.h" + #line 1331 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 819 "Python/bytecodes.c" + #line 895 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1238,7 +1347,7 @@ if (iter == NULL) goto pop_1_error; - #line 1242 "Python/generated_cases.c.h" + #line 1351 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -1250,7 +1359,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 845 "Python/bytecodes.c" + #line 921 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1297,7 +1406,7 @@ } } Py_DECREF(v); - #line 1301 "Python/generated_cases.c.h" + #line 1410 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1306,7 +1415,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 894 "Python/bytecodes.c" + #line 970 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1322,12 +1431,12 @@ tstate->exc_info = &gen->gi_exc_state; JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1326 "Python/generated_cases.c.h" + #line 1435 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 912 "Python/bytecodes.c" + #line 988 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1344,12 +1453,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1348 "Python/generated_cases.c.h" + #line 1457 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 931 "Python/bytecodes.c" + #line 1007 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1365,15 +1474,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1369 "Python/generated_cases.c.h" + #line 1478 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 949 "Python/bytecodes.c" + #line 1025 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1377 "Python/generated_cases.c.h" + #line 1486 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1381,7 +1490,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 954 "Python/bytecodes.c" + #line 1030 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1399,26 +1508,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1403 "Python/generated_cases.c.h" + #line 1512 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 974 "Python/bytecodes.c" + #line 1050 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1412 "Python/generated_cases.c.h" + #line 1521 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 977 "Python/bytecodes.c" + #line 1053 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1422 "Python/generated_cases.c.h" + #line 1531 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1429,23 +1538,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 986 "Python/bytecodes.c" + #line 1062 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1438 "Python/generated_cases.c.h" + #line 1547 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 991 "Python/bytecodes.c" + #line 1067 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1449 "Python/generated_cases.c.h" + #line 1558 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1454,9 +1563,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1000 "Python/bytecodes.c" + #line 1076 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1460 "Python/generated_cases.c.h" + #line 1569 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1464,7 +1573,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1004 "Python/bytecodes.c" + #line 1080 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1486,7 +1595,7 @@ if (true) goto error; } } - #line 1490 "Python/generated_cases.c.h" + #line 1599 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1494,33 +1603,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1029 "Python/bytecodes.c" + #line 1105 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1505 "Python/generated_cases.c.h" + #line 1614 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1036 "Python/bytecodes.c" + #line 1112 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1514 "Python/generated_cases.c.h" + #line 1623 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1043 "Python/bytecodes.c" + #line 1119 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1518 "Python/generated_cases.c.h" + #line 1627 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1047 "Python/bytecodes.c" + #line 1123 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1537,7 +1646,7 @@ name); goto error; } - #line 1541 "Python/generated_cases.c.h" + #line 1650 "Python/generated_cases.c.h" DISPATCH(); } @@ -1545,7 +1654,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1073 "Python/bytecodes.c" + #line 1149 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1558,11 +1667,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1562 "Python/generated_cases.c.h" + #line 1671 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1086 "Python/bytecodes.c" + #line 1162 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1566 "Python/generated_cases.c.h" + #line 1675 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1572,14 +1681,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1090 "Python/bytecodes.c" + #line 1166 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1583 "Python/generated_cases.c.h" + #line 1692 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1590,7 +1699,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1100 "Python/bytecodes.c" + #line 1176 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1598,7 +1707,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1602 "Python/generated_cases.c.h" + #line 1711 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1609,7 +1718,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1111 "Python/bytecodes.c" + #line 1187 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1617,7 +1726,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1621 "Python/generated_cases.c.h" + #line 1730 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1627,15 +1736,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1122 "Python/bytecodes.c" + #line 1198 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); - #line 1635 "Python/generated_cases.c.h" + #line 1744 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1126 "Python/bytecodes.c" + #line 1202 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1639 "Python/generated_cases.c.h" + #line 1748 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1646,7 +1755,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1137 "Python/bytecodes.c" + #line 1213 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1662,12 +1771,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1666 "Python/generated_cases.c.h" + #line 1775 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1153 "Python/bytecodes.c" + #line 1229 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1671 "Python/generated_cases.c.h" + #line 1780 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1675,34 +1784,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1157 "Python/bytecodes.c" + #line 1233 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1682 "Python/generated_cases.c.h" + #line 1791 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1160 "Python/bytecodes.c" + #line 1236 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1686 "Python/generated_cases.c.h" + #line 1795 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1164 "Python/bytecodes.c" + #line 1240 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1696 "Python/generated_cases.c.h" + #line 1805 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1167 "Python/bytecodes.c" + #line 1243 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1700 "Python/generated_cases.c.h" + #line 1809 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1171 "Python/bytecodes.c" + #line 1247 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1714,7 +1823,7 @@ } goto error; } - #line 1718 "Python/generated_cases.c.h" + #line 1827 "Python/generated_cases.c.h" DISPATCH(); } @@ -1722,7 +1831,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1185 "Python/bytecodes.c" + #line 1261 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1730,7 +1839,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1734 "Python/generated_cases.c.h" + #line 1843 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1742,7 +1851,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1185 "Python/bytecodes.c" + #line 1261 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1750,13 +1859,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1754 "Python/generated_cases.c.h" + #line 1863 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1197 "Python/bytecodes.c" + #line 1273 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1813,7 +1922,7 @@ } } } - #line 1817 "Python/generated_cases.c.h" + #line 1926 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1826,7 +1935,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1197 "Python/bytecodes.c" + #line 1273 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1883,7 +1992,7 @@ } } } - #line 1887 "Python/generated_cases.c.h" + #line 1996 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1895,7 +2004,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1266 "Python/bytecodes.c" + #line 1342 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1947,7 +2056,7 @@ } } null = NULL; - #line 1951 "Python/generated_cases.c.h" + #line 2060 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1961,7 +2070,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1320 "Python/bytecodes.c" + #line 1396 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1972,7 +2081,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1976 "Python/generated_cases.c.h" + #line 2085 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1987,7 +2096,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1333 "Python/bytecodes.c" + #line 1409 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -2002,7 +2111,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2006 "Python/generated_cases.c.h" + #line 2115 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2012,16 +2121,16 @@ } TARGET(DELETE_FAST) { - #line 1350 "Python/bytecodes.c" + #line 1426 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 2020 "Python/generated_cases.c.h" + #line 2129 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1356 "Python/bytecodes.c" + #line 1432 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -2030,12 +2139,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2034 "Python/generated_cases.c.h" + #line 2143 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1367 "Python/bytecodes.c" + #line 1443 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2046,14 +2155,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2050 "Python/generated_cases.c.h" + #line 2159 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1380 "Python/bytecodes.c" + #line 1456 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -2088,14 +2197,14 @@ } Py_INCREF(value); } - #line 2092 "Python/generated_cases.c.h" + #line 2201 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1417 "Python/bytecodes.c" + #line 1493 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2103,7 +2212,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2107 "Python/generated_cases.c.h" + #line 2216 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2111,18 +2220,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1427 "Python/bytecodes.c" + #line 1503 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2120 "Python/generated_cases.c.h" + #line 2229 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1434 "Python/bytecodes.c" + #line 1510 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -2133,22 +2242,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2137 "Python/generated_cases.c.h" + #line 2246 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1447 "Python/bytecodes.c" + #line 1523 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2146 "Python/generated_cases.c.h" + #line 2255 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1449 "Python/bytecodes.c" + #line 1525 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2152 "Python/generated_cases.c.h" + #line 2261 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2158,10 +2267,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1453 "Python/bytecodes.c" + #line 1529 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2165 "Python/generated_cases.c.h" + #line 2274 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2171,10 +2280,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1458 "Python/bytecodes.c" + #line 1534 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2178 "Python/generated_cases.c.h" + #line 2287 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2184,7 +2293,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1463 "Python/bytecodes.c" + #line 1539 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2195,13 +2304,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2199 "Python/generated_cases.c.h" + #line 2308 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1474 "Python/bytecodes.c" + #line 1550 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2205 "Python/generated_cases.c.h" + #line 2314 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2210,13 +2319,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1481 "Python/bytecodes.c" + #line 1557 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2216 "Python/generated_cases.c.h" + #line 2325 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1483 "Python/bytecodes.c" + #line 1559 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2220 "Python/generated_cases.c.h" + #line 2329 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2224,7 +2333,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1487 "Python/bytecodes.c" + #line 1563 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2239,7 +2348,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2243 "Python/generated_cases.c.h" + #line 2352 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2249,7 +2358,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1504 "Python/bytecodes.c" + #line 1580 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2257,13 +2366,13 @@ if (map == NULL) goto error; - #line 2261 "Python/generated_cases.c.h" + #line 2370 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1512 "Python/bytecodes.c" + #line 1588 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2267 "Python/generated_cases.c.h" + #line 2376 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2271,7 +2380,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1516 "Python/bytecodes.c" + #line 1592 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2311,7 +2420,7 @@ Py_DECREF(ann_dict); } } - #line 2315 "Python/generated_cases.c.h" + #line 2424 "Python/generated_cases.c.h" DISPATCH(); } @@ -2319,7 +2428,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1558 "Python/bytecodes.c" + #line 1634 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2329,14 +2438,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2333 "Python/generated_cases.c.h" + #line 2442 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1568 "Python/bytecodes.c" + #line 1644 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2340 "Python/generated_cases.c.h" + #line 2449 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2344,7 +2453,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1572 "Python/bytecodes.c" + #line 1648 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -2352,12 +2461,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2356 "Python/generated_cases.c.h" + #line 2465 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1580 "Python/bytecodes.c" + #line 1656 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2361 "Python/generated_cases.c.h" + #line 2470 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2365,17 +2474,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1586 "Python/bytecodes.c" + #line 1662 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (_PyDict_MergeEx(dict, update, 2) < 0) { format_kwargs_error(tstate, PEEK(3 + oparg), update); - #line 2374 "Python/generated_cases.c.h" + #line 2483 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1591 "Python/bytecodes.c" + #line 1667 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2379 "Python/generated_cases.c.h" + #line 2488 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2385,26 +2494,26 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1598 "Python/bytecodes.c" + #line 1674 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2395 "Python/generated_cases.c.h" + #line 2504 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1607 "Python/bytecodes.c" + #line 1683 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); - #line 2408 "Python/generated_cases.c.h" + #line 2517 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2415,7 +2524,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1621 "Python/bytecodes.c" + #line 1697 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2457,16 +2566,16 @@ } } } - #line 2461 "Python/generated_cases.c.h" + #line 2570 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1663 "Python/bytecodes.c" + #line 1739 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; - #line 2470 "Python/generated_cases.c.h" + #line 2579 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2481,20 +2590,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1670 "Python/bytecodes.c" + #line 1746 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2492 "Python/generated_cases.c.h" + #line 2601 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1677 "Python/bytecodes.c" + #line 1753 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2498 "Python/generated_cases.c.h" + #line 2607 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2509,7 +2618,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1681 "Python/bytecodes.c" + #line 1757 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2532,7 +2641,7 @@ res = res2; res2 = NULL; } - #line 2536 "Python/generated_cases.c.h" + #line 2645 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2546,7 +2655,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1720 "Python/bytecodes.c" + #line 1796 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2580,9 +2689,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2584 "Python/generated_cases.c.h" + #line 2693 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1754 "Python/bytecodes.c" + #line 1830 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2591,12 +2700,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2595 "Python/generated_cases.c.h" + #line 2704 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1763 "Python/bytecodes.c" + #line 1839 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2600 "Python/generated_cases.c.h" + #line 2709 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2610,7 +2719,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1768 "Python/bytecodes.c" + #line 1844 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2623,7 +2732,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2627 "Python/generated_cases.c.h" + #line 2736 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2638,7 +2747,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1784 "Python/bytecodes.c" + #line 1860 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2651,7 +2760,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2655 "Python/generated_cases.c.h" + #line 2764 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2666,7 +2775,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1800 "Python/bytecodes.c" + #line 1876 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2693,7 +2802,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2697 "Python/generated_cases.c.h" + #line 2806 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2708,7 +2817,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1830 "Python/bytecodes.c" + #line 1906 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2718,7 +2827,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2722 "Python/generated_cases.c.h" + #line 2831 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2733,7 +2842,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1843 "Python/bytecodes.c" + #line 1919 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2745,7 +2854,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2749 "Python/generated_cases.c.h" + #line 2858 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2759,7 +2868,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1858 "Python/bytecodes.c" + #line 1934 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2783,7 +2892,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2787 "Python/generated_cases.c.h" + #line 2896 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2791,7 +2900,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 1884 "Python/bytecodes.c" + #line 1960 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2817,7 +2926,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2821 "Python/generated_cases.c.h" + #line 2930 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2825,7 +2934,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1912 "Python/bytecodes.c" + #line 1988 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2843,7 +2952,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2847 "Python/generated_cases.c.h" + #line 2956 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2854,7 +2963,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 1932 "Python/bytecodes.c" + #line 2008 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2893,7 +3002,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2897 "Python/generated_cases.c.h" + #line 3006 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2904,7 +3013,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1973 "Python/bytecodes.c" + #line 2049 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2914,7 +3023,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2918 "Python/generated_cases.c.h" + #line 3027 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2926,7 +3035,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1992 "Python/bytecodes.c" + #line 2068 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2939,12 +3048,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2943 "Python/generated_cases.c.h" + #line 3052 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2005 "Python/bytecodes.c" + #line 2081 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2948 "Python/generated_cases.c.h" + #line 3057 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2955,7 +3064,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2009 "Python/bytecodes.c" + #line 2085 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2966,7 +3075,7 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2970 "Python/generated_cases.c.h" + #line 3079 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2977,7 +3086,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2023 "Python/bytecodes.c" + #line 2099 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -2992,7 +3101,7 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2996 "Python/generated_cases.c.h" + #line 3105 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3003,7 +3112,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2041 "Python/bytecodes.c" + #line 2117 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3015,7 +3124,7 @@ assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS); assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; - #line 3019 "Python/generated_cases.c.h" + #line 3128 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3026,14 +3135,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2055 "Python/bytecodes.c" + #line 2131 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3032 "Python/generated_cases.c.h" + #line 3141 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2057 "Python/bytecodes.c" + #line 2133 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3037 "Python/generated_cases.c.h" + #line 3146 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3043,15 +3152,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2061 "Python/bytecodes.c" + #line 2137 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3049 "Python/generated_cases.c.h" + #line 3158 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2063 "Python/bytecodes.c" + #line 2139 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3055 "Python/generated_cases.c.h" + #line 3164 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3062,12 +3171,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2068 "Python/bytecodes.c" + #line 2144 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3068 "Python/generated_cases.c.h" + #line 3177 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2070 "Python/bytecodes.c" + #line 2146 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3075,10 +3184,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3079 "Python/generated_cases.c.h" + #line 3188 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2078 "Python/bytecodes.c" + #line 2154 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3087,7 +3196,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3091 "Python/generated_cases.c.h" + #line 3200 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3097,21 +3206,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2089 "Python/bytecodes.c" + #line 2165 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3104 "Python/generated_cases.c.h" + #line 3213 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2092 "Python/bytecodes.c" + #line 2168 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3111 "Python/generated_cases.c.h" + #line 3220 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2097 "Python/bytecodes.c" + #line 2173 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3115 "Python/generated_cases.c.h" + #line 3224 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3120,15 +3229,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2101 "Python/bytecodes.c" + #line 2177 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3127 "Python/generated_cases.c.h" + #line 3236 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2104 "Python/bytecodes.c" + #line 2180 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3132 "Python/generated_cases.c.h" + #line 3241 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3137,26 +3246,26 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2108 "Python/bytecodes.c" + #line 2184 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3145 "Python/generated_cases.c.h" + #line 3254 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2114 "Python/bytecodes.c" + #line 2190 "Python/bytecodes.c" JUMPBY(oparg); - #line 3154 "Python/generated_cases.c.h" + #line 3263 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2118 "Python/bytecodes.c" + #line 2194 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3173,13 +3282,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3177 "Python/generated_cases.c.h" + #line 3286 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2138 "Python/bytecodes.c" + #line 2214 "Python/bytecodes.c" _PyExecutorObject *executor = (_PyExecutorObject *)frame->f_code->co_executors->executors[oparg]; Py_INCREF(executor); frame = executor->execute(executor, frame, stack_pointer); @@ -3188,86 +3297,86 @@ goto error; } goto resume_frame; - #line 3192 "Python/generated_cases.c.h" + #line 3301 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2149 "Python/bytecodes.c" + #line 2225 "Python/bytecodes.c" assert(PyBool_Check(cond)); if (Py_IsFalse(cond)) { JUMPBY(oparg); } - #line 3203 "Python/generated_cases.c.h" + #line 3312 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2156 "Python/bytecodes.c" + #line 2232 "Python/bytecodes.c" assert(PyBool_Check(cond)); if (Py_IsTrue(cond)) { JUMPBY(oparg); } - #line 3215 "Python/generated_cases.c.h" + #line 3324 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2163 "Python/bytecodes.c" + #line 2239 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3224 "Python/generated_cases.c.h" + #line 3333 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2165 "Python/bytecodes.c" + #line 2241 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3229 "Python/generated_cases.c.h" + #line 3338 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2170 "Python/bytecodes.c" + #line 2246 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3241 "Python/generated_cases.c.h" + #line 3350 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2175 "Python/bytecodes.c" + #line 2251 "Python/bytecodes.c" } - #line 3245 "Python/generated_cases.c.h" + #line 3354 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2179 "Python/bytecodes.c" + #line 2255 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3258 "Python/generated_cases.c.h" + #line 3367 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2188 "Python/bytecodes.c" + #line 2264 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3271 "Python/generated_cases.c.h" + #line 3380 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3278,16 +3387,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2196 "Python/bytecodes.c" + #line 2272 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3287 "Python/generated_cases.c.h" + #line 3396 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2201 "Python/bytecodes.c" + #line 2277 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3295,7 +3404,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3299 "Python/generated_cases.c.h" + #line 3408 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3304,10 +3413,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2211 "Python/bytecodes.c" + #line 2287 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3311 "Python/generated_cases.c.h" + #line 3420 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3317,10 +3426,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2217 "Python/bytecodes.c" + #line 2293 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3324 "Python/generated_cases.c.h" + #line 3433 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3331,11 +3440,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2223 "Python/bytecodes.c" + #line 2299 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3339 "Python/generated_cases.c.h" + #line 3448 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3344,14 +3453,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2229 "Python/bytecodes.c" + #line 2305 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3351 "Python/generated_cases.c.h" + #line 3460 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2232 "Python/bytecodes.c" + #line 2308 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3355 "Python/generated_cases.c.h" + #line 3464 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3359,7 +3468,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2236 "Python/bytecodes.c" + #line 2312 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3382,11 +3491,11 @@ if (iter == NULL) { goto error; } - #line 3386 "Python/generated_cases.c.h" + #line 3495 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2259 "Python/bytecodes.c" + #line 2335 "Python/bytecodes.c" } - #line 3390 "Python/generated_cases.c.h" + #line 3499 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3397,7 +3506,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2278 "Python/bytecodes.c" + #line 2354 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3428,7 +3537,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3432 "Python/generated_cases.c.h" + #line 3541 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3436,7 +3545,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2311 "Python/bytecodes.c" + #line 2387 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3462,14 +3571,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3466 "Python/generated_cases.c.h" + #line 3575 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2339 "Python/bytecodes.c" + #line 2415 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3489,7 +3598,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3493 "Python/generated_cases.c.h" + #line 3602 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3499,7 +3608,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2361 "Python/bytecodes.c" + #line 2437 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3519,7 +3628,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3523 "Python/generated_cases.c.h" + #line 3632 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3529,7 +3638,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2383 "Python/bytecodes.c" + #line 2459 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3547,7 +3656,7 @@ if (next == NULL) { goto error; } - #line 3551 "Python/generated_cases.c.h" + #line 3660 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3556,7 +3665,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2403 "Python/bytecodes.c" + #line 2479 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3572,14 +3681,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3576 "Python/generated_cases.c.h" + #line 3685 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2421 "Python/bytecodes.c" + #line 2497 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3602,16 +3711,16 @@ Py_DECREF(enter); goto error; } - #line 3606 "Python/generated_cases.c.h" + #line 3715 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2444 "Python/bytecodes.c" + #line 2520 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3615 "Python/generated_cases.c.h" + #line 3724 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3623,7 +3732,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2454 "Python/bytecodes.c" + #line 2530 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3649,16 +3758,16 @@ Py_DECREF(enter); goto error; } - #line 3653 "Python/generated_cases.c.h" + #line 3762 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2480 "Python/bytecodes.c" + #line 2556 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3662 "Python/generated_cases.c.h" + #line 3771 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3670,7 +3779,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2489 "Python/bytecodes.c" + #line 2565 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3691,7 +3800,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3695 "Python/generated_cases.c.h" + #line 3804 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3700,7 +3809,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2512 "Python/bytecodes.c" + #line 2588 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3710,7 +3819,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3714 "Python/generated_cases.c.h" + #line 3823 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3724,7 +3833,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2524 "Python/bytecodes.c" + #line 2600 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3741,7 +3850,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3745 "Python/generated_cases.c.h" + #line 3854 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3755,7 +3864,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2543 "Python/bytecodes.c" + #line 2619 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3765,7 +3874,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3769 "Python/generated_cases.c.h" + #line 3878 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3779,7 +3888,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2555 "Python/bytecodes.c" + #line 2631 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3793,7 +3902,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3797 "Python/generated_cases.c.h" + #line 3906 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3802,16 +3911,16 @@ } TARGET(KW_NAMES) { - #line 2571 "Python/bytecodes.c" + #line 2647 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3810 "Python/generated_cases.c.h" + #line 3919 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2577 "Python/bytecodes.c" + #line 2653 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3824,7 +3933,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3828 "Python/generated_cases.c.h" + #line 3937 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3834,7 +3943,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2622 "Python/bytecodes.c" + #line 2698 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3916,7 +4025,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3920 "Python/generated_cases.c.h" + #line 4029 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3928,7 +4037,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2710 "Python/bytecodes.c" + #line 2786 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3938,7 +4047,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3942 "Python/generated_cases.c.h" + #line 4051 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3947,7 +4056,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2722 "Python/bytecodes.c" + #line 2798 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3973,7 +4082,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3977 "Python/generated_cases.c.h" + #line 4086 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3981,7 +4090,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2750 "Python/bytecodes.c" + #line 2826 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4017,7 +4126,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4021 "Python/generated_cases.c.h" + #line 4130 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4025,7 +4134,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2788 "Python/bytecodes.c" + #line 2864 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4035,7 +4144,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4039 "Python/generated_cases.c.h" + #line 4148 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4048,7 +4157,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2800 "Python/bytecodes.c" + #line 2876 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4059,7 +4168,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4063 "Python/generated_cases.c.h" + #line 4172 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4073,7 +4182,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2814 "Python/bytecodes.c" + #line 2890 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4084,7 +4193,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4088 "Python/generated_cases.c.h" + #line 4197 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4098,7 +4207,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2828 "Python/bytecodes.c" + #line 2904 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4120,7 +4229,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4124 "Python/generated_cases.c.h" + #line 4233 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4134,7 +4243,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2853 "Python/bytecodes.c" + #line 2929 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4162,7 +4271,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4166 "Python/generated_cases.c.h" + #line 4275 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4176,7 +4285,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2884 "Python/bytecodes.c" + #line 2960 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4208,7 +4317,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4212 "Python/generated_cases.c.h" + #line 4321 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4222,7 +4331,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2919 "Python/bytecodes.c" + #line 2995 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4254,7 +4363,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4258 "Python/generated_cases.c.h" + #line 4367 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4268,7 +4377,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2954 "Python/bytecodes.c" + #line 3030 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4293,7 +4402,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4297 "Python/generated_cases.c.h" + #line 4406 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4306,7 +4415,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2981 "Python/bytecodes.c" + #line 3057 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4333,7 +4442,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4337 "Python/generated_cases.c.h" + #line 4446 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4345,7 +4454,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3011 "Python/bytecodes.c" + #line 3087 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4363,14 +4472,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4367 "Python/generated_cases.c.h" + #line 4476 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3031 "Python/bytecodes.c" + #line 3107 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4401,7 +4510,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4405 "Python/generated_cases.c.h" + #line 4514 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4414,7 +4523,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3065 "Python/bytecodes.c" + #line 3141 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4443,7 +4552,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4447 "Python/generated_cases.c.h" + #line 4556 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4456,7 +4565,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3097 "Python/bytecodes.c" + #line 3173 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4485,7 +4594,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4489 "Python/generated_cases.c.h" + #line 4598 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4498,7 +4607,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3129 "Python/bytecodes.c" + #line 3205 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4526,7 +4635,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4530 "Python/generated_cases.c.h" + #line 4639 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4536,9 +4645,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3160 "Python/bytecodes.c" + #line 3236 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4542 "Python/generated_cases.c.h" + #line 4651 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4547,7 +4656,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3164 "Python/bytecodes.c" + #line 3240 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4609,14 +4718,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4613 "Python/generated_cases.c.h" + #line 4722 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3226 "Python/bytecodes.c" + #line 3302 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4620 "Python/generated_cases.c.h" + #line 4729 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4631,7 +4740,7 @@ PyObject *kwdefaults = (oparg & MAKE_FUNCTION_KWDEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & MAKE_FUNCTION_DEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0))] : NULL; PyObject *func; - #line 3236 "Python/bytecodes.c" + #line 3312 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4660,14 +4769,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4664 "Python/generated_cases.c.h" + #line 4773 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3267 "Python/bytecodes.c" + #line 3343 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4688,7 +4797,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4692 "Python/generated_cases.c.h" + #line 4801 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4696,15 +4805,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3290 "Python/bytecodes.c" + #line 3366 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4702 "Python/generated_cases.c.h" + #line 4811 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3292 "Python/bytecodes.c" + #line 3368 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4708 "Python/generated_cases.c.h" + #line 4817 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4715,7 +4824,7 @@ PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? stack_pointer[-((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))] : NULL; PyObject *value = stack_pointer[-(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))]; PyObject *result; - #line 3296 "Python/bytecodes.c" + #line 3372 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4750,7 +4859,7 @@ Py_DECREF(value); Py_XDECREF(fmt_spec); if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - #line 4754 "Python/generated_cases.c.h" + #line 4863 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4759,10 +4868,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3333 "Python/bytecodes.c" + #line 3409 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4766 "Python/generated_cases.c.h" + #line 4875 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4774,7 +4883,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3338 "Python/bytecodes.c" + #line 3414 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4789,12 +4898,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4793 "Python/generated_cases.c.h" + #line 4902 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3353 "Python/bytecodes.c" + #line 3429 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4798 "Python/generated_cases.c.h" + #line 4907 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4804,16 +4913,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3358 "Python/bytecodes.c" + #line 3434 "Python/bytecodes.c" assert(oparg >= 2); - #line 4810 "Python/generated_cases.c.h" + #line 4919 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3362 "Python/bytecodes.c" + #line 3438 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4825,26 +4934,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4829 "Python/generated_cases.c.h" + #line 4938 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3376 "Python/bytecodes.c" + #line 3452 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4835 "Python/generated_cases.c.h" + #line 4944 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3380 "Python/bytecodes.c" + #line 3456 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4842 "Python/generated_cases.c.h" + #line 4951 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3385 "Python/bytecodes.c" + #line 3461 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4853,12 +4962,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4857 "Python/generated_cases.c.h" + #line 4966 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3396 "Python/bytecodes.c" + #line 3472 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4867,12 +4976,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4871 "Python/generated_cases.c.h" + #line 4980 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3407 "Python/bytecodes.c" + #line 3483 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4884,12 +4993,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4888 "Python/generated_cases.c.h" + #line 4997 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3421 "Python/bytecodes.c" + #line 3497 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4901,30 +5010,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4905 "Python/generated_cases.c.h" + #line 5014 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3435 "Python/bytecodes.c" + #line 3511 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4916 "Python/generated_cases.c.h" + #line 5025 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3443 "Python/bytecodes.c" + #line 3519 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4923 "Python/generated_cases.c.h" + #line 5032 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3448 "Python/bytecodes.c" + #line 3524 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4930 "Python/generated_cases.c.h" + #line 5039 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 8c0ba7d7f43a76..4405b659629c75 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -53,6 +53,16 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case UNARY_NOT: return 1; + case UNARY_NOT_BOOL: + return 1; + case UNARY_NOT_INT: + return 1; + case UNARY_NOT_LIST: + return 1; + case UNARY_NOT_NONE: + return 1; + case UNARY_NOT_STR: + return 1; case UNARY_INVERT: return 1; case BINARY_OP_MULTIPLY_INT: @@ -451,6 +461,16 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 1; case UNARY_NOT: return 1; + case UNARY_NOT_BOOL: + return 1; + case UNARY_NOT_INT: + return 1; + case UNARY_NOT_LIST: + return 1; + case UNARY_NOT_NONE: + return 1; + case UNARY_NOT_STR: + return 1; case UNARY_INVERT: return 1; case BINARY_OP_MULTIPLY_INT: @@ -830,7 +850,12 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [END_SEND] = { true, INSTR_FMT_IX }, [INSTRUMENTED_END_SEND] = { true, INSTR_FMT_IX }, [UNARY_NEGATIVE] = { true, INSTR_FMT_IX }, - [UNARY_NOT] = { true, INSTR_FMT_IX }, + [UNARY_NOT] = { true, INSTR_FMT_IXC }, + [UNARY_NOT_BOOL] = { true, INSTR_FMT_IXC }, + [UNARY_NOT_INT] = { true, INSTR_FMT_IXC }, + [UNARY_NOT_LIST] = { true, INSTR_FMT_IXC }, + [UNARY_NOT_NONE] = { true, INSTR_FMT_IXC }, + [UNARY_NOT_STR] = { true, INSTR_FMT_IXC }, [UNARY_INVERT] = { true, INSTR_FMT_IX }, [BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IBC }, [BINARY_OP_ADD_INT] = { true, INSTR_FMT_IBC }, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 9c46f4816369cf..9325f1d1923a28 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -168,17 +168,17 @@ static void *opcode_targets[256] = { &&TARGET_UNPACK_SEQUENCE_TUPLE, &&TARGET_UNPACK_SEQUENCE_TWO_TUPLE, &&TARGET_SEND_GEN, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_UNARY_NOT_BOOL, + &&TARGET_UNARY_NOT_INT, &&TARGET_CALL, &&TARGET_KW_NAMES, &&TARGET_CALL_INTRINSIC_1, &&TARGET_CALL_INTRINSIC_2, &&TARGET_LOAD_FROM_DICT_OR_GLOBALS, &&TARGET_LOAD_FROM_DICT_OR_DEREF, - &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_UNARY_NOT_LIST, + &&TARGET_UNARY_NOT_NONE, + &&TARGET_UNARY_NOT_STR, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, diff --git a/Python/specialize.c b/Python/specialize.c index f1684913b1bc30..74bdcbead783b4 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -107,6 +107,8 @@ _Py_GetSpecializationStats(void) { err += add_stat_dict(stats, COMPARE_OP, "compare_op"); err += add_stat_dict(stats, UNPACK_SEQUENCE, "unpack_sequence"); err += add_stat_dict(stats, FOR_ITER, "for_iter"); + err += add_stat_dict(stats, UNARY_NOT, "unary_not"); + err += add_stat_dict(stats, SEND, "send"); if (err < 0) { Py_DECREF(stats); return NULL; @@ -127,9 +129,7 @@ print_spec_stats(FILE *out, OpcodeStats *stats) /* Mark some opcodes as specializable for stats, * even though we don't specialize them yet. */ fprintf(out, "opcode[%d].specializable : 1\n", BINARY_SLICE); - fprintf(out, "opcode[%d].specializable : 1\n", COMPARE_OP); fprintf(out, "opcode[%d].specializable : 1\n", STORE_SLICE); - fprintf(out, "opcode[%d].specializable : 1\n", SEND); for (int i = 0; i < 256; i++) { if (_PyOpcode_Caches[i]) { fprintf(out, "opcode[%d].specializable : 1\n", i); @@ -461,6 +461,20 @@ _PyCode_Quicken(PyCodeObject *code) #define SPEC_FAIL_UNPACK_SEQUENCE_ITERATOR 9 #define SPEC_FAIL_UNPACK_SEQUENCE_SEQUENCE 10 +// UNARY_NOT +#define SPEC_FAIL_UNARY_NOT_BYTEARRAY 9 +#define SPEC_FAIL_UNARY_NOT_BYTES 10 +#define SPEC_FAIL_UNARY_NOT_COMPLEX 11 +#define SPEC_FAIL_UNARY_NOT_DICT 12 +#define SPEC_FAIL_UNARY_NOT_DICT_ITEMS 13 +#define SPEC_FAIL_UNARY_NOT_DICT_KEYS 14 +#define SPEC_FAIL_UNARY_NOT_DICT_VALUES 15 +#define SPEC_FAIL_UNARY_NOT_FLOAT 16 +#define SPEC_FAIL_UNARY_NOT_HEAP_TYPE 17 +#define SPEC_FAIL_UNARY_NOT_MEMORY_VIEW 18 +#define SPEC_FAIL_UNARY_NOT_SET 19 +#define SPEC_FAIL_UNARY_NOT_TUPLE 20 + static int function_kind(PyCodeObject *code); static bool function_check_args(PyObject *o, int expected_argcount, int opcode); static uint32_t function_get_version(PyObject *o, int opcode); @@ -2249,3 +2263,90 @@ _Py_Specialize_Send(PyObject *receiver, _Py_CODEUNIT *instr) STAT_INC(SEND, success); cache->counter = adaptive_counter_cooldown(); } + +void +_Py_Specialize_UnaryNot(PyObject *value, _Py_CODEUNIT *instr) +{ + assert(ENABLE_SPECIALIZATION); + assert(_PyOpcode_Caches[UNARY_NOT] == INLINE_CACHE_ENTRIES_UNARY_NOT); + _PyUnaryNotCache *cache = (_PyUnaryNotCache *)(instr + 1); + if (PyBool_Check(value)) { + instr->op.code = UNARY_NOT_BOOL; + goto success; + } + if (PyLong_CheckExact(value)) { + instr->op.code = UNARY_NOT_INT; + goto success; + } + if (PyList_CheckExact(value)) { + instr->op.code = UNARY_NOT_LIST; + goto success; + } + if (Py_IsNone(value)) { + instr->op.code = UNARY_NOT_NONE; + goto success; + } + if (PyUnicode_CheckExact(value)) { + instr->op.code = UNARY_NOT_STR; + goto success; + } +#ifdef Py_STATS + if (PyByteArray_CheckExact(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_BYTEARRAY); + goto failure; + } + if (PyBytes_CheckExact(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_BYTES); + goto failure; + } + if (PyComplex_CheckExact(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_COMPLEX); + goto failure; + } + if (PyDict_CheckExact(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT); + goto failure; + } + if (PyDictItems_Check(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT_ITEMS); + goto failure; + } + if (PyDictKeys_Check(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT_KEYS); + goto failure; + } + if (PyDictValues_Check(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT_VALUES); + goto failure; + } + if (PyFloat_CheckExact(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_FLOAT); + goto failure; + } + if (PyType_HasFeature(Py_TYPE(value), Py_TPFLAGS_HEAPTYPE)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_HEAP_TYPE); + goto failure; + } + if (PyMemoryView_Check(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_MEMORY_VIEW); + goto failure; + } + if (PyAnySet_CheckExact(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_SET); + goto failure; + } + if (PyTuple_CheckExact(value)) { + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_TUPLE); + goto failure; + } + SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_OTHER); +#endif +failure: + STAT_INC(UNARY_NOT, failure); + instr->op.code = UNARY_NOT; + cache->counter = adaptive_counter_backoff(cache->counter); + return; +success: + STAT_INC(UNARY_NOT, success); + cache->counter = adaptive_counter_cooldown(); +} From 7e5c9df329695174378971dfe106e73ad368455a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 7 Jun 2023 16:22:19 -0700 Subject: [PATCH 03/15] Remove unused stats --- Python/specialize.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/Python/specialize.c b/Python/specialize.c index 74bdcbead783b4..5b83428846ccd8 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -464,16 +464,12 @@ _PyCode_Quicken(PyCodeObject *code) // UNARY_NOT #define SPEC_FAIL_UNARY_NOT_BYTEARRAY 9 #define SPEC_FAIL_UNARY_NOT_BYTES 10 -#define SPEC_FAIL_UNARY_NOT_COMPLEX 11 -#define SPEC_FAIL_UNARY_NOT_DICT 12 -#define SPEC_FAIL_UNARY_NOT_DICT_ITEMS 13 -#define SPEC_FAIL_UNARY_NOT_DICT_KEYS 14 -#define SPEC_FAIL_UNARY_NOT_DICT_VALUES 15 -#define SPEC_FAIL_UNARY_NOT_FLOAT 16 -#define SPEC_FAIL_UNARY_NOT_HEAP_TYPE 17 -#define SPEC_FAIL_UNARY_NOT_MEMORY_VIEW 18 -#define SPEC_FAIL_UNARY_NOT_SET 19 -#define SPEC_FAIL_UNARY_NOT_TUPLE 20 +#define SPEC_FAIL_UNARY_NOT_DICT 11 +#define SPEC_FAIL_UNARY_NOT_FLOAT 12 +#define SPEC_FAIL_UNARY_NOT_HEAP_TYPE 13 +#define SPEC_FAIL_UNARY_NOT_MEMORY_VIEW 14 +#define SPEC_FAIL_UNARY_NOT_SET 15 +#define SPEC_FAIL_UNARY_NOT_TUPLE 16 static int function_kind(PyCodeObject *code); static bool function_check_args(PyObject *o, int expected_argcount, int opcode); @@ -2299,26 +2295,10 @@ _Py_Specialize_UnaryNot(PyObject *value, _Py_CODEUNIT *instr) SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_BYTES); goto failure; } - if (PyComplex_CheckExact(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_COMPLEX); - goto failure; - } if (PyDict_CheckExact(value)) { SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT); goto failure; } - if (PyDictItems_Check(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT_ITEMS); - goto failure; - } - if (PyDictKeys_Check(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT_KEYS); - goto failure; - } - if (PyDictValues_Check(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT_VALUES); - goto failure; - } if (PyFloat_CheckExact(value)) { SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_FLOAT); goto failure; From 27bb264e8247af28f554ea620389191fb7e78bbe Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 7 Jun 2023 16:23:18 -0700 Subject: [PATCH 04/15] Make UNARY_NOT_BOOL a little bit slicker --- Python/bytecodes.c | 4 ++-- Python/generated_cases.c.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 842a396fda739f..10b63390fa101a 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -292,14 +292,14 @@ dummy_func( } inst(UNARY_NOT_BOOL, (unused/1, value -- res)) { - DEOPT_IF(!PyBool_Check(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); if (Py_IsFalse(value)) { res = Py_True; } else { + DEOPT_IF(!Py_IsTrue(value), UNARY_NOT); res = Py_False; } + STAT_INC(UNARY_NOT, hit); } inst(UNARY_NOT_INT, (unused/1, value -- res)) { diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 28a97d56e1b457..2bb2da0508b679 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -387,14 +387,14 @@ PyObject *value = stack_pointer[-1]; PyObject *res; #line 295 "Python/bytecodes.c" - DEOPT_IF(!PyBool_Check(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); if (Py_IsFalse(value)) { res = Py_True; } else { + DEOPT_IF(!Py_IsTrue(value), UNARY_NOT); res = Py_False; } + STAT_INC(UNARY_NOT, hit); #line 399 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 1; From 0463633b0f9583ad7aa322af4e9c0228949eed20 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 9 Jun 2023 14:15:22 -0700 Subject: [PATCH 05/15] Replace UNARY_NOT with TO_BOOL --- Include/internal/pycore_code.h | 6 +- Include/internal/pycore_opcode.h | 66 +- Include/opcode.h | 139 ++-- Lib/opcode.py | 20 +- Lib/test/test_compile.py | 8 +- Lib/test/test_compiler_codegen.py | 4 +- Lib/test/test_dis.py | 36 +- Lib/test/test_peepholer.py | 9 +- Python/bytecodes.c | 87 +-- Python/compile.c | 36 +- Python/flowgraph.c | 16 +- Python/generated_cases.c.h | 1035 +++++++++++++++-------------- Python/opcode_metadata.h | 37 +- Python/opcode_targets.h | 52 +- Python/specialize.c | 62 +- 15 files changed, 818 insertions(+), 795 deletions(-) diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 13975202712a38..76ecc02442d122 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -103,9 +103,9 @@ typedef struct { typedef struct { uint16_t counter; -} _PyUnaryNotCache; +} _PyToBoolCache; -#define INLINE_CACHE_ENTRIES_UNARY_NOT CACHE_ENTRIES(_PyUnaryNotCache) +#define INLINE_CACHE_ENTRIES_TO_BOOL CACHE_ENTRIES(_PyToBoolCache) // Borrowed references to common callables: struct callable_cache { @@ -252,7 +252,7 @@ extern void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr, int oparg); extern void _Py_Specialize_ForIter(PyObject *iter, _Py_CODEUNIT *instr, int oparg); extern void _Py_Specialize_Send(PyObject *receiver, _Py_CODEUNIT *instr); -extern void _Py_Specialize_UnaryNot(PyObject *value, _Py_CODEUNIT *instr); +extern void _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr); /* Finalizer function for static codeobjects used in deepfreeze.py */ extern void _PyStaticCode_Fini(PyCodeObject *co); diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h index 1373b3165e1114..549abae2a194e4 100644 --- a/Include/internal/pycore_opcode.h +++ b/Include/internal/pycore_opcode.h @@ -32,7 +32,7 @@ const uint32_t _PyOpcode_Jump[9] = { }; const uint8_t _PyOpcode_Caches[256] = { - [UNARY_NOT] = 1, + [TO_BOOL] = 1, [BINARY_SUBSCR] = 1, [STORE_SUBSCR] = 1, [UNPACK_SEQUENCE] = 1, @@ -233,14 +233,15 @@ const uint8_t _PyOpcode_Deopt[256] = { [STORE_SUBSCR_DICT] = STORE_SUBSCR, [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR, [SWAP] = SWAP, + [TO_BOOL] = TO_BOOL, + [TO_BOOL_BOOL] = TO_BOOL, + [TO_BOOL_INT] = TO_BOOL, + [TO_BOOL_LIST] = TO_BOOL, + [TO_BOOL_NONE] = TO_BOOL, + [TO_BOOL_STR] = TO_BOOL, [UNARY_INVERT] = UNARY_INVERT, [UNARY_NEGATIVE] = UNARY_NEGATIVE, [UNARY_NOT] = UNARY_NOT, - [UNARY_NOT_BOOL] = UNARY_NOT, - [UNARY_NOT_INT] = UNARY_NOT, - [UNARY_NOT_LIST] = UNARY_NOT, - [UNARY_NOT_NONE] = UNARY_NOT, - [UNARY_NOT_STR] = UNARY_NOT, [UNPACK_EX] = UNPACK_EX, [UNPACK_SEQUENCE] = UNPACK_SEQUENCE, [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE, @@ -259,38 +260,39 @@ static const char *const _PyOpcode_OpName[267] = { [INTERPRETER_EXIT] = "INTERPRETER_EXIT", [END_FOR] = "END_FOR", [END_SEND] = "END_SEND", + [TO_BOOL] = "TO_BOOL", [BINARY_OP_ADD_FLOAT] = "BINARY_OP_ADD_FLOAT", [BINARY_OP_ADD_INT] = "BINARY_OP_ADD_INT", - [BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE", [NOP] = "NOP", - [BINARY_OP_INPLACE_ADD_UNICODE] = "BINARY_OP_INPLACE_ADD_UNICODE", + [BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE", [UNARY_NEGATIVE] = "UNARY_NEGATIVE", [UNARY_NOT] = "UNARY_NOT", + [BINARY_OP_INPLACE_ADD_UNICODE] = "BINARY_OP_INPLACE_ADD_UNICODE", [BINARY_OP_MULTIPLY_FLOAT] = "BINARY_OP_MULTIPLY_FLOAT", - [BINARY_OP_MULTIPLY_INT] = "BINARY_OP_MULTIPLY_INT", [UNARY_INVERT] = "UNARY_INVERT", - [BINARY_OP_SUBTRACT_FLOAT] = "BINARY_OP_SUBTRACT_FLOAT", + [BINARY_OP_MULTIPLY_INT] = "BINARY_OP_MULTIPLY_INT", [RESERVED] = "RESERVED", + [BINARY_OP_SUBTRACT_FLOAT] = "BINARY_OP_SUBTRACT_FLOAT", [BINARY_OP_SUBTRACT_INT] = "BINARY_OP_SUBTRACT_INT", [BINARY_SUBSCR_DICT] = "BINARY_SUBSCR_DICT", [BINARY_SUBSCR_GETITEM] = "BINARY_SUBSCR_GETITEM", [BINARY_SUBSCR_LIST_INT] = "BINARY_SUBSCR_LIST_INT", [BINARY_SUBSCR_TUPLE_INT] = "BINARY_SUBSCR_TUPLE_INT", [CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS", - [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS", [BINARY_SUBSCR] = "BINARY_SUBSCR", [BINARY_SLICE] = "BINARY_SLICE", [STORE_SLICE] = "STORE_SLICE", + [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS", [CALL_BOUND_METHOD_EXACT_ARGS] = "CALL_BOUND_METHOD_EXACT_ARGS", - [CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS", [GET_LEN] = "GET_LEN", [MATCH_MAPPING] = "MATCH_MAPPING", [MATCH_SEQUENCE] = "MATCH_SEQUENCE", [MATCH_KEYS] = "MATCH_KEYS", - [CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS", + [CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS", [PUSH_EXC_INFO] = "PUSH_EXC_INFO", [CHECK_EXC_MATCH] = "CHECK_EXC_MATCH", [CHECK_EG_MATCH] = "CHECK_EG_MATCH", + [CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS", [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS", [CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST", [CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O", @@ -301,7 +303,6 @@ static const char *const _PyOpcode_OpName[267] = { [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = "CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS", [CALL_NO_KW_METHOD_DESCRIPTOR_O] = "CALL_NO_KW_METHOD_DESCRIPTOR_O", [CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1", - [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1", [WITH_EXCEPT_START] = "WITH_EXCEPT_START", [GET_AITER] = "GET_AITER", [GET_ANEXT] = "GET_ANEXT", @@ -309,39 +310,39 @@ static const char *const _PyOpcode_OpName[267] = { [BEFORE_WITH] = "BEFORE_WITH", [END_ASYNC_FOR] = "END_ASYNC_FOR", [CLEANUP_THROW] = "CLEANUP_THROW", + [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1", [CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1", [COMPARE_OP_FLOAT] = "COMPARE_OP_FLOAT", [COMPARE_OP_INT] = "COMPARE_OP_INT", - [COMPARE_OP_STR] = "COMPARE_OP_STR", [STORE_SUBSCR] = "STORE_SUBSCR", [DELETE_SUBSCR] = "DELETE_SUBSCR", + [COMPARE_OP_STR] = "COMPARE_OP_STR", [FOR_ITER_LIST] = "FOR_ITER_LIST", [FOR_ITER_TUPLE] = "FOR_ITER_TUPLE", [FOR_ITER_RANGE] = "FOR_ITER_RANGE", [FOR_ITER_GEN] = "FOR_ITER_GEN", [LOAD_SUPER_ATTR_ATTR] = "LOAD_SUPER_ATTR_ATTR", - [LOAD_SUPER_ATTR_METHOD] = "LOAD_SUPER_ATTR_METHOD", [GET_ITER] = "GET_ITER", [GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER", - [LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS", + [LOAD_SUPER_ATTR_METHOD] = "LOAD_SUPER_ATTR_METHOD", [LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS", + [LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS", [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN", - [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE", [LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR", [RETURN_GENERATOR] = "RETURN_GENERATOR", + [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE", [LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE", [LOAD_ATTR_PROPERTY] = "LOAD_ATTR_PROPERTY", [LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT", [LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT", [LOAD_ATTR_METHOD_LAZY_DICT] = "LOAD_ATTR_METHOD_LAZY_DICT", [LOAD_ATTR_METHOD_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT", - [LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES", [RETURN_VALUE] = "RETURN_VALUE", - [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST", + [LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES", [SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS", - [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST", + [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST", [LOAD_LOCALS] = "LOAD_LOCALS", - [LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST", + [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST", [POP_EXCEPT] = "POP_EXCEPT", [STORE_NAME] = "STORE_NAME", [DELETE_NAME] = "DELETE_NAME", @@ -364,9 +365,9 @@ static const char *const _PyOpcode_OpName[267] = { [IMPORT_NAME] = "IMPORT_NAME", [IMPORT_FROM] = "IMPORT_FROM", [JUMP_FORWARD] = "JUMP_FORWARD", + [LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST", [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN", [LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE", - [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", [POP_JUMP_IF_FALSE] = "POP_JUMP_IF_FALSE", [POP_JUMP_IF_TRUE] = "POP_JUMP_IF_TRUE", [LOAD_GLOBAL] = "LOAD_GLOBAL", @@ -401,39 +402,39 @@ static const char *const _PyOpcode_OpName[267] = { [LIST_APPEND] = "LIST_APPEND", [SET_ADD] = "SET_ADD", [MAP_ADD] = "MAP_ADD", - [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT", + [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", [COPY_FREE_VARS] = "COPY_FREE_VARS", [YIELD_VALUE] = "YIELD_VALUE", [RESUME] = "RESUME", [MATCH_CLASS] = "MATCH_CLASS", + [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT", [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT", - [STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST", [FORMAT_VALUE] = "FORMAT_VALUE", [BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP", [BUILD_STRING] = "BUILD_STRING", + [STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST", [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST", [STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT", [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT", - [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST", [LIST_EXTEND] = "LIST_EXTEND", [SET_UPDATE] = "SET_UPDATE", [DICT_MERGE] = "DICT_MERGE", [DICT_UPDATE] = "DICT_UPDATE", + [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST", [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE", [UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", [SEND_GEN] = "SEND_GEN", - [UNARY_NOT_BOOL] = "UNARY_NOT_BOOL", - [UNARY_NOT_INT] = "UNARY_NOT_INT", + [TO_BOOL_BOOL] = "TO_BOOL_BOOL", [CALL] = "CALL", [KW_NAMES] = "KW_NAMES", [CALL_INTRINSIC_1] = "CALL_INTRINSIC_1", [CALL_INTRINSIC_2] = "CALL_INTRINSIC_2", [LOAD_FROM_DICT_OR_GLOBALS] = "LOAD_FROM_DICT_OR_GLOBALS", [LOAD_FROM_DICT_OR_DEREF] = "LOAD_FROM_DICT_OR_DEREF", - [UNARY_NOT_LIST] = "UNARY_NOT_LIST", - [UNARY_NOT_NONE] = "UNARY_NOT_NONE", - [UNARY_NOT_STR] = "UNARY_NOT_STR", - [180] = "<180>", + [TO_BOOL_INT] = "TO_BOOL_INT", + [TO_BOOL_LIST] = "TO_BOOL_LIST", + [TO_BOOL_NONE] = "TO_BOOL_NONE", + [TO_BOOL_STR] = "TO_BOOL_STR", [181] = "<181>", [182] = "<182>", [183] = "<183>", @@ -524,7 +525,6 @@ static const char *const _PyOpcode_OpName[267] = { #endif #define EXTRA_CASES \ - case 180: \ case 181: \ case 182: \ case 183: \ diff --git a/Include/opcode.h b/Include/opcode.h index f3980011caf3d3..b47247b29a8a45 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -14,6 +14,7 @@ extern "C" { #define INTERPRETER_EXIT 3 #define END_FOR 4 #define END_SEND 5 +#define TO_BOOL 6 #define NOP 9 #define UNARY_NEGATIVE 11 #define UNARY_NOT 12 @@ -153,75 +154,75 @@ extern "C" { #define LOAD_ZERO_SUPER_ATTR 265 #define STORE_FAST_MAYBE_NULL 266 #define MAX_PSEUDO_OPCODE 266 -#define BINARY_OP_ADD_FLOAT 6 -#define BINARY_OP_ADD_INT 7 -#define BINARY_OP_ADD_UNICODE 8 -#define BINARY_OP_INPLACE_ADD_UNICODE 10 -#define BINARY_OP_MULTIPLY_FLOAT 13 -#define BINARY_OP_MULTIPLY_INT 14 -#define BINARY_OP_SUBTRACT_FLOAT 16 -#define BINARY_OP_SUBTRACT_INT 18 -#define BINARY_SUBSCR_DICT 19 -#define BINARY_SUBSCR_GETITEM 20 -#define BINARY_SUBSCR_LIST_INT 21 -#define BINARY_SUBSCR_TUPLE_INT 22 -#define CALL_PY_EXACT_ARGS 23 -#define CALL_PY_WITH_DEFAULTS 24 -#define CALL_BOUND_METHOD_EXACT_ARGS 28 -#define CALL_BUILTIN_CLASS 29 -#define CALL_BUILTIN_FAST_WITH_KEYWORDS 34 -#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 38 -#define CALL_NO_KW_BUILTIN_FAST 39 -#define CALL_NO_KW_BUILTIN_O 40 -#define CALL_NO_KW_ISINSTANCE 41 -#define CALL_NO_KW_LEN 42 -#define CALL_NO_KW_LIST_APPEND 43 -#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 44 -#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 45 -#define CALL_NO_KW_METHOD_DESCRIPTOR_O 46 -#define CALL_NO_KW_STR_1 47 -#define CALL_NO_KW_TUPLE_1 48 -#define CALL_NO_KW_TYPE_1 56 -#define COMPARE_OP_FLOAT 57 -#define COMPARE_OP_INT 58 -#define COMPARE_OP_STR 59 -#define FOR_ITER_LIST 62 -#define FOR_ITER_TUPLE 63 -#define FOR_ITER_RANGE 64 -#define FOR_ITER_GEN 65 -#define LOAD_SUPER_ATTR_ATTR 66 -#define LOAD_SUPER_ATTR_METHOD 67 -#define LOAD_ATTR_CLASS 70 -#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 72 -#define LOAD_ATTR_INSTANCE_VALUE 73 -#define LOAD_ATTR_MODULE 76 -#define LOAD_ATTR_PROPERTY 77 -#define LOAD_ATTR_SLOT 78 -#define LOAD_ATTR_WITH_HINT 79 -#define LOAD_ATTR_METHOD_LAZY_DICT 80 -#define LOAD_ATTR_METHOD_NO_DICT 81 -#define LOAD_ATTR_METHOD_WITH_VALUES 82 -#define LOAD_CONST__LOAD_FAST 84 -#define LOAD_FAST__LOAD_CONST 86 -#define LOAD_FAST__LOAD_FAST 88 -#define LOAD_GLOBAL_BUILTIN 111 -#define LOAD_GLOBAL_MODULE 112 -#define STORE_ATTR_INSTANCE_VALUE 113 -#define STORE_ATTR_SLOT 148 -#define STORE_ATTR_WITH_HINT 153 -#define STORE_FAST__LOAD_FAST 154 -#define STORE_FAST__STORE_FAST 158 -#define STORE_SUBSCR_DICT 159 -#define STORE_SUBSCR_LIST_INT 160 -#define UNPACK_SEQUENCE_LIST 161 -#define UNPACK_SEQUENCE_TUPLE 166 -#define UNPACK_SEQUENCE_TWO_TUPLE 167 -#define SEND_GEN 168 -#define UNARY_NOT_BOOL 169 -#define UNARY_NOT_INT 170 -#define UNARY_NOT_LIST 177 -#define UNARY_NOT_NONE 178 -#define UNARY_NOT_STR 179 +#define BINARY_OP_ADD_FLOAT 7 +#define BINARY_OP_ADD_INT 8 +#define BINARY_OP_ADD_UNICODE 10 +#define BINARY_OP_INPLACE_ADD_UNICODE 13 +#define BINARY_OP_MULTIPLY_FLOAT 14 +#define BINARY_OP_MULTIPLY_INT 16 +#define BINARY_OP_SUBTRACT_FLOAT 18 +#define BINARY_OP_SUBTRACT_INT 19 +#define BINARY_SUBSCR_DICT 20 +#define BINARY_SUBSCR_GETITEM 21 +#define BINARY_SUBSCR_LIST_INT 22 +#define BINARY_SUBSCR_TUPLE_INT 23 +#define CALL_PY_EXACT_ARGS 24 +#define CALL_PY_WITH_DEFAULTS 28 +#define CALL_BOUND_METHOD_EXACT_ARGS 29 +#define CALL_BUILTIN_CLASS 34 +#define CALL_BUILTIN_FAST_WITH_KEYWORDS 38 +#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 39 +#define CALL_NO_KW_BUILTIN_FAST 40 +#define CALL_NO_KW_BUILTIN_O 41 +#define CALL_NO_KW_ISINSTANCE 42 +#define CALL_NO_KW_LEN 43 +#define CALL_NO_KW_LIST_APPEND 44 +#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 45 +#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 46 +#define CALL_NO_KW_METHOD_DESCRIPTOR_O 47 +#define CALL_NO_KW_STR_1 48 +#define CALL_NO_KW_TUPLE_1 56 +#define CALL_NO_KW_TYPE_1 57 +#define COMPARE_OP_FLOAT 58 +#define COMPARE_OP_INT 59 +#define COMPARE_OP_STR 62 +#define FOR_ITER_LIST 63 +#define FOR_ITER_TUPLE 64 +#define FOR_ITER_RANGE 65 +#define FOR_ITER_GEN 66 +#define LOAD_SUPER_ATTR_ATTR 67 +#define LOAD_SUPER_ATTR_METHOD 70 +#define LOAD_ATTR_CLASS 72 +#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 73 +#define LOAD_ATTR_INSTANCE_VALUE 76 +#define LOAD_ATTR_MODULE 77 +#define LOAD_ATTR_PROPERTY 78 +#define LOAD_ATTR_SLOT 79 +#define LOAD_ATTR_WITH_HINT 80 +#define LOAD_ATTR_METHOD_LAZY_DICT 81 +#define LOAD_ATTR_METHOD_NO_DICT 82 +#define LOAD_ATTR_METHOD_WITH_VALUES 84 +#define LOAD_CONST__LOAD_FAST 86 +#define LOAD_FAST__LOAD_CONST 88 +#define LOAD_FAST__LOAD_FAST 111 +#define LOAD_GLOBAL_BUILTIN 112 +#define LOAD_GLOBAL_MODULE 113 +#define STORE_ATTR_INSTANCE_VALUE 148 +#define STORE_ATTR_SLOT 153 +#define STORE_ATTR_WITH_HINT 154 +#define STORE_FAST__LOAD_FAST 158 +#define STORE_FAST__STORE_FAST 159 +#define STORE_SUBSCR_DICT 160 +#define STORE_SUBSCR_LIST_INT 161 +#define UNPACK_SEQUENCE_LIST 166 +#define UNPACK_SEQUENCE_TUPLE 167 +#define UNPACK_SEQUENCE_TWO_TUPLE 168 +#define SEND_GEN 169 +#define TO_BOOL_BOOL 170 +#define TO_BOOL_INT 177 +#define TO_BOOL_LIST 178 +#define TO_BOOL_NONE 179 +#define TO_BOOL_STR 180 #define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\ || ((op) == JUMP) \ diff --git a/Lib/opcode.py b/Lib/opcode.py index 9383583976b3e5..a34dd14d3332d0 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -81,9 +81,9 @@ def pseudo_op(name, op, real_ops): def_op('POP_TOP', 1) def_op('PUSH_NULL', 2) def_op('INTERPRETER_EXIT', 3) - def_op('END_FOR', 4) def_op('END_SEND', 5) +def_op('TO_BOOL', 6) def_op('NOP', 9) @@ -131,6 +131,7 @@ def pseudo_op(name, op, real_ops): def_op('RETURN_VALUE', 83) def_op('SETUP_ANNOTATIONS', 85) + def_op('LOAD_LOCALS', 87) def_op('POP_EXCEPT', 89) @@ -160,6 +161,7 @@ def pseudo_op(name, op, real_ops): 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 words to skip + jrel_op('POP_JUMP_IF_FALSE', 114) jrel_op('POP_JUMP_IF_TRUE', 115) name_op('LOAD_GLOBAL', 116) # Index in name list @@ -201,7 +203,6 @@ def pseudo_op(name, op, real_ops): def_op('CALL_FUNCTION_EX', 142) # Flags def_op('LOAD_FAST_AND_CLEAR', 143) # Local variable number haslocal.append(143) - def_op('EXTENDED_ARG', 144) EXTENDED_ARG = 144 def_op('LIST_APPEND', 145) @@ -227,7 +228,6 @@ def pseudo_op(name, op, real_ops): hasconst.append(172) def_op('CALL_INTRINSIC_1', 173) def_op('CALL_INTRINSIC_2', 174) - name_op('LOAD_FROM_DICT_OR_GLOBALS', 175) def_op('LOAD_FROM_DICT_OR_DEREF', 176) hasfree.append(176) @@ -438,12 +438,12 @@ def pseudo_op(name, op, real_ops): "SEND": [ "SEND_GEN", ], - "UNARY_NOT": [ - "UNARY_NOT_BOOL", - "UNARY_NOT_INT", - "UNARY_NOT_LIST", - "UNARY_NOT_NONE", - "UNARY_NOT_STR", + "TO_BOOL": [ + "TO_BOOL_BOOL", + "TO_BOOL_INT", + "TO_BOOL_LIST", + "TO_BOOL_NONE", + "TO_BOOL_STR", ] } _specialized_instructions = [ @@ -499,7 +499,7 @@ def pseudo_op(name, op, real_ops): "JUMP_BACKWARD": { "counter": 1, }, - "UNARY_NOT": { + "TO_BOOL": { "counter": 1, }, } diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 373033d51bb8da..784c0550cc09b1 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -1292,19 +1292,19 @@ def test_multiline_boolean_expression(self): """) compiled_code, _ = self.check_positions_against_ast(snippet) # jump if a is true: - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', line=1, end_line=1, column=4, end_column=5, occurrence=1) # jump if b is false: - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', line=2, end_line=2, column=5, end_column=6, occurrence=1) # jump if c is false: - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', line=2, end_line=2, column=15, end_column=16, occurrence=2) # compare d and 0 self.assertOpcodeSourcePositionIs(compiled_code, 'COMPARE_OP', line=4, end_line=4, column=8, end_column=13, occurrence=1) # jump if comparison it True - self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_FALSE', + self.assertOpcodeSourcePositionIs(compiled_code, 'POP_JUMP_IF_TRUE', line=4, end_line=4, column=8, end_column=13, occurrence=2) def test_multiline_assert(self): diff --git a/Lib/test/test_compiler_codegen.py b/Lib/test/test_compiler_codegen.py index 8f36411d5a9487..d99bb8c6cd472d 100644 --- a/Lib/test/test_compiler_codegen.py +++ b/Lib/test/test_compiler_codegen.py @@ -18,8 +18,8 @@ def test_if_expression(self): expected = [ ('RESUME', 0, 0), ('LOAD_CONST', 0, 1), - ('UNARY_NOT', 0, 1), - ('POP_JUMP_IF_TRUE', false_lbl := self.Label(), 1), + ('TO_BOOL', 0, 1), + ('POP_JUMP_IF_FALSE', false_lbl := self.Label(), 1), ('LOAD_CONST', 1, 1), ('JUMP', exit_lbl := self.Label()), false_lbl, diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index c18599a2fa0978..95437cb26ad883 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -486,8 +486,8 @@ def _with(c): %3d >> PUSH_EXC_INFO WITH_EXCEPT_START - UNARY_NOT - POP_JUMP_IF_FALSE 1 (to 46) + TO_BOOL + POP_JUMP_IF_TRUE 1 (to 46) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -566,8 +566,8 @@ async def _asyncwith(c): JUMP_BACKWARD_NO_INTERRUPT 5 (to 90) >> CLEANUP_THROW >> END_SEND - UNARY_NOT - POP_JUMP_IF_FALSE 1 (to 112) + TO_BOOL + POP_JUMP_IF_TRUE 1 (to 112) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -1670,14 +1670,14 @@ def _prepare_test_cases(): Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=52, starts_line=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=54, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=56, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=70, argrepr='to 70', offset=64, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=70, argrepr='to 70', offset=64, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=140, arg=23, argval=24, argrepr='to 24', offset=66, starts_line=6, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=70, starts_line=7, is_jump_target=True, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=72, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=74, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=78, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=88, argrepr='to 88', offset=82, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=78, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=88, argrepr='to 88', offset=82, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=140, arg=32, argval=24, argrepr='to 24', offset=84, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=88, starts_line=8, is_jump_target=True, positions=None), Instruction(opname='JUMP_FORWARD', opcode=110, arg=12, argval=116, argrepr='to 116', offset=90, starts_line=None, is_jump_target=False, positions=None), @@ -1687,8 +1687,8 @@ def _prepare_test_cases(): Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=106, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=116, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=118, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=39, argval=202, argrepr='to 202', offset=122, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=118, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=39, argval=202, argrepr='to 202', offset=122, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=124, starts_line=12, is_jump_target=True, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=134, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=136, starts_line=None, is_jump_target=False, positions=None), @@ -1700,18 +1700,18 @@ def _prepare_test_cases(): Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=156, starts_line=14, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=158, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=160, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=164, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=174, argrepr='to 174', offset=168, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=164, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=174, argrepr='to 174', offset=168, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=140, arg=29, argval=116, argrepr='to 116', offset=170, starts_line=15, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=174, starts_line=16, is_jump_target=True, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=176, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=178, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=182, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=190, argrepr='to 190', offset=186, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=182, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=190, argrepr='to 190', offset=186, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='JUMP_FORWARD', opcode=110, arg=17, argval=224, argrepr='to 224', offset=188, starts_line=17, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=190, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=192, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=202, argrepr='to 202', offset=196, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=192, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=202, argrepr='to 202', offset=196, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=140, arg=39, argval=124, argrepr='to 124', offset=198, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=202, starts_line=19, is_jump_target=True, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=212, starts_line=None, is_jump_target=False, positions=None), @@ -1741,8 +1741,8 @@ def _prepare_test_cases(): Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=302, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=304, starts_line=25, is_jump_target=False, positions=None), Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=306, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='UNARY_NOT', opcode=12, arg=None, argval=None, argrepr='', offset=308, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=316, argrepr='to 316', offset=312, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=308, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=316, argrepr='to 316', offset=312, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=314, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=316, starts_line=None, is_jump_target=True, positions=None), Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=318, starts_line=None, is_jump_target=False, positions=None), diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py index 81e615281aea93..255e9280421423 100644 --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -72,8 +72,9 @@ def test_unot(self): def unot(x): if not x == 2: del x - self.assertNotInBytecode(unot, 'POP_JUMP_IF_TRUE') - self.assertInBytecode(unot, 'POP_JUMP_IF_FALSE') + self.assertNotInBytecode(unot, 'UNARY_NOT') + self.assertNotInBytecode(unot, 'POP_JUMP_IF_FALSE') + self.assertInBytecode(unot, 'POP_JUMP_IF_TRUE') self.check_lnotab(unot) def test_elim_inversion_of_is_or_in(self): @@ -385,14 +386,14 @@ def f(a, b, c): and c) self.check_jump_targets(f) self.check_lnotab(f) - self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_TRUE'), 2) + self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_FALSE'), 2) # POP_JUMP_IF_TRUE to POP_JUMP_IF_TRUE --> POP_JUMP_IF_TRUE to non-jump def f(a, b, c): return ((a or b) or c) self.check_jump_targets(f) self.check_lnotab(f) - self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_FALSE'), 2) + self.assertEqual(count_instr_recursively(f, 'POP_JUMP_IF_TRUE'), 2) # JUMP_IF_FALSE_OR_POP to JUMP_IF_TRUE_OR_POP --> POP_JUMP_IF_FALSE to non-jump def f(a, b, c): return ((a and b) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 10b63390fa101a..257935281ebba1 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -260,91 +260,96 @@ dummy_func( ERROR_IF(res == NULL, error); } - family(unary_not, INLINE_CACHE_ENTRIES_UNARY_NOT) = { - UNARY_NOT, - UNARY_NOT_BOOL, - UNARY_NOT_INT, - UNARY_NOT_LIST, - UNARY_NOT_NONE, - UNARY_NOT_STR, + inst(UNARY_NOT, (value -- res)) { + assert(PyBool_Check(value)); + if (Py_IsFalse(value)) { + res = Py_True; + } + else { + res = Py_False; + } + } + + family(to_bool, INLINE_CACHE_ENTRIES_TO_BOOL) = { + TO_BOOL, + TO_BOOL_BOOL, + TO_BOOL_INT, + TO_BOOL_LIST, + TO_BOOL_NONE, + TO_BOOL_STR, }; - inst(UNARY_NOT, (unused/1, value -- res)) { + inst(TO_BOOL, (unused/1, value -- res)) { #if ENABLE_SPECIALIZATION - _PyUnaryNotCache *cache = (_PyUnaryNotCache *)next_instr; + _PyToBoolCache *cache = (_PyToBoolCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { next_instr--; - _Py_Specialize_UnaryNot(value, next_instr); + _Py_Specialize_ToBool(value, next_instr); DISPATCH_SAME_OPARG(); } - STAT_INC(UNARY_NOT, deferred); + STAT_INC(TO_BOOL, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ int err = PyObject_IsTrue(value); DECREF_INPUTS(); ERROR_IF(err < 0, error); if (err == 0) { - res = Py_True; + res = Py_False; } else { - res = Py_False; + res = Py_True; } } - inst(UNARY_NOT_BOOL, (unused/1, value -- res)) { - if (Py_IsFalse(value)) { - res = Py_True; - } - else { - DEOPT_IF(!Py_IsTrue(value), UNARY_NOT); - res = Py_False; - } - STAT_INC(UNARY_NOT, hit); + inst(TO_BOOL_BOOL, (unused/1, value -- value)) { + // Coolest (and dumbest-named) specialization ever: + DEOPT_IF(!PyBool_Check(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); } - inst(UNARY_NOT_INT, (unused/1, value -- res)) { - DEOPT_IF(!PyLong_CheckExact(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); + inst(TO_BOOL_INT, (unused/1, value -- res)) { + DEOPT_IF(!PyLong_CheckExact(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); if (_PyLong_IsZero((PyLongObject *)value)) { assert(_Py_IsImmortal(value)); - res = Py_True; + res = Py_False; } else { DECREF_INPUTS(); - res = Py_False; + res = Py_True; } } - inst(UNARY_NOT_LIST, (unused/1, value -- res)) { - DEOPT_IF(!PyList_CheckExact(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); + inst(TO_BOOL_LIST, (unused/1, value -- res)) { + DEOPT_IF(!PyList_CheckExact(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); if (!Py_SIZE(value)) { - res = Py_True; + res = Py_False; } else { - res = Py_False; + res = Py_True; } DECREF_INPUTS(); } - inst(UNARY_NOT_NONE, (unused/1, value -- res)) { + inst(TO_BOOL_NONE, (unused/1, value -- res)) { // This one is a bit weird, because we expect *some* failures: - DEOPT_IF(!Py_IsNone(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); - res = Py_True; + DEOPT_IF(!Py_IsNone(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); + res = Py_False; } - inst(UNARY_NOT_STR, (unused/1, value -- res)) { - DEOPT_IF(!PyUnicode_CheckExact(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); + inst(TO_BOOL_STR, (unused/1, value -- res)) { + DEOPT_IF(!PyUnicode_CheckExact(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); if (Py_Is(value, &_Py_STR(empty))) { assert(_Py_IsImmortal(value)); - res = Py_True; + res = Py_False; } else { assert(Py_SIZE(value)); DECREF_INPUTS(); - res = Py_False; + res = Py_True; } } diff --git a/Python/compile.c b/Python/compile.c index 34a138ebab1348..479c3dfc9d9193 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2823,13 +2823,13 @@ compiler_jump_if(struct compiler *c, location loc, ADDOP_I(c, LOC(e), SWAP, 2); ADDOP_I(c, LOC(e), COPY, 2); ADDOP_COMPARE(c, LOC(e), asdl_seq_GET(e->v.Compare.ops, i)); - ADDOP(c, LOC(e), UNARY_NOT); - ADDOP_JUMP(c, LOC(e), POP_JUMP_IF_TRUE, cleanup); + ADDOP(c, LOC(e), TO_BOOL); + ADDOP_JUMP(c, LOC(e), POP_JUMP_IF_FALSE, cleanup); } VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n)); ADDOP_COMPARE(c, LOC(e), asdl_seq_GET(e->v.Compare.ops, n)); - ADDOP(c, LOC(e), UNARY_NOT); - ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_FALSE : POP_JUMP_IF_TRUE, next); + ADDOP(c, LOC(e), TO_BOOL); + ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next); NEW_JUMP_TARGET_LABEL(c, end); ADDOP_JUMP(c, NO_LOCATION, JUMP, end); @@ -2852,8 +2852,8 @@ compiler_jump_if(struct compiler *c, location loc, /* general implementation */ VISIT(c, expr, e); - ADDOP(c, LOC(e), UNARY_NOT); - ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_FALSE : POP_JUMP_IF_TRUE, next); + ADDOP(c, LOC(e), TO_BOOL); + ADDOP_JUMP(c, LOC(e), cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next); return SUCCESS; } @@ -3984,8 +3984,6 @@ unaryop(unaryop_ty op) switch (op) { case Invert: return UNARY_INVERT; - case Not: - return UNARY_NOT; case USub: return UNARY_NEGATIVE; default: @@ -4205,9 +4203,9 @@ compiler_boolop(struct compiler *c, expr_ty e) location loc = LOC(e); assert(e->kind == BoolOp_kind); if (e->v.BoolOp.op == And) - jumpi = POP_JUMP_IF_TRUE; - else jumpi = POP_JUMP_IF_FALSE; + else + jumpi = POP_JUMP_IF_TRUE; NEW_JUMP_TARGET_LABEL(c, end); s = e->v.BoolOp.values; n = asdl_seq_LEN(s) - 1; @@ -4215,7 +4213,7 @@ compiler_boolop(struct compiler *c, expr_ty e) for (i = 0; i < n; ++i) { VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i)); ADDOP_I(c, loc, COPY, 1); - ADDOP(c, loc, UNARY_NOT); + ADDOP(c, loc, TO_BOOL); ADDOP_JUMP(c, loc, jumpi, end); ADDOP(c, loc, POP_TOP); } @@ -4523,8 +4521,8 @@ compiler_compare(struct compiler *c, expr_ty e) ADDOP_I(c, loc, COPY, 2); ADDOP_COMPARE(c, loc, asdl_seq_GET(e->v.Compare.ops, i)); ADDOP_I(c, loc, COPY, 1); - ADDOP(c, loc, UNARY_NOT); - ADDOP_JUMP(c, loc, POP_JUMP_IF_TRUE, cleanup); + ADDOP(c, loc, TO_BOOL); + ADDOP_JUMP(c, loc, POP_JUMP_IF_FALSE, cleanup); ADDOP(c, loc, POP_TOP); } VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n)); @@ -5759,8 +5757,8 @@ compiler_visit_keyword(struct compiler *c, keyword_ty k) static int compiler_with_except_finish(struct compiler *c, jump_target_label cleanup) { NEW_JUMP_TARGET_LABEL(c, suppress); - ADDOP(c, NO_LOCATION, UNARY_NOT); - ADDOP_JUMP(c, NO_LOCATION, POP_JUMP_IF_FALSE, suppress); + ADDOP(c, NO_LOCATION, TO_BOOL); + ADDOP_JUMP(c, NO_LOCATION, POP_JUMP_IF_TRUE, suppress); ADDOP_I(c, NO_LOCATION, RERAISE, 2); USE_LABEL(c, suppress); @@ -5993,6 +5991,10 @@ compiler_visit_expr1(struct compiler *c, expr_ty e) if (e->v.UnaryOp.op == UAdd) { ADDOP_I(c, loc, CALL_INTRINSIC_1, INTRINSIC_UNARY_POSITIVE); } + else if (e->v.UnaryOp.op == Not) { + ADDOP(c, loc, TO_BOOL); + ADDOP(c, loc, UNARY_NOT); + } else { ADDOP(c, loc, unaryop(e->v.UnaryOp.op)); } @@ -7168,8 +7170,8 @@ compiler_pattern_value(struct compiler *c, pattern_ty p, pattern_context *pc) } VISIT(c, expr, value); ADDOP_COMPARE(c, LOC(p), Eq); - ADDOP(c, LOC(p), UNARY_NOT); - RETURN_IF_ERROR(jump_to_fail_pop(c, LOC(p), pc, POP_JUMP_IF_TRUE)); + ADDOP(c, LOC(p), TO_BOOL); + RETURN_IF_ERROR(jump_to_fail_pop(c, LOC(p), pc, POP_JUMP_IF_FALSE)); return SUCCESS; } diff --git a/Python/flowgraph.c b/Python/flowgraph.c index 80e4d0b0b5a577..3626f2430d0f2a 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1443,7 +1443,7 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); } break; - case UNARY_NOT: + case TO_BOOL: cnt = get_const_value(opcode, oparg, consts); if (cnt == NULL) { goto error; @@ -1453,7 +1453,7 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) if (is_true == -1) { goto error; } - cnt = PyBool_FromLong(!is_true); + cnt = PyBool_FromLong(is_true); int index = add_const(cnt, consts, const_cache); if (index < 0) { return ERROR; @@ -1466,16 +1466,16 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) if (cnt == NULL) { goto error; } - int invert = i + 2 < bb->b_iused && bb->b_instr[i + 2].i_opcode == UNARY_NOT; - int jump_op = i + invert + 2 < bb->b_iused ? bb->b_instr[i + invert + 2].i_opcode : 0; + int to_bool = i + 2 < bb->b_iused && bb->b_instr[i + 2].i_opcode == TO_BOOL; + int jump_op = i + to_bool + 2 < bb->b_iused ? bb->b_instr[i + to_bool + 2].i_opcode : 0; if (Py_IsNone(cnt) && (jump_op == POP_JUMP_IF_FALSE || jump_op == POP_JUMP_IF_TRUE)) { unsigned char nextarg = bb->b_instr[i+1].i_oparg; INSTR_SET_OP0(inst, NOP); INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); - if (invert) { + if (to_bool) { INSTR_SET_OP0(&bb->b_instr[i + 2], NOP); } - bb->b_instr[i + invert + 2].i_opcode = nextarg ^ invert ^ (jump_op == POP_JUMP_IF_FALSE) ? + bb->b_instr[i + to_bool + 2].i_opcode = nextarg ^ (jump_op == POP_JUMP_IF_FALSE) ? POP_JUMP_IF_NOT_NONE : POP_JUMP_IF_NONE; } Py_DECREF(cnt); @@ -1489,9 +1489,9 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) } case IS_OP: case CONTAINS_OP: - if (nextop == UNARY_NOT) { + if (nextop == TO_BOOL) { INSTR_SET_OP0(inst, NOP); - INSTR_SET_OP1(&bb->b_instr[i + 1], opcode, !oparg); + INSTR_SET_OP1(&bb->b_instr[i + 1], opcode, oparg); continue; } break; diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 2bb2da0508b679..0e9a076c2e9f54 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -351,129 +351,138 @@ } TARGET(UNARY_NOT) { - PREDICTED(UNARY_NOT); - static_assert(INLINE_CACHE_ENTRIES_UNARY_NOT == 1, "incorrect cache size"); PyObject *value = stack_pointer[-1]; PyObject *res; - #line 273 "Python/bytecodes.c" + #line 264 "Python/bytecodes.c" + assert(PyBool_Check(value)); + if (Py_IsFalse(value)) { + res = Py_True; + } + else { + res = Py_False; + } + #line 365 "Python/generated_cases.c.h" + stack_pointer[-1] = res; + DISPATCH(); + } + + TARGET(TO_BOOL) { + PREDICTED(TO_BOOL); + static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 1, "incorrect cache size"); + PyObject *value = stack_pointer[-1]; + PyObject *res; + #line 283 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION - _PyUnaryNotCache *cache = (_PyUnaryNotCache *)next_instr; + _PyToBoolCache *cache = (_PyToBoolCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { next_instr--; - _Py_Specialize_UnaryNot(value, next_instr); + _Py_Specialize_ToBool(value, next_instr); DISPATCH_SAME_OPARG(); } - STAT_INC(UNARY_NOT, deferred); + STAT_INC(TO_BOOL, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ int err = PyObject_IsTrue(value); - #line 371 "Python/generated_cases.c.h" + #line 387 "Python/generated_cases.c.h" Py_DECREF(value); - #line 285 "Python/bytecodes.c" + #line 295 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { - res = Py_True; + res = Py_False; } else { - res = Py_False; + res = Py_True; } - #line 381 "Python/generated_cases.c.h" + #line 397 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 1; DISPATCH(); } - TARGET(UNARY_NOT_BOOL) { + TARGET(TO_BOOL_BOOL) { PyObject *value = stack_pointer[-1]; - PyObject *res; - #line 295 "Python/bytecodes.c" - if (Py_IsFalse(value)) { - res = Py_True; - } - else { - DEOPT_IF(!Py_IsTrue(value), UNARY_NOT); - res = Py_False; - } - STAT_INC(UNARY_NOT, hit); - #line 399 "Python/generated_cases.c.h" - stack_pointer[-1] = res; + #line 305 "Python/bytecodes.c" + // Coolest (and dumbest-named) specialization ever: + DEOPT_IF(!PyBool_Check(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); + #line 409 "Python/generated_cases.c.h" next_instr += 1; DISPATCH(); } - TARGET(UNARY_NOT_INT) { + TARGET(TO_BOOL_INT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 306 "Python/bytecodes.c" - DEOPT_IF(!PyLong_CheckExact(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); + #line 311 "Python/bytecodes.c" + DEOPT_IF(!PyLong_CheckExact(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); if (_PyLong_IsZero((PyLongObject *)value)) { assert(_Py_IsImmortal(value)); - res = Py_True; + res = Py_False; } else { - #line 416 "Python/generated_cases.c.h" + #line 425 "Python/generated_cases.c.h" Py_DECREF(value); - #line 314 "Python/bytecodes.c" - res = Py_False; + #line 319 "Python/bytecodes.c" + res = Py_True; } - #line 421 "Python/generated_cases.c.h" + #line 430 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 1; DISPATCH(); } - TARGET(UNARY_NOT_LIST) { + TARGET(TO_BOOL_LIST) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 319 "Python/bytecodes.c" - DEOPT_IF(!PyList_CheckExact(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); + #line 324 "Python/bytecodes.c" + DEOPT_IF(!PyList_CheckExact(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); if (!Py_SIZE(value)) { - res = Py_True; + res = Py_False; } else { - res = Py_False; + res = Py_True; } - #line 439 "Python/generated_cases.c.h" + #line 448 "Python/generated_cases.c.h" Py_DECREF(value); stack_pointer[-1] = res; next_instr += 1; DISPATCH(); } - TARGET(UNARY_NOT_NONE) { + TARGET(TO_BOOL_NONE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 331 "Python/bytecodes.c" + #line 336 "Python/bytecodes.c" // This one is a bit weird, because we expect *some* failures: - DEOPT_IF(!Py_IsNone(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); - res = Py_True; - #line 454 "Python/generated_cases.c.h" + DEOPT_IF(!Py_IsNone(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); + res = Py_False; + #line 463 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 1; DISPATCH(); } - TARGET(UNARY_NOT_STR) { + TARGET(TO_BOOL_STR) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 338 "Python/bytecodes.c" - DEOPT_IF(!PyUnicode_CheckExact(value), UNARY_NOT); - STAT_INC(UNARY_NOT, hit); + #line 343 "Python/bytecodes.c" + DEOPT_IF(!PyUnicode_CheckExact(value), TO_BOOL); + STAT_INC(TO_BOOL, hit); if (Py_Is(value, &_Py_STR(empty))) { assert(_Py_IsImmortal(value)); - res = Py_True; + res = Py_False; } else { assert(Py_SIZE(value)); - #line 472 "Python/generated_cases.c.h" + #line 481 "Python/generated_cases.c.h" Py_DECREF(value); - #line 347 "Python/bytecodes.c" - res = Py_False; + #line 352 "Python/bytecodes.c" + res = Py_True; } - #line 477 "Python/generated_cases.c.h" + #line 486 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 1; DISPATCH(); @@ -482,13 +491,13 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 352 "Python/bytecodes.c" + #line 357 "Python/bytecodes.c" res = PyNumber_Invert(value); - #line 488 "Python/generated_cases.c.h" + #line 497 "Python/generated_cases.c.h" Py_DECREF(value); - #line 354 "Python/bytecodes.c" + #line 359 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 492 "Python/generated_cases.c.h" + #line 501 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -499,10 +508,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 370 "Python/bytecodes.c" + #line 375 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 506 "Python/generated_cases.c.h" + #line 515 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -510,13 +519,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 375 "Python/bytecodes.c" + #line 380 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 520 "Python/generated_cases.c.h" + #line 529 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -531,10 +540,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 370 "Python/bytecodes.c" + #line 375 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 538 "Python/generated_cases.c.h" + #line 547 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -542,13 +551,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 383 "Python/bytecodes.c" + #line 388 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 552 "Python/generated_cases.c.h" + #line 561 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -563,10 +572,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 370 "Python/bytecodes.c" + #line 375 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 570 "Python/generated_cases.c.h" + #line 579 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -574,13 +583,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 391 "Python/bytecodes.c" + #line 396 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 584 "Python/generated_cases.c.h" + #line 593 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -595,10 +604,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 406 "Python/bytecodes.c" + #line 411 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 602 "Python/generated_cases.c.h" + #line 611 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -606,13 +615,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 411 "Python/bytecodes.c" + #line 416 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 616 "Python/generated_cases.c.h" + #line 625 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -627,10 +636,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 406 "Python/bytecodes.c" + #line 411 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 634 "Python/generated_cases.c.h" + #line 643 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -638,13 +647,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 419 "Python/bytecodes.c" + #line 424 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 648 "Python/generated_cases.c.h" + #line 657 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -659,10 +668,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 406 "Python/bytecodes.c" + #line 411 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 666 "Python/generated_cases.c.h" + #line 675 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -670,13 +679,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 427 "Python/bytecodes.c" + #line 432 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 680 "Python/generated_cases.c.h" + #line 689 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -691,10 +700,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 442 "Python/bytecodes.c" + #line 447 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 698 "Python/generated_cases.c.h" + #line 707 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -702,13 +711,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 447 "Python/bytecodes.c" + #line 452 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; - #line 712 "Python/generated_cases.c.h" + #line 721 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -723,17 +732,17 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 442 "Python/bytecodes.c" + #line 447 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 730 "Python/generated_cases.c.h" + #line 739 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 464 "Python/bytecodes.c" + #line 469 "Python/bytecodes.c" _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; assert(true_next.op.code == STORE_FAST || true_next.op.code == STORE_FAST__LOAD_FAST); @@ -758,7 +767,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1); - #line 762 "Python/generated_cases.c.h" + #line 771 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -770,7 +779,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 502 "Python/bytecodes.c" + #line 507 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -782,12 +791,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); - #line 786 "Python/generated_cases.c.h" + #line 795 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 514 "Python/bytecodes.c" + #line 519 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 791 "Python/generated_cases.c.h" + #line 800 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -799,7 +808,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 518 "Python/bytecodes.c" + #line 523 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -812,7 +821,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; - #line 816 "Python/generated_cases.c.h" + #line 825 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -823,7 +832,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 533 "Python/bytecodes.c" + #line 538 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -836,7 +845,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; - #line 840 "Python/generated_cases.c.h" + #line 849 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -845,7 +854,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 548 "Python/bytecodes.c" + #line 553 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -859,7 +868,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 863 "Python/generated_cases.c.h" + #line 872 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -870,7 +879,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 564 "Python/bytecodes.c" + #line 569 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -884,7 +893,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); - #line 888 "Python/generated_cases.c.h" + #line 897 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -895,7 +904,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 580 "Python/bytecodes.c" + #line 585 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -903,14 +912,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } - #line 907 "Python/generated_cases.c.h" + #line 916 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 588 "Python/bytecodes.c" + #line 593 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub - #line 914 "Python/generated_cases.c.h" + #line 923 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -922,7 +931,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 595 "Python/bytecodes.c" + #line 600 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -945,15 +954,15 @@ JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 949 "Python/generated_cases.c.h" + #line 958 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 620 "Python/bytecodes.c" + #line 625 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; - #line 957 "Python/generated_cases.c.h" + #line 966 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -962,13 +971,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 625 "Python/bytecodes.c" + #line 630 "Python/bytecodes.c" int err = PySet_Add(set, v); - #line 968 "Python/generated_cases.c.h" + #line 977 "Python/generated_cases.c.h" Py_DECREF(v); - #line 627 "Python/bytecodes.c" + #line 632 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 972 "Python/generated_cases.c.h" + #line 981 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -981,7 +990,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 638 "Python/bytecodes.c" + #line 643 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -996,13 +1005,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); - #line 1000 "Python/generated_cases.c.h" + #line 1009 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 653 "Python/bytecodes.c" + #line 658 "Python/bytecodes.c" if (err) goto pop_3_error; - #line 1006 "Python/generated_cases.c.h" + #line 1015 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -1012,7 +1021,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 657 "Python/bytecodes.c" + #line 662 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -1029,7 +1038,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 1033 "Python/generated_cases.c.h" + #line 1042 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -1039,13 +1048,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 676 "Python/bytecodes.c" + #line 681 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; - #line 1049 "Python/generated_cases.c.h" + #line 1058 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -1054,15 +1063,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 684 "Python/bytecodes.c" + #line 689 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); - #line 1061 "Python/generated_cases.c.h" + #line 1070 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 687 "Python/bytecodes.c" + #line 692 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1066 "Python/generated_cases.c.h" + #line 1075 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1070,14 +1079,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 691 "Python/bytecodes.c" + #line 696 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); - #line 1077 "Python/generated_cases.c.h" + #line 1086 "Python/generated_cases.c.h" Py_DECREF(value); - #line 694 "Python/bytecodes.c" + #line 699 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 1081 "Python/generated_cases.c.h" + #line 1090 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -1086,15 +1095,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 698 "Python/bytecodes.c" + #line 703 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); - #line 1093 "Python/generated_cases.c.h" + #line 1102 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 701 "Python/bytecodes.c" + #line 706 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 1098 "Python/generated_cases.c.h" + #line 1107 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -1102,7 +1111,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 705 "Python/bytecodes.c" + #line 710 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -1120,12 +1129,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } - #line 1124 "Python/generated_cases.c.h" + #line 1133 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 725 "Python/bytecodes.c" + #line 730 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); STACK_SHRINK(1); // Since we're not going to DISPATCH() @@ -1136,12 +1145,12 @@ assert(!_PyErr_Occurred(tstate)); _Py_LeaveRecursiveCallTstate(tstate); return retval; - #line 1140 "Python/generated_cases.c.h" + #line 1149 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 738 "Python/bytecodes.c" + #line 743 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1154,12 +1163,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1158 "Python/generated_cases.c.h" + #line 1167 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 753 "Python/bytecodes.c" + #line 758 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1176,11 +1185,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1180 "Python/generated_cases.c.h" + #line 1189 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 772 "Python/bytecodes.c" + #line 777 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1194,11 +1203,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1198 "Python/generated_cases.c.h" + #line 1207 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 788 "Python/bytecodes.c" + #line 793 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1216,13 +1225,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1220 "Python/generated_cases.c.h" + #line 1229 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 808 "Python/bytecodes.c" + #line 813 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1235,16 +1244,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1239 "Python/generated_cases.c.h" + #line 1248 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 821 "Python/bytecodes.c" + #line 826 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1246 "Python/generated_cases.c.h" + #line 1255 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 826 "Python/bytecodes.c" + #line 831 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1257,7 +1266,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1261 "Python/generated_cases.c.h" + #line 1270 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1265,7 +1274,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 841 "Python/bytecodes.c" + #line 846 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1309,7 +1318,7 @@ } } - #line 1313 "Python/generated_cases.c.h" + #line 1322 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; PREDICT(LOAD_CONST); @@ -1320,16 +1329,16 @@ PREDICTED(GET_AWAITABLE); PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 888 "Python/bytecodes.c" + #line 893 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1331 "Python/generated_cases.c.h" + #line 1340 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 895 "Python/bytecodes.c" + #line 900 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1347,7 +1356,7 @@ if (iter == NULL) goto pop_1_error; - #line 1351 "Python/generated_cases.c.h" + #line 1360 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -1359,7 +1368,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 921 "Python/bytecodes.c" + #line 926 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1406,7 +1415,7 @@ } } Py_DECREF(v); - #line 1410 "Python/generated_cases.c.h" + #line 1419 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1415,7 +1424,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 970 "Python/bytecodes.c" + #line 975 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1431,12 +1440,12 @@ tstate->exc_info = &gen->gi_exc_state; JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1435 "Python/generated_cases.c.h" + #line 1444 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 988 "Python/bytecodes.c" + #line 993 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1453,12 +1462,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1457 "Python/generated_cases.c.h" + #line 1466 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1007 "Python/bytecodes.c" + #line 1012 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1474,15 +1483,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1478 "Python/generated_cases.c.h" + #line 1487 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 1025 "Python/bytecodes.c" + #line 1030 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1486 "Python/generated_cases.c.h" + #line 1495 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1490,7 +1499,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 1030 "Python/bytecodes.c" + #line 1035 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1508,26 +1517,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1512 "Python/generated_cases.c.h" + #line 1521 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 1050 "Python/bytecodes.c" + #line 1055 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1521 "Python/generated_cases.c.h" + #line 1530 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 1053 "Python/bytecodes.c" + #line 1058 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1531 "Python/generated_cases.c.h" + #line 1540 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1538,23 +1547,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1062 "Python/bytecodes.c" + #line 1067 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1547 "Python/generated_cases.c.h" + #line 1556 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1067 "Python/bytecodes.c" + #line 1072 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1558 "Python/generated_cases.c.h" + #line 1567 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1563,9 +1572,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1076 "Python/bytecodes.c" + #line 1081 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1569 "Python/generated_cases.c.h" + #line 1578 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1573,7 +1582,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1080 "Python/bytecodes.c" + #line 1085 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1595,7 +1604,7 @@ if (true) goto error; } } - #line 1599 "Python/generated_cases.c.h" + #line 1608 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1603,33 +1612,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1105 "Python/bytecodes.c" + #line 1110 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1614 "Python/generated_cases.c.h" + #line 1623 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1112 "Python/bytecodes.c" + #line 1117 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1623 "Python/generated_cases.c.h" + #line 1632 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1119 "Python/bytecodes.c" + #line 1124 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1627 "Python/generated_cases.c.h" + #line 1636 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1123 "Python/bytecodes.c" + #line 1128 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1646,7 +1655,7 @@ name); goto error; } - #line 1650 "Python/generated_cases.c.h" + #line 1659 "Python/generated_cases.c.h" DISPATCH(); } @@ -1654,7 +1663,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1149 "Python/bytecodes.c" + #line 1154 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1667,11 +1676,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1671 "Python/generated_cases.c.h" + #line 1680 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1162 "Python/bytecodes.c" + #line 1167 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1675 "Python/generated_cases.c.h" + #line 1684 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1681,14 +1690,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1166 "Python/bytecodes.c" + #line 1171 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1692 "Python/generated_cases.c.h" + #line 1701 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1699,7 +1708,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1176 "Python/bytecodes.c" + #line 1181 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1707,7 +1716,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1711 "Python/generated_cases.c.h" + #line 1720 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1718,7 +1727,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1187 "Python/bytecodes.c" + #line 1192 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1726,7 +1735,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1730 "Python/generated_cases.c.h" + #line 1739 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1736,15 +1745,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1198 "Python/bytecodes.c" + #line 1203 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); - #line 1744 "Python/generated_cases.c.h" + #line 1753 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1202 "Python/bytecodes.c" + #line 1207 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1748 "Python/generated_cases.c.h" + #line 1757 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1755,7 +1764,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1213 "Python/bytecodes.c" + #line 1218 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1771,12 +1780,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1775 "Python/generated_cases.c.h" + #line 1784 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1229 "Python/bytecodes.c" + #line 1234 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1780 "Python/generated_cases.c.h" + #line 1789 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1784,34 +1793,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1233 "Python/bytecodes.c" + #line 1238 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1791 "Python/generated_cases.c.h" + #line 1800 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1236 "Python/bytecodes.c" + #line 1241 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1795 "Python/generated_cases.c.h" + #line 1804 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1240 "Python/bytecodes.c" + #line 1245 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1805 "Python/generated_cases.c.h" + #line 1814 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1243 "Python/bytecodes.c" + #line 1248 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1809 "Python/generated_cases.c.h" + #line 1818 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1247 "Python/bytecodes.c" + #line 1252 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1823,7 +1832,7 @@ } goto error; } - #line 1827 "Python/generated_cases.c.h" + #line 1836 "Python/generated_cases.c.h" DISPATCH(); } @@ -1831,7 +1840,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1261 "Python/bytecodes.c" + #line 1266 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1839,7 +1848,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1843 "Python/generated_cases.c.h" + #line 1852 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1851,7 +1860,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1261 "Python/bytecodes.c" + #line 1266 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1859,13 +1868,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1863 "Python/generated_cases.c.h" + #line 1872 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1273 "Python/bytecodes.c" + #line 1278 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1922,7 +1931,7 @@ } } } - #line 1926 "Python/generated_cases.c.h" + #line 1935 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1935,7 +1944,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1273 "Python/bytecodes.c" + #line 1278 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1992,7 +2001,7 @@ } } } - #line 1996 "Python/generated_cases.c.h" + #line 2005 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -2004,7 +2013,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1342 "Python/bytecodes.c" + #line 1347 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2056,7 +2065,7 @@ } } null = NULL; - #line 2060 "Python/generated_cases.c.h" + #line 2069 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -2070,7 +2079,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1396 "Python/bytecodes.c" + #line 1401 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -2081,7 +2090,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2085 "Python/generated_cases.c.h" + #line 2094 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2096,7 +2105,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1409 "Python/bytecodes.c" + #line 1414 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -2111,7 +2120,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2115 "Python/generated_cases.c.h" + #line 2124 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2121,16 +2130,16 @@ } TARGET(DELETE_FAST) { - #line 1426 "Python/bytecodes.c" + #line 1431 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 2129 "Python/generated_cases.c.h" + #line 2138 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1432 "Python/bytecodes.c" + #line 1437 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -2139,12 +2148,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2143 "Python/generated_cases.c.h" + #line 2152 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1443 "Python/bytecodes.c" + #line 1448 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2155,14 +2164,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2159 "Python/generated_cases.c.h" + #line 2168 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1456 "Python/bytecodes.c" + #line 1461 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -2197,14 +2206,14 @@ } Py_INCREF(value); } - #line 2201 "Python/generated_cases.c.h" + #line 2210 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1493 "Python/bytecodes.c" + #line 1498 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2212,7 +2221,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2216 "Python/generated_cases.c.h" + #line 2225 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2220,18 +2229,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1503 "Python/bytecodes.c" + #line 1508 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2229 "Python/generated_cases.c.h" + #line 2238 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1510 "Python/bytecodes.c" + #line 1515 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -2242,22 +2251,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2246 "Python/generated_cases.c.h" + #line 2255 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1523 "Python/bytecodes.c" + #line 1528 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2255 "Python/generated_cases.c.h" + #line 2264 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1525 "Python/bytecodes.c" + #line 1530 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2261 "Python/generated_cases.c.h" + #line 2270 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2267,10 +2276,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1529 "Python/bytecodes.c" + #line 1534 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2274 "Python/generated_cases.c.h" + #line 2283 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2280,10 +2289,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1534 "Python/bytecodes.c" + #line 1539 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2287 "Python/generated_cases.c.h" + #line 2296 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2293,7 +2302,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1539 "Python/bytecodes.c" + #line 1544 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2304,13 +2313,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2308 "Python/generated_cases.c.h" + #line 2317 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1550 "Python/bytecodes.c" + #line 1555 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2314 "Python/generated_cases.c.h" + #line 2323 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2319,13 +2328,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1557 "Python/bytecodes.c" + #line 1562 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2325 "Python/generated_cases.c.h" + #line 2334 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1559 "Python/bytecodes.c" + #line 1564 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2329 "Python/generated_cases.c.h" + #line 2338 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2333,7 +2342,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1563 "Python/bytecodes.c" + #line 1568 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2348,7 +2357,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2352 "Python/generated_cases.c.h" + #line 2361 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2358,7 +2367,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1580 "Python/bytecodes.c" + #line 1585 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2366,13 +2375,13 @@ if (map == NULL) goto error; - #line 2370 "Python/generated_cases.c.h" + #line 2379 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1588 "Python/bytecodes.c" + #line 1593 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2376 "Python/generated_cases.c.h" + #line 2385 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2380,7 +2389,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1592 "Python/bytecodes.c" + #line 1597 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2420,7 +2429,7 @@ Py_DECREF(ann_dict); } } - #line 2424 "Python/generated_cases.c.h" + #line 2433 "Python/generated_cases.c.h" DISPATCH(); } @@ -2428,7 +2437,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1634 "Python/bytecodes.c" + #line 1639 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2438,14 +2447,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2442 "Python/generated_cases.c.h" + #line 2451 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1644 "Python/bytecodes.c" + #line 1649 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2449 "Python/generated_cases.c.h" + #line 2458 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2453,7 +2462,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1648 "Python/bytecodes.c" + #line 1653 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -2461,12 +2470,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2465 "Python/generated_cases.c.h" + #line 2474 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1656 "Python/bytecodes.c" + #line 1661 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2470 "Python/generated_cases.c.h" + #line 2479 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2474,17 +2483,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1662 "Python/bytecodes.c" + #line 1667 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (_PyDict_MergeEx(dict, update, 2) < 0) { format_kwargs_error(tstate, PEEK(3 + oparg), update); - #line 2483 "Python/generated_cases.c.h" + #line 2492 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1667 "Python/bytecodes.c" + #line 1672 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2488 "Python/generated_cases.c.h" + #line 2497 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2494,26 +2503,26 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1674 "Python/bytecodes.c" + #line 1679 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2504 "Python/generated_cases.c.h" + #line 2513 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1683 "Python/bytecodes.c" + #line 1688 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); - #line 2517 "Python/generated_cases.c.h" + #line 2526 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2524,7 +2533,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1697 "Python/bytecodes.c" + #line 1702 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2566,16 +2575,16 @@ } } } - #line 2570 "Python/generated_cases.c.h" + #line 2579 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1739 "Python/bytecodes.c" + #line 1744 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; - #line 2579 "Python/generated_cases.c.h" + #line 2588 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2590,20 +2599,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1746 "Python/bytecodes.c" + #line 1751 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2601 "Python/generated_cases.c.h" + #line 2610 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1753 "Python/bytecodes.c" + #line 1758 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2607 "Python/generated_cases.c.h" + #line 2616 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2618,7 +2627,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1757 "Python/bytecodes.c" + #line 1762 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2641,7 +2650,7 @@ res = res2; res2 = NULL; } - #line 2645 "Python/generated_cases.c.h" + #line 2654 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2655,7 +2664,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1796 "Python/bytecodes.c" + #line 1801 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2689,9 +2698,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2693 "Python/generated_cases.c.h" + #line 2702 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1830 "Python/bytecodes.c" + #line 1835 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2700,12 +2709,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2704 "Python/generated_cases.c.h" + #line 2713 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1839 "Python/bytecodes.c" + #line 1844 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2709 "Python/generated_cases.c.h" + #line 2718 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2719,7 +2728,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1844 "Python/bytecodes.c" + #line 1849 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2732,7 +2741,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2736 "Python/generated_cases.c.h" + #line 2745 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2747,7 +2756,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1860 "Python/bytecodes.c" + #line 1865 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2760,7 +2769,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2764 "Python/generated_cases.c.h" + #line 2773 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2775,7 +2784,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1876 "Python/bytecodes.c" + #line 1881 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2802,7 +2811,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2806 "Python/generated_cases.c.h" + #line 2815 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2817,7 +2826,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1906 "Python/bytecodes.c" + #line 1911 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2827,7 +2836,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2831 "Python/generated_cases.c.h" + #line 2840 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2842,7 +2851,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1919 "Python/bytecodes.c" + #line 1924 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2854,7 +2863,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2858 "Python/generated_cases.c.h" + #line 2867 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2868,7 +2877,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1934 "Python/bytecodes.c" + #line 1939 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2892,7 +2901,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2896 "Python/generated_cases.c.h" + #line 2905 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2900,7 +2909,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 1960 "Python/bytecodes.c" + #line 1965 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2926,7 +2935,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2930 "Python/generated_cases.c.h" + #line 2939 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2934,7 +2943,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1988 "Python/bytecodes.c" + #line 1993 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2952,7 +2961,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2956 "Python/generated_cases.c.h" + #line 2965 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2963,7 +2972,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 2008 "Python/bytecodes.c" + #line 2013 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -3002,7 +3011,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 3006 "Python/generated_cases.c.h" + #line 3015 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -3013,7 +3022,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2049 "Python/bytecodes.c" + #line 2054 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -3023,7 +3032,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 3027 "Python/generated_cases.c.h" + #line 3036 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -3035,7 +3044,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2068 "Python/bytecodes.c" + #line 2073 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3048,12 +3057,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 3052 "Python/generated_cases.c.h" + #line 3061 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2081 "Python/bytecodes.c" + #line 2086 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3057 "Python/generated_cases.c.h" + #line 3066 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3064,7 +3073,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2085 "Python/bytecodes.c" + #line 2090 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3075,7 +3084,7 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 3079 "Python/generated_cases.c.h" + #line 3088 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3086,7 +3095,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2099 "Python/bytecodes.c" + #line 2104 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -3101,7 +3110,7 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 3105 "Python/generated_cases.c.h" + #line 3114 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3112,7 +3121,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2117 "Python/bytecodes.c" + #line 2122 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3124,7 +3133,7 @@ assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS); assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; - #line 3128 "Python/generated_cases.c.h" + #line 3137 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3135,14 +3144,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2131 "Python/bytecodes.c" + #line 2136 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3141 "Python/generated_cases.c.h" + #line 3150 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2133 "Python/bytecodes.c" + #line 2138 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3146 "Python/generated_cases.c.h" + #line 3155 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3152,15 +3161,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2137 "Python/bytecodes.c" + #line 2142 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3158 "Python/generated_cases.c.h" + #line 3167 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2139 "Python/bytecodes.c" + #line 2144 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3164 "Python/generated_cases.c.h" + #line 3173 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3171,12 +3180,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2144 "Python/bytecodes.c" + #line 2149 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3177 "Python/generated_cases.c.h" + #line 3186 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2146 "Python/bytecodes.c" + #line 2151 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3184,10 +3193,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3188 "Python/generated_cases.c.h" + #line 3197 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2154 "Python/bytecodes.c" + #line 2159 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3196,7 +3205,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3200 "Python/generated_cases.c.h" + #line 3209 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3206,21 +3215,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2165 "Python/bytecodes.c" + #line 2170 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3213 "Python/generated_cases.c.h" + #line 3222 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2168 "Python/bytecodes.c" + #line 2173 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3220 "Python/generated_cases.c.h" + #line 3229 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2173 "Python/bytecodes.c" + #line 2178 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3224 "Python/generated_cases.c.h" + #line 3233 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3229,15 +3238,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2177 "Python/bytecodes.c" + #line 2182 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3236 "Python/generated_cases.c.h" + #line 3245 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2180 "Python/bytecodes.c" + #line 2185 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3241 "Python/generated_cases.c.h" + #line 3250 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3246,26 +3255,26 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2184 "Python/bytecodes.c" + #line 2189 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3254 "Python/generated_cases.c.h" + #line 3263 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2190 "Python/bytecodes.c" + #line 2195 "Python/bytecodes.c" JUMPBY(oparg); - #line 3263 "Python/generated_cases.c.h" + #line 3272 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2194 "Python/bytecodes.c" + #line 2199 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3282,13 +3291,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3286 "Python/generated_cases.c.h" + #line 3295 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2214 "Python/bytecodes.c" + #line 2219 "Python/bytecodes.c" _PyExecutorObject *executor = (_PyExecutorObject *)frame->f_code->co_executors->executors[oparg]; Py_INCREF(executor); frame = executor->execute(executor, frame, stack_pointer); @@ -3297,86 +3306,86 @@ goto error; } goto resume_frame; - #line 3301 "Python/generated_cases.c.h" + #line 3310 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2225 "Python/bytecodes.c" + #line 2230 "Python/bytecodes.c" assert(PyBool_Check(cond)); if (Py_IsFalse(cond)) { JUMPBY(oparg); } - #line 3312 "Python/generated_cases.c.h" + #line 3321 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2232 "Python/bytecodes.c" + #line 2237 "Python/bytecodes.c" assert(PyBool_Check(cond)); if (Py_IsTrue(cond)) { JUMPBY(oparg); } - #line 3324 "Python/generated_cases.c.h" + #line 3333 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2239 "Python/bytecodes.c" + #line 2244 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3333 "Python/generated_cases.c.h" + #line 3342 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2241 "Python/bytecodes.c" + #line 2246 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3338 "Python/generated_cases.c.h" + #line 3347 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2246 "Python/bytecodes.c" + #line 2251 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3350 "Python/generated_cases.c.h" + #line 3359 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2251 "Python/bytecodes.c" + #line 2256 "Python/bytecodes.c" } - #line 3354 "Python/generated_cases.c.h" + #line 3363 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2255 "Python/bytecodes.c" + #line 2260 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3367 "Python/generated_cases.c.h" + #line 3376 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2264 "Python/bytecodes.c" + #line 2269 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3380 "Python/generated_cases.c.h" + #line 3389 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3387,16 +3396,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2272 "Python/bytecodes.c" + #line 2277 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3396 "Python/generated_cases.c.h" + #line 3405 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2277 "Python/bytecodes.c" + #line 2282 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3404,7 +3413,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3408 "Python/generated_cases.c.h" + #line 3417 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3413,10 +3422,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2287 "Python/bytecodes.c" + #line 2292 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3420 "Python/generated_cases.c.h" + #line 3429 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3426,10 +3435,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2293 "Python/bytecodes.c" + #line 2298 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3433 "Python/generated_cases.c.h" + #line 3442 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3440,11 +3449,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2299 "Python/bytecodes.c" + #line 2304 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3448 "Python/generated_cases.c.h" + #line 3457 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3453,14 +3462,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2305 "Python/bytecodes.c" + #line 2310 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3460 "Python/generated_cases.c.h" + #line 3469 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2308 "Python/bytecodes.c" + #line 2313 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3464 "Python/generated_cases.c.h" + #line 3473 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3468,7 +3477,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2312 "Python/bytecodes.c" + #line 2317 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3491,11 +3500,11 @@ if (iter == NULL) { goto error; } - #line 3495 "Python/generated_cases.c.h" + #line 3504 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2335 "Python/bytecodes.c" + #line 2340 "Python/bytecodes.c" } - #line 3499 "Python/generated_cases.c.h" + #line 3508 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3506,7 +3515,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2354 "Python/bytecodes.c" + #line 2359 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3537,7 +3546,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3541 "Python/generated_cases.c.h" + #line 3550 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3545,7 +3554,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2387 "Python/bytecodes.c" + #line 2392 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3571,14 +3580,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3575 "Python/generated_cases.c.h" + #line 3584 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2415 "Python/bytecodes.c" + #line 2420 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3598,7 +3607,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3602 "Python/generated_cases.c.h" + #line 3611 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3608,7 +3617,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2437 "Python/bytecodes.c" + #line 2442 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3628,7 +3637,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3632 "Python/generated_cases.c.h" + #line 3641 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3638,7 +3647,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2459 "Python/bytecodes.c" + #line 2464 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3656,7 +3665,7 @@ if (next == NULL) { goto error; } - #line 3660 "Python/generated_cases.c.h" + #line 3669 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3665,7 +3674,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2479 "Python/bytecodes.c" + #line 2484 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3681,14 +3690,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3685 "Python/generated_cases.c.h" + #line 3694 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2497 "Python/bytecodes.c" + #line 2502 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3711,16 +3720,16 @@ Py_DECREF(enter); goto error; } - #line 3715 "Python/generated_cases.c.h" + #line 3724 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2520 "Python/bytecodes.c" + #line 2525 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3724 "Python/generated_cases.c.h" + #line 3733 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3732,7 +3741,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2530 "Python/bytecodes.c" + #line 2535 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3758,16 +3767,16 @@ Py_DECREF(enter); goto error; } - #line 3762 "Python/generated_cases.c.h" + #line 3771 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2556 "Python/bytecodes.c" + #line 2561 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3771 "Python/generated_cases.c.h" + #line 3780 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3779,7 +3788,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2565 "Python/bytecodes.c" + #line 2570 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3800,7 +3809,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3804 "Python/generated_cases.c.h" + #line 3813 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3809,7 +3818,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2588 "Python/bytecodes.c" + #line 2593 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3819,7 +3828,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3823 "Python/generated_cases.c.h" + #line 3832 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3833,7 +3842,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2600 "Python/bytecodes.c" + #line 2605 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3850,7 +3859,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3854 "Python/generated_cases.c.h" + #line 3863 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3864,7 +3873,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2619 "Python/bytecodes.c" + #line 2624 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3874,7 +3883,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3878 "Python/generated_cases.c.h" + #line 3887 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3888,7 +3897,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2631 "Python/bytecodes.c" + #line 2636 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3902,7 +3911,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3906 "Python/generated_cases.c.h" + #line 3915 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3911,16 +3920,16 @@ } TARGET(KW_NAMES) { - #line 2647 "Python/bytecodes.c" + #line 2652 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3919 "Python/generated_cases.c.h" + #line 3928 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2653 "Python/bytecodes.c" + #line 2658 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3933,7 +3942,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3937 "Python/generated_cases.c.h" + #line 3946 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3943,7 +3952,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2698 "Python/bytecodes.c" + #line 2703 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4025,7 +4034,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4029 "Python/generated_cases.c.h" + #line 4038 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4037,7 +4046,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2786 "Python/bytecodes.c" + #line 2791 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -4047,7 +4056,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 4051 "Python/generated_cases.c.h" + #line 4060 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -4056,7 +4065,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2798 "Python/bytecodes.c" + #line 2803 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4082,7 +4091,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4086 "Python/generated_cases.c.h" + #line 4095 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4090,7 +4099,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2826 "Python/bytecodes.c" + #line 2831 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4126,7 +4135,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4130 "Python/generated_cases.c.h" + #line 4139 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4134,7 +4143,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2864 "Python/bytecodes.c" + #line 2869 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4144,7 +4153,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4148 "Python/generated_cases.c.h" + #line 4157 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4157,7 +4166,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2876 "Python/bytecodes.c" + #line 2881 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4168,7 +4177,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4172 "Python/generated_cases.c.h" + #line 4181 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4182,7 +4191,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2890 "Python/bytecodes.c" + #line 2895 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4193,7 +4202,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4197 "Python/generated_cases.c.h" + #line 4206 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4207,7 +4216,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2904 "Python/bytecodes.c" + #line 2909 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4229,7 +4238,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4233 "Python/generated_cases.c.h" + #line 4242 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4243,7 +4252,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2929 "Python/bytecodes.c" + #line 2934 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4271,7 +4280,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4275 "Python/generated_cases.c.h" + #line 4284 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4285,7 +4294,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2960 "Python/bytecodes.c" + #line 2965 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4317,7 +4326,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4321 "Python/generated_cases.c.h" + #line 4330 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4331,7 +4340,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2995 "Python/bytecodes.c" + #line 3000 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4363,7 +4372,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4367 "Python/generated_cases.c.h" + #line 4376 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4377,7 +4386,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3030 "Python/bytecodes.c" + #line 3035 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4402,7 +4411,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4406 "Python/generated_cases.c.h" + #line 4415 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4415,7 +4424,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3057 "Python/bytecodes.c" + #line 3062 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4442,7 +4451,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4446 "Python/generated_cases.c.h" + #line 4455 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4454,7 +4463,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3087 "Python/bytecodes.c" + #line 3092 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4472,14 +4481,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4476 "Python/generated_cases.c.h" + #line 4485 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3107 "Python/bytecodes.c" + #line 3112 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4510,7 +4519,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4514 "Python/generated_cases.c.h" + #line 4523 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4523,7 +4532,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3141 "Python/bytecodes.c" + #line 3146 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4552,7 +4561,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4556 "Python/generated_cases.c.h" + #line 4565 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4565,7 +4574,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3173 "Python/bytecodes.c" + #line 3178 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4594,7 +4603,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4598 "Python/generated_cases.c.h" + #line 4607 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4607,7 +4616,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3205 "Python/bytecodes.c" + #line 3210 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4635,7 +4644,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4639 "Python/generated_cases.c.h" + #line 4648 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4645,9 +4654,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3236 "Python/bytecodes.c" + #line 3241 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4651 "Python/generated_cases.c.h" + #line 4660 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4656,7 +4665,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3240 "Python/bytecodes.c" + #line 3245 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4718,14 +4727,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4722 "Python/generated_cases.c.h" + #line 4731 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3302 "Python/bytecodes.c" + #line 3307 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4729 "Python/generated_cases.c.h" + #line 4738 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4740,7 +4749,7 @@ PyObject *kwdefaults = (oparg & MAKE_FUNCTION_KWDEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & MAKE_FUNCTION_DEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0))] : NULL; PyObject *func; - #line 3312 "Python/bytecodes.c" + #line 3317 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4769,14 +4778,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4773 "Python/generated_cases.c.h" + #line 4782 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3343 "Python/bytecodes.c" + #line 3348 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4797,7 +4806,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4801 "Python/generated_cases.c.h" + #line 4810 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4805,15 +4814,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3366 "Python/bytecodes.c" + #line 3371 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4811 "Python/generated_cases.c.h" + #line 4820 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3368 "Python/bytecodes.c" + #line 3373 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4817 "Python/generated_cases.c.h" + #line 4826 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4824,7 +4833,7 @@ PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? stack_pointer[-((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))] : NULL; PyObject *value = stack_pointer[-(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))]; PyObject *result; - #line 3372 "Python/bytecodes.c" + #line 3377 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4859,7 +4868,7 @@ Py_DECREF(value); Py_XDECREF(fmt_spec); if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - #line 4863 "Python/generated_cases.c.h" + #line 4872 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4868,10 +4877,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3409 "Python/bytecodes.c" + #line 3414 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4875 "Python/generated_cases.c.h" + #line 4884 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4883,7 +4892,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3414 "Python/bytecodes.c" + #line 3419 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4898,12 +4907,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4902 "Python/generated_cases.c.h" + #line 4911 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3429 "Python/bytecodes.c" + #line 3434 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4907 "Python/generated_cases.c.h" + #line 4916 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4913,16 +4922,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3434 "Python/bytecodes.c" + #line 3439 "Python/bytecodes.c" assert(oparg >= 2); - #line 4919 "Python/generated_cases.c.h" + #line 4928 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3438 "Python/bytecodes.c" + #line 3443 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4934,26 +4943,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4938 "Python/generated_cases.c.h" + #line 4947 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3452 "Python/bytecodes.c" + #line 3457 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4944 "Python/generated_cases.c.h" + #line 4953 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3456 "Python/bytecodes.c" + #line 3461 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4951 "Python/generated_cases.c.h" + #line 4960 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3461 "Python/bytecodes.c" + #line 3466 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4962,12 +4971,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4966 "Python/generated_cases.c.h" + #line 4975 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3472 "Python/bytecodes.c" + #line 3477 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4976,12 +4985,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4980 "Python/generated_cases.c.h" + #line 4989 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3483 "Python/bytecodes.c" + #line 3488 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4993,12 +5002,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4997 "Python/generated_cases.c.h" + #line 5006 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3497 "Python/bytecodes.c" + #line 3502 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -5010,30 +5019,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 5014 "Python/generated_cases.c.h" + #line 5023 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3511 "Python/bytecodes.c" + #line 3516 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 5025 "Python/generated_cases.c.h" + #line 5034 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3519 "Python/bytecodes.c" + #line 3524 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 5032 "Python/generated_cases.c.h" + #line 5041 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3524 "Python/bytecodes.c" + #line 3529 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 5039 "Python/generated_cases.c.h" + #line 5048 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 4405b659629c75..5c899e73d716af 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -53,15 +53,17 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case UNARY_NOT: return 1; - case UNARY_NOT_BOOL: + case TO_BOOL: return 1; - case UNARY_NOT_INT: + case TO_BOOL_BOOL: return 1; - case UNARY_NOT_LIST: + case TO_BOOL_INT: return 1; - case UNARY_NOT_NONE: + case TO_BOOL_LIST: return 1; - case UNARY_NOT_STR: + case TO_BOOL_NONE: + return 1; + case TO_BOOL_STR: return 1; case UNARY_INVERT: return 1; @@ -461,15 +463,17 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 1; case UNARY_NOT: return 1; - case UNARY_NOT_BOOL: + case TO_BOOL: + return 1; + case TO_BOOL_BOOL: return 1; - case UNARY_NOT_INT: + case TO_BOOL_INT: return 1; - case UNARY_NOT_LIST: + case TO_BOOL_LIST: return 1; - case UNARY_NOT_NONE: + case TO_BOOL_NONE: return 1; - case UNARY_NOT_STR: + case TO_BOOL_STR: return 1; case UNARY_INVERT: return 1; @@ -850,12 +854,13 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [END_SEND] = { true, INSTR_FMT_IX }, [INSTRUMENTED_END_SEND] = { true, INSTR_FMT_IX }, [UNARY_NEGATIVE] = { true, INSTR_FMT_IX }, - [UNARY_NOT] = { true, INSTR_FMT_IXC }, - [UNARY_NOT_BOOL] = { true, INSTR_FMT_IXC }, - [UNARY_NOT_INT] = { true, INSTR_FMT_IXC }, - [UNARY_NOT_LIST] = { true, INSTR_FMT_IXC }, - [UNARY_NOT_NONE] = { true, INSTR_FMT_IXC }, - [UNARY_NOT_STR] = { true, INSTR_FMT_IXC }, + [UNARY_NOT] = { true, INSTR_FMT_IX }, + [TO_BOOL] = { true, INSTR_FMT_IXC }, + [TO_BOOL_BOOL] = { true, INSTR_FMT_IXC }, + [TO_BOOL_INT] = { true, INSTR_FMT_IXC }, + [TO_BOOL_LIST] = { true, INSTR_FMT_IXC }, + [TO_BOOL_NONE] = { true, INSTR_FMT_IXC }, + [TO_BOOL_STR] = { true, INSTR_FMT_IXC }, [UNARY_INVERT] = { true, INSTR_FMT_IX }, [BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IBC }, [BINARY_OP_ADD_INT] = { true, INSTR_FMT_IBC }, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 9325f1d1923a28..9d47be4290dc50 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -5,38 +5,39 @@ static void *opcode_targets[256] = { &&TARGET_INTERPRETER_EXIT, &&TARGET_END_FOR, &&TARGET_END_SEND, + &&TARGET_TO_BOOL, &&TARGET_BINARY_OP_ADD_FLOAT, &&TARGET_BINARY_OP_ADD_INT, - &&TARGET_BINARY_OP_ADD_UNICODE, &&TARGET_NOP, - &&TARGET_BINARY_OP_INPLACE_ADD_UNICODE, + &&TARGET_BINARY_OP_ADD_UNICODE, &&TARGET_UNARY_NEGATIVE, &&TARGET_UNARY_NOT, + &&TARGET_BINARY_OP_INPLACE_ADD_UNICODE, &&TARGET_BINARY_OP_MULTIPLY_FLOAT, - &&TARGET_BINARY_OP_MULTIPLY_INT, &&TARGET_UNARY_INVERT, - &&TARGET_BINARY_OP_SUBTRACT_FLOAT, + &&TARGET_BINARY_OP_MULTIPLY_INT, &&TARGET_RESERVED, + &&TARGET_BINARY_OP_SUBTRACT_FLOAT, &&TARGET_BINARY_OP_SUBTRACT_INT, &&TARGET_BINARY_SUBSCR_DICT, &&TARGET_BINARY_SUBSCR_GETITEM, &&TARGET_BINARY_SUBSCR_LIST_INT, &&TARGET_BINARY_SUBSCR_TUPLE_INT, &&TARGET_CALL_PY_EXACT_ARGS, - &&TARGET_CALL_PY_WITH_DEFAULTS, &&TARGET_BINARY_SUBSCR, &&TARGET_BINARY_SLICE, &&TARGET_STORE_SLICE, + &&TARGET_CALL_PY_WITH_DEFAULTS, &&TARGET_CALL_BOUND_METHOD_EXACT_ARGS, - &&TARGET_CALL_BUILTIN_CLASS, &&TARGET_GET_LEN, &&TARGET_MATCH_MAPPING, &&TARGET_MATCH_SEQUENCE, &&TARGET_MATCH_KEYS, - &&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS, + &&TARGET_CALL_BUILTIN_CLASS, &&TARGET_PUSH_EXC_INFO, &&TARGET_CHECK_EXC_MATCH, &&TARGET_CHECK_EG_MATCH, + &&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS, &&TARGET_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, &&TARGET_CALL_NO_KW_BUILTIN_FAST, &&TARGET_CALL_NO_KW_BUILTIN_O, @@ -47,7 +48,6 @@ static void *opcode_targets[256] = { &&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS, &&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_O, &&TARGET_CALL_NO_KW_STR_1, - &&TARGET_CALL_NO_KW_TUPLE_1, &&TARGET_WITH_EXCEPT_START, &&TARGET_GET_AITER, &&TARGET_GET_ANEXT, @@ -55,39 +55,39 @@ static void *opcode_targets[256] = { &&TARGET_BEFORE_WITH, &&TARGET_END_ASYNC_FOR, &&TARGET_CLEANUP_THROW, + &&TARGET_CALL_NO_KW_TUPLE_1, &&TARGET_CALL_NO_KW_TYPE_1, &&TARGET_COMPARE_OP_FLOAT, &&TARGET_COMPARE_OP_INT, - &&TARGET_COMPARE_OP_STR, &&TARGET_STORE_SUBSCR, &&TARGET_DELETE_SUBSCR, + &&TARGET_COMPARE_OP_STR, &&TARGET_FOR_ITER_LIST, &&TARGET_FOR_ITER_TUPLE, &&TARGET_FOR_ITER_RANGE, &&TARGET_FOR_ITER_GEN, &&TARGET_LOAD_SUPER_ATTR_ATTR, - &&TARGET_LOAD_SUPER_ATTR_METHOD, &&TARGET_GET_ITER, &&TARGET_GET_YIELD_FROM_ITER, - &&TARGET_LOAD_ATTR_CLASS, + &&TARGET_LOAD_SUPER_ATTR_METHOD, &&TARGET_LOAD_BUILD_CLASS, + &&TARGET_LOAD_ATTR_CLASS, &&TARGET_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN, - &&TARGET_LOAD_ATTR_INSTANCE_VALUE, &&TARGET_LOAD_ASSERTION_ERROR, &&TARGET_RETURN_GENERATOR, + &&TARGET_LOAD_ATTR_INSTANCE_VALUE, &&TARGET_LOAD_ATTR_MODULE, &&TARGET_LOAD_ATTR_PROPERTY, &&TARGET_LOAD_ATTR_SLOT, &&TARGET_LOAD_ATTR_WITH_HINT, &&TARGET_LOAD_ATTR_METHOD_LAZY_DICT, &&TARGET_LOAD_ATTR_METHOD_NO_DICT, - &&TARGET_LOAD_ATTR_METHOD_WITH_VALUES, &&TARGET_RETURN_VALUE, - &&TARGET_LOAD_CONST__LOAD_FAST, + &&TARGET_LOAD_ATTR_METHOD_WITH_VALUES, &&TARGET_SETUP_ANNOTATIONS, - &&TARGET_LOAD_FAST__LOAD_CONST, + &&TARGET_LOAD_CONST__LOAD_FAST, &&TARGET_LOAD_LOCALS, - &&TARGET_LOAD_FAST__LOAD_FAST, + &&TARGET_LOAD_FAST__LOAD_CONST, &&TARGET_POP_EXCEPT, &&TARGET_STORE_NAME, &&TARGET_DELETE_NAME, @@ -110,9 +110,9 @@ static void *opcode_targets[256] = { &&TARGET_IMPORT_NAME, &&TARGET_IMPORT_FROM, &&TARGET_JUMP_FORWARD, + &&TARGET_LOAD_FAST__LOAD_FAST, &&TARGET_LOAD_GLOBAL_BUILTIN, &&TARGET_LOAD_GLOBAL_MODULE, - &&TARGET_STORE_ATTR_INSTANCE_VALUE, &&TARGET_POP_JUMP_IF_FALSE, &&TARGET_POP_JUMP_IF_TRUE, &&TARGET_LOAD_GLOBAL, @@ -147,39 +147,39 @@ static void *opcode_targets[256] = { &&TARGET_LIST_APPEND, &&TARGET_SET_ADD, &&TARGET_MAP_ADD, - &&TARGET_STORE_ATTR_SLOT, + &&TARGET_STORE_ATTR_INSTANCE_VALUE, &&TARGET_COPY_FREE_VARS, &&TARGET_YIELD_VALUE, &&TARGET_RESUME, &&TARGET_MATCH_CLASS, + &&TARGET_STORE_ATTR_SLOT, &&TARGET_STORE_ATTR_WITH_HINT, - &&TARGET_STORE_FAST__LOAD_FAST, &&TARGET_FORMAT_VALUE, &&TARGET_BUILD_CONST_KEY_MAP, &&TARGET_BUILD_STRING, + &&TARGET_STORE_FAST__LOAD_FAST, &&TARGET_STORE_FAST__STORE_FAST, &&TARGET_STORE_SUBSCR_DICT, &&TARGET_STORE_SUBSCR_LIST_INT, - &&TARGET_UNPACK_SEQUENCE_LIST, &&TARGET_LIST_EXTEND, &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, + &&TARGET_UNPACK_SEQUENCE_LIST, &&TARGET_UNPACK_SEQUENCE_TUPLE, &&TARGET_UNPACK_SEQUENCE_TWO_TUPLE, &&TARGET_SEND_GEN, - &&TARGET_UNARY_NOT_BOOL, - &&TARGET_UNARY_NOT_INT, + &&TARGET_TO_BOOL_BOOL, &&TARGET_CALL, &&TARGET_KW_NAMES, &&TARGET_CALL_INTRINSIC_1, &&TARGET_CALL_INTRINSIC_2, &&TARGET_LOAD_FROM_DICT_OR_GLOBALS, &&TARGET_LOAD_FROM_DICT_OR_DEREF, - &&TARGET_UNARY_NOT_LIST, - &&TARGET_UNARY_NOT_NONE, - &&TARGET_UNARY_NOT_STR, - &&_unknown_opcode, + &&TARGET_TO_BOOL_INT, + &&TARGET_TO_BOOL_LIST, + &&TARGET_TO_BOOL_NONE, + &&TARGET_TO_BOOL_STR, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, diff --git a/Python/specialize.c b/Python/specialize.c index 5b83428846ccd8..9d63d8b7625d1f 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -107,7 +107,7 @@ _Py_GetSpecializationStats(void) { err += add_stat_dict(stats, COMPARE_OP, "compare_op"); err += add_stat_dict(stats, UNPACK_SEQUENCE, "unpack_sequence"); err += add_stat_dict(stats, FOR_ITER, "for_iter"); - err += add_stat_dict(stats, UNARY_NOT, "unary_not"); + err += add_stat_dict(stats, TO_BOOL, "to_bool"); err += add_stat_dict(stats, SEND, "send"); if (err < 0) { Py_DECREF(stats); @@ -461,15 +461,15 @@ _PyCode_Quicken(PyCodeObject *code) #define SPEC_FAIL_UNPACK_SEQUENCE_ITERATOR 9 #define SPEC_FAIL_UNPACK_SEQUENCE_SEQUENCE 10 -// UNARY_NOT -#define SPEC_FAIL_UNARY_NOT_BYTEARRAY 9 -#define SPEC_FAIL_UNARY_NOT_BYTES 10 -#define SPEC_FAIL_UNARY_NOT_DICT 11 -#define SPEC_FAIL_UNARY_NOT_FLOAT 12 -#define SPEC_FAIL_UNARY_NOT_HEAP_TYPE 13 -#define SPEC_FAIL_UNARY_NOT_MEMORY_VIEW 14 -#define SPEC_FAIL_UNARY_NOT_SET 15 -#define SPEC_FAIL_UNARY_NOT_TUPLE 16 +// TO_BOOL +#define SPEC_FAIL_TO_BOOL_BYTEARRAY 9 +#define SPEC_FAIL_TO_BOOL_BYTES 10 +#define SPEC_FAIL_TO_BOOL_DICT 11 +#define SPEC_FAIL_TO_BOOL_FLOAT 12 +#define SPEC_FAIL_TO_BOOL_HEAP_TYPE 13 +#define SPEC_FAIL_TO_BOOL_MEMORY_VIEW 14 +#define SPEC_FAIL_TO_BOOL_SET 15 +#define SPEC_FAIL_TO_BOOL_TUPLE 16 static int function_kind(PyCodeObject *code); static bool function_check_args(PyObject *o, int expected_argcount, int opcode); @@ -2261,72 +2261,72 @@ _Py_Specialize_Send(PyObject *receiver, _Py_CODEUNIT *instr) } void -_Py_Specialize_UnaryNot(PyObject *value, _Py_CODEUNIT *instr) +_Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr) { assert(ENABLE_SPECIALIZATION); - assert(_PyOpcode_Caches[UNARY_NOT] == INLINE_CACHE_ENTRIES_UNARY_NOT); - _PyUnaryNotCache *cache = (_PyUnaryNotCache *)(instr + 1); + assert(_PyOpcode_Caches[TO_BOOL] == INLINE_CACHE_ENTRIES_TO_BOOL); + _PyToBoolCache *cache = (_PyToBoolCache *)(instr + 1); if (PyBool_Check(value)) { - instr->op.code = UNARY_NOT_BOOL; + instr->op.code = TO_BOOL_BOOL; goto success; } if (PyLong_CheckExact(value)) { - instr->op.code = UNARY_NOT_INT; + instr->op.code = TO_BOOL_INT; goto success; } if (PyList_CheckExact(value)) { - instr->op.code = UNARY_NOT_LIST; + instr->op.code = TO_BOOL_LIST; goto success; } if (Py_IsNone(value)) { - instr->op.code = UNARY_NOT_NONE; + instr->op.code = TO_BOOL_NONE; goto success; } if (PyUnicode_CheckExact(value)) { - instr->op.code = UNARY_NOT_STR; + instr->op.code = TO_BOOL_STR; goto success; } #ifdef Py_STATS if (PyByteArray_CheckExact(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_BYTEARRAY); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_BYTEARRAY); goto failure; } if (PyBytes_CheckExact(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_BYTES); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_BYTES); goto failure; } if (PyDict_CheckExact(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_DICT); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_DICT); goto failure; } if (PyFloat_CheckExact(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_FLOAT); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_FLOAT); goto failure; } if (PyType_HasFeature(Py_TYPE(value), Py_TPFLAGS_HEAPTYPE)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_HEAP_TYPE); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE); goto failure; } if (PyMemoryView_Check(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_MEMORY_VIEW); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_MEMORY_VIEW); goto failure; } if (PyAnySet_CheckExact(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_SET); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_SET); goto failure; } if (PyTuple_CheckExact(value)) { - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_UNARY_NOT_TUPLE); + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_TUPLE); goto failure; } - SPECIALIZATION_FAIL(UNARY_NOT, SPEC_FAIL_OTHER); -#endif + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_OTHER); failure: - STAT_INC(UNARY_NOT, failure); - instr->op.code = UNARY_NOT; +#endif + STAT_INC(TO_BOOL, failure); + instr->op.code = TO_BOOL; cache->counter = adaptive_counter_backoff(cache->counter); return; success: - STAT_INC(UNARY_NOT, success); + STAT_INC(TO_BOOL, success); cache->counter = adaptive_counter_cooldown(); } From 47ec38f00f9a153473b19013cf71261550bbbe6a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 20 Jun 2023 18:11:44 -0700 Subject: [PATCH 06/15] Branchless branching --- Python/bytecodes.c | 8 +- Python/generated_cases.c.h | 314 ++++++++++++++++++------------------- 2 files changed, 157 insertions(+), 165 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 6c1f06c8fe7f69..69dfad792a77e5 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2270,16 +2270,12 @@ dummy_func( inst(POP_JUMP_IF_FALSE, (cond -- )) { assert(PyBool_Check(cond)); - if (Py_IsFalse(cond)) { - JUMPBY(oparg); - } + JUMPBY(oparg * Py_IsFalse(cond)); } inst(POP_JUMP_IF_TRUE, (cond -- )) { assert(PyBool_Check(cond)); - if (Py_IsTrue(cond)) { - JUMPBY(oparg); - } + JUMPBY(oparg * Py_IsTrue(cond)); } inst(POP_JUMP_IF_NOT_NONE, (value -- )) { diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 8dc1e90aafe736..6b11d8feb3d619 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -3223,78 +3223,74 @@ PyObject *cond = stack_pointer[-1]; #line 2272 "Python/bytecodes.c" assert(PyBool_Check(cond)); - if (Py_IsFalse(cond)) { - JUMPBY(oparg); - } - #line 3230 "Python/generated_cases.c.h" + JUMPBY(oparg * Py_IsFalse(cond)); + #line 3228 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2279 "Python/bytecodes.c" + #line 2277 "Python/bytecodes.c" assert(PyBool_Check(cond)); - if (Py_IsTrue(cond)) { - JUMPBY(oparg); - } - #line 3242 "Python/generated_cases.c.h" + JUMPBY(oparg * Py_IsTrue(cond)); + #line 3238 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2286 "Python/bytecodes.c" + #line 2282 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3251 "Python/generated_cases.c.h" + #line 3247 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2288 "Python/bytecodes.c" + #line 2284 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3256 "Python/generated_cases.c.h" + #line 3252 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2293 "Python/bytecodes.c" + #line 2289 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3268 "Python/generated_cases.c.h" + #line 3264 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2298 "Python/bytecodes.c" + #line 2294 "Python/bytecodes.c" } - #line 3272 "Python/generated_cases.c.h" + #line 3268 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2302 "Python/bytecodes.c" + #line 2298 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3285 "Python/generated_cases.c.h" + #line 3281 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2311 "Python/bytecodes.c" + #line 2307 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3298 "Python/generated_cases.c.h" + #line 3294 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3305,16 +3301,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2319 "Python/bytecodes.c" + #line 2315 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3314 "Python/generated_cases.c.h" + #line 3310 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2324 "Python/bytecodes.c" + #line 2320 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3322,7 +3318,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3326 "Python/generated_cases.c.h" + #line 3322 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3331,10 +3327,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2334 "Python/bytecodes.c" + #line 2330 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3338 "Python/generated_cases.c.h" + #line 3334 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3343,10 +3339,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2339 "Python/bytecodes.c" + #line 2335 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3350 "Python/generated_cases.c.h" + #line 3346 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3356,11 +3352,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2344 "Python/bytecodes.c" + #line 2340 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3364 "Python/generated_cases.c.h" + #line 3360 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3369,14 +3365,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2350 "Python/bytecodes.c" + #line 2346 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3376 "Python/generated_cases.c.h" + #line 3372 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2353 "Python/bytecodes.c" + #line 2349 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3380 "Python/generated_cases.c.h" + #line 3376 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3384,7 +3380,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2357 "Python/bytecodes.c" + #line 2353 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3407,11 +3403,11 @@ if (iter == NULL) { goto error; } - #line 3411 "Python/generated_cases.c.h" + #line 3407 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2380 "Python/bytecodes.c" + #line 2376 "Python/bytecodes.c" } - #line 3415 "Python/generated_cases.c.h" + #line 3411 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3421,7 +3417,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2398 "Python/bytecodes.c" + #line 2394 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3453,7 +3449,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3457 "Python/generated_cases.c.h" + #line 3453 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3461,7 +3457,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2432 "Python/bytecodes.c" + #line 2428 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3487,14 +3483,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3491 "Python/generated_cases.c.h" + #line 3487 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2460 "Python/bytecodes.c" + #line 2456 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3515,7 +3511,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3519 "Python/generated_cases.c.h" + #line 3515 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3525,7 +3521,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2483 "Python/bytecodes.c" + #line 2479 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3546,7 +3542,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3550 "Python/generated_cases.c.h" + #line 3546 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3556,7 +3552,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2506 "Python/bytecodes.c" + #line 2502 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3575,7 +3571,7 @@ if (next == NULL) { goto error; } - #line 3579 "Python/generated_cases.c.h" + #line 3575 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3584,7 +3580,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2527 "Python/bytecodes.c" + #line 2523 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3600,14 +3596,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3604 "Python/generated_cases.c.h" + #line 3600 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2545 "Python/bytecodes.c" + #line 2541 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3630,16 +3626,16 @@ Py_DECREF(enter); goto error; } - #line 3634 "Python/generated_cases.c.h" + #line 3630 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2568 "Python/bytecodes.c" + #line 2564 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3643 "Python/generated_cases.c.h" + #line 3639 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3650,7 +3646,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2577 "Python/bytecodes.c" + #line 2573 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3676,16 +3672,16 @@ Py_DECREF(enter); goto error; } - #line 3680 "Python/generated_cases.c.h" + #line 3676 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2603 "Python/bytecodes.c" + #line 2599 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3689 "Python/generated_cases.c.h" + #line 3685 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3697,7 +3693,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2612 "Python/bytecodes.c" + #line 2608 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3718,7 +3714,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3722 "Python/generated_cases.c.h" + #line 3718 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3727,7 +3723,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2651 "Python/bytecodes.c" + #line 2647 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3737,7 +3733,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3741 "Python/generated_cases.c.h" + #line 3737 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3751,7 +3747,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2663 "Python/bytecodes.c" + #line 2659 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3768,7 +3764,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3772 "Python/generated_cases.c.h" + #line 3768 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3782,7 +3778,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2682 "Python/bytecodes.c" + #line 2678 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3792,7 +3788,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3796 "Python/generated_cases.c.h" + #line 3792 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3806,7 +3802,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2694 "Python/bytecodes.c" + #line 2690 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3820,7 +3816,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3824 "Python/generated_cases.c.h" + #line 3820 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3829,16 +3825,16 @@ } TARGET(KW_NAMES) { - #line 2710 "Python/bytecodes.c" + #line 2706 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - #line 3837 "Python/generated_cases.c.h" + #line 3833 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2716 "Python/bytecodes.c" + #line 2712 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3851,7 +3847,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3855 "Python/generated_cases.c.h" + #line 3851 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3861,7 +3857,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2761 "Python/bytecodes.c" + #line 2757 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3943,7 +3939,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3947 "Python/generated_cases.c.h" + #line 3943 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3955,7 +3951,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2849 "Python/bytecodes.c" + #line 2845 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3965,7 +3961,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3969 "Python/generated_cases.c.h" + #line 3965 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3974,7 +3970,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2861 "Python/bytecodes.c" + #line 2857 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4000,7 +3996,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4004 "Python/generated_cases.c.h" + #line 4000 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4008,7 +4004,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2889 "Python/bytecodes.c" + #line 2885 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4044,7 +4040,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4048 "Python/generated_cases.c.h" + #line 4044 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4052,7 +4048,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2927 "Python/bytecodes.c" + #line 2923 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4062,7 +4058,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4066 "Python/generated_cases.c.h" + #line 4062 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4075,7 +4071,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2939 "Python/bytecodes.c" + #line 2935 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4086,7 +4082,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4090 "Python/generated_cases.c.h" + #line 4086 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4100,7 +4096,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2953 "Python/bytecodes.c" + #line 2949 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4111,7 +4107,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4115 "Python/generated_cases.c.h" + #line 4111 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4125,7 +4121,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2967 "Python/bytecodes.c" + #line 2963 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4147,7 +4143,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4151 "Python/generated_cases.c.h" + #line 4147 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4161,7 +4157,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2992 "Python/bytecodes.c" + #line 2988 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4189,7 +4185,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4193 "Python/generated_cases.c.h" + #line 4189 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4203,7 +4199,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3023 "Python/bytecodes.c" + #line 3019 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4235,7 +4231,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4239 "Python/generated_cases.c.h" + #line 4235 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4249,7 +4245,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3058 "Python/bytecodes.c" + #line 3054 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4281,7 +4277,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4285 "Python/generated_cases.c.h" + #line 4281 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4295,7 +4291,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3093 "Python/bytecodes.c" + #line 3089 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4320,7 +4316,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4324 "Python/generated_cases.c.h" + #line 4320 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4333,7 +4329,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3120 "Python/bytecodes.c" + #line 3116 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4360,7 +4356,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4364 "Python/generated_cases.c.h" + #line 4360 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4372,7 +4368,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3150 "Python/bytecodes.c" + #line 3146 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4390,14 +4386,14 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4394 "Python/generated_cases.c.h" + #line 4390 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3170 "Python/bytecodes.c" + #line 3166 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4428,7 +4424,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4432 "Python/generated_cases.c.h" + #line 4428 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4441,7 +4437,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3204 "Python/bytecodes.c" + #line 3200 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4470,7 +4466,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4474 "Python/generated_cases.c.h" + #line 4470 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4483,7 +4479,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3236 "Python/bytecodes.c" + #line 3232 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4512,7 +4508,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4516 "Python/generated_cases.c.h" + #line 4512 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4525,7 +4521,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3268 "Python/bytecodes.c" + #line 3264 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4553,7 +4549,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4557 "Python/generated_cases.c.h" + #line 4553 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4563,9 +4559,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3299 "Python/bytecodes.c" + #line 3295 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4569 "Python/generated_cases.c.h" + #line 4565 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4574,7 +4570,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3303 "Python/bytecodes.c" + #line 3299 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4636,14 +4632,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4640 "Python/generated_cases.c.h" + #line 4636 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3365 "Python/bytecodes.c" + #line 3361 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4647 "Python/generated_cases.c.h" + #line 4643 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4654,7 +4650,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3371 "Python/bytecodes.c" + #line 3367 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4666,7 +4662,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4670 "Python/generated_cases.c.h" + #line 4666 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4674,7 +4670,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3385 "Python/bytecodes.c" + #line 3381 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4699,14 +4695,14 @@ default: Py_UNREACHABLE(); } - #line 4703 "Python/generated_cases.c.h" + #line 4699 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3412 "Python/bytecodes.c" + #line 3408 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4727,7 +4723,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4731 "Python/generated_cases.c.h" + #line 4727 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4735,15 +4731,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3435 "Python/bytecodes.c" + #line 3431 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4741 "Python/generated_cases.c.h" + #line 4737 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3437 "Python/bytecodes.c" + #line 3433 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4747 "Python/generated_cases.c.h" + #line 4743 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4753,14 +4749,14 @@ TARGET(CONVERT_VALUE) { PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3441 "Python/bytecodes.c" + #line 3437 "Python/bytecodes.c" convertion_func_ptr conv_fn; assert(oparg >= FVC_STR && oparg <= FVC_ASCII); conv_fn = CONVERSION_FUNCTIONS[oparg]; result = conv_fn(value); Py_DECREF(value); if (result == NULL) goto pop_1_error; - #line 4764 "Python/generated_cases.c.h" + #line 4760 "Python/generated_cases.c.h" stack_pointer[-1] = result; DISPATCH(); } @@ -4768,7 +4764,7 @@ TARGET(FORMAT_SIMPLE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 3450 "Python/bytecodes.c" + #line 3446 "Python/bytecodes.c" /* If value is a unicode object, then we know the result * of format(value) is value itself. */ if (!PyUnicode_CheckExact(value)) { @@ -4779,7 +4775,7 @@ else { res = value; } - #line 4783 "Python/generated_cases.c.h" + #line 4779 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -4788,12 +4784,12 @@ PyObject *fmt_spec = stack_pointer[-1]; PyObject *value = stack_pointer[-2]; PyObject *res; - #line 3463 "Python/bytecodes.c" + #line 3459 "Python/bytecodes.c" res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); if (res == NULL) goto pop_2_error; - #line 4797 "Python/generated_cases.c.h" + #line 4793 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -4802,10 +4798,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3470 "Python/bytecodes.c" + #line 3466 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4809 "Python/generated_cases.c.h" + #line 4805 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4817,7 +4813,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3475 "Python/bytecodes.c" + #line 3471 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4832,12 +4828,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4836 "Python/generated_cases.c.h" + #line 4832 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3490 "Python/bytecodes.c" + #line 3486 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4841 "Python/generated_cases.c.h" + #line 4837 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4847,16 +4843,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3495 "Python/bytecodes.c" + #line 3491 "Python/bytecodes.c" assert(oparg >= 2); - #line 4853 "Python/generated_cases.c.h" + #line 4849 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3499 "Python/bytecodes.c" + #line 3495 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4868,26 +4864,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4872 "Python/generated_cases.c.h" + #line 4868 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3513 "Python/bytecodes.c" + #line 3509 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4878 "Python/generated_cases.c.h" + #line 4874 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3517 "Python/bytecodes.c" + #line 3513 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4885 "Python/generated_cases.c.h" + #line 4881 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3522 "Python/bytecodes.c" + #line 3518 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4896,12 +4892,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4900 "Python/generated_cases.c.h" + #line 4896 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3533 "Python/bytecodes.c" + #line 3529 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4910,12 +4906,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4914 "Python/generated_cases.c.h" + #line 4910 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3544 "Python/bytecodes.c" + #line 3540 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4927,12 +4923,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4931 "Python/generated_cases.c.h" + #line 4927 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3558 "Python/bytecodes.c" + #line 3554 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4944,30 +4940,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4948 "Python/generated_cases.c.h" + #line 4944 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3572 "Python/bytecodes.c" + #line 3568 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4959 "Python/generated_cases.c.h" + #line 4955 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3580 "Python/bytecodes.c" + #line 3576 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4966 "Python/generated_cases.c.h" + #line 4962 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3585 "Python/bytecodes.c" + #line 3581 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4973 "Python/generated_cases.c.h" + #line 4969 "Python/generated_cases.c.h" } From a0bd53a31edc9594e561b076b9bb23f3ae0be949 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 20 Jun 2023 18:52:36 -0700 Subject: [PATCH 07/15] Add a "boolean conversion" bit to COMPARE_OP --- Doc/library/dis.rst | 3 +- Lib/dis.py | 4 +- Lib/test/test_dis.py | 219 ++++++++++---------- Python/bytecodes.c | 15 +- Python/compile.c | 8 +- Python/flowgraph.c | 25 +++ Python/generated_cases.c.h | 401 +++++++++++++++++++------------------ Python/specialize.c | 4 +- 8 files changed, 363 insertions(+), 316 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 39d43578faf3c3..bf6ab0acedbecf 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1127,7 +1127,8 @@ iterations of the loop. .. opcode:: COMPARE_OP (opname) Performs a Boolean operation. The operation name can be found in - ``cmp_op[opname]``. + ``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set + (``opname & 16``), the result should be coerced to ``bool``. .. opcode:: IS_OP (invert) diff --git a/Lib/dis.py b/Lib/dis.py index f135a0bc9b4d98..f7a31f2f96b99b 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -572,8 +572,10 @@ def _get_instructions_bytes(code, varname_from_oparg=None, elif deop in haslocal or deop in hasfree: argval, argrepr = _get_name_info(arg, varname_from_oparg) elif deop in hascompare: - argval = cmp_op[arg>>4] + argval = cmp_op[arg >> 5] argrepr = argval + if arg & 16: + argrepr = f"bool({argrepr})" elif deop == CONVERT_VALUE: argval = (None, str, repr, ascii)[arg] argrepr = ('', 'str', 'repr', 'ascii')[arg] diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 59addfd83b3602..924b131983a158 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -46,7 +46,7 @@ def cm(cls, x): %3d LOAD_FAST 1 (x) LOAD_CONST 1 (1) - COMPARE_OP 40 (==) + COMPARE_OP 72 (==) LOAD_FAST 0 (self) STORE_ATTR 0 (x) RETURN_CONST 0 (None) @@ -56,7 +56,7 @@ def cm(cls, x): RESUME 0 LOAD_FAST 1 LOAD_CONST 1 - COMPARE_OP 40 (==) + COMPARE_OP 72 (==) LOAD_FAST 0 STORE_ATTR 0 RETURN_CONST 0 @@ -67,7 +67,7 @@ def cm(cls, x): %3d LOAD_FAST 1 (x) LOAD_CONST 1 (1) - COMPARE_OP 40 (==) + COMPARE_OP 72 (==) LOAD_FAST 0 (cls) STORE_ATTR 0 (x) RETURN_CONST 0 (None) @@ -78,7 +78,7 @@ def cm(cls, x): %3d LOAD_FAST 0 (x) LOAD_CONST 1 (1) - COMPARE_OP 40 (==) + COMPARE_OP 72 (==) STORE_FAST 0 (x) RETURN_CONST 0 (None) """ % (_C.sm.__code__.co_firstlineno, _C.sm.__code__.co_firstlineno + 2,) @@ -1660,13 +1660,14 @@ def _prepare_test_cases(): Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=32, start_offset=32, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=34, start_offset=34, starts_line=None, is_jump_target=False, positions=None), ] + expected_opinfo_jumpy = [ Instruction(opname='RESUME', opcode=151, arg=0, argval=0, argrepr='', offset=0, start_offset=0, starts_line=1, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='range', argrepr='NULL + range', offset=2, start_offset=2, starts_line=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', offset=12, start_offset=12, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=14, start_offset=14, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=22, start_offset=22, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='FOR_ITER', opcode=93, arg=32, argval=92, argrepr='to 92', offset=24, start_offset=24, starts_line=None, is_jump_target=True, positions=None), + Instruction(opname='FOR_ITER', opcode=93, arg=28, argval=84, argrepr='to 84', offset=24, start_offset=24, starts_line=None, is_jump_target=True, positions=None), Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=28, start_offset=28, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=30, start_offset=30, starts_line=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=40, start_offset=40, starts_line=None, is_jump_target=False, positions=None), @@ -1674,113 +1675,109 @@ def _prepare_test_cases(): Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=50, start_offset=50, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=52, start_offset=52, starts_line=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=54, start_offset=54, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=56, start_offset=56, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=60, start_offset=60, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=70, argrepr='to 70', offset=64, start_offset=64, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=23, argval=24, argrepr='to 24', offset=66, start_offset=66, starts_line=6, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=70, start_offset=70, starts_line=7, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=72, start_offset=72, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=74, start_offset=74, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=78, start_offset=78, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=88, argrepr='to 88', offset=82, start_offset=82, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=32, argval=24, argrepr='to 24', offset=84, start_offset=84, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=88, start_offset=88, starts_line=8, is_jump_target=True, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=12, argval=116, argrepr='to 116', offset=90, start_offset=90, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='END_FOR', opcode=4, arg=None, argval=None, argrepr='', offset=92, start_offset=92, starts_line=3, is_jump_target=True, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=94, start_offset=94, starts_line=10, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=104, start_offset=104, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=106, start_offset=106, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=114, start_offset=114, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=116, start_offset=116, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=118, start_offset=118, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=39, argval=202, argrepr='to 202', offset=122, start_offset=122, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=124, start_offset=124, starts_line=12, is_jump_target=True, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=134, start_offset=134, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=136, start_offset=136, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=144, start_offset=144, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=146, start_offset=146, starts_line=13, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=148, start_offset=148, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=150, start_offset=150, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=154, start_offset=154, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=156, start_offset=156, starts_line=14, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=158, start_offset=158, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=68, argval='>', argrepr='>', offset=160, start_offset=160, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=164, start_offset=164, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=174, argrepr='to 174', offset=168, start_offset=168, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=29, argval=116, argrepr='to 116', offset=170, start_offset=170, starts_line=15, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=174, start_offset=174, starts_line=16, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=176, start_offset=176, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=2, argval='<', argrepr='<', offset=178, start_offset=178, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=182, start_offset=182, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=190, argrepr='to 190', offset=186, start_offset=186, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=17, argval=224, argrepr='to 224', offset=188, start_offset=188, starts_line=17, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=190, start_offset=190, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=192, start_offset=192, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=202, argrepr='to 202', offset=196, start_offset=196, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=39, argval=124, argrepr='to 124', offset=198, start_offset=198, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=202, start_offset=202, starts_line=19, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=212, start_offset=212, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=214, start_offset=214, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=222, start_offset=222, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=224, start_offset=224, starts_line=20, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=226, start_offset=226, starts_line=21, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=228, start_offset=228, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=230, start_offset=230, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=234, start_offset=234, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=236, start_offset=236, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=238, start_offset=238, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=240, start_offset=240, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=242, start_offset=242, starts_line=26, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=252, start_offset=252, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=254, start_offset=254, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=18, argval='<', argrepr='bool(<)', offset=56, start_offset=56, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=66, argrepr='to 66', offset=60, start_offset=60, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=21, argval=24, argrepr='to 24', offset=62, start_offset=62, starts_line=6, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=66, start_offset=66, starts_line=7, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=68, start_offset=68, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=148, argval='>', argrepr='bool(>)', offset=70, start_offset=70, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=2, argval=80, argrepr='to 80', offset=74, start_offset=74, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=28, argval=24, argrepr='to 24', offset=76, start_offset=76, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=80, start_offset=80, starts_line=8, is_jump_target=True, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=12, argval=108, argrepr='to 108', offset=82, start_offset=82, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='END_FOR', opcode=4, arg=None, argval=None, argrepr='', offset=84, start_offset=84, starts_line=3, is_jump_target=True, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=86, start_offset=86, starts_line=10, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=96, start_offset=96, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=98, start_offset=98, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=106, start_offset=106, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=108, start_offset=108, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=110, start_offset=110, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=35, argval=186, argrepr='to 186', offset=114, start_offset=114, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=116, start_offset=116, starts_line=12, is_jump_target=True, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=126, start_offset=126, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=128, start_offset=128, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=136, start_offset=136, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=138, start_offset=138, starts_line=13, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=140, start_offset=140, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=142, start_offset=142, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=146, start_offset=146, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=148, start_offset=148, starts_line=14, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=150, start_offset=150, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=148, argval='>', argrepr='bool(>)', offset=152, start_offset=152, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=162, argrepr='to 162', offset=156, start_offset=156, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=27, argval=108, argrepr='to 108', offset=158, start_offset=158, starts_line=15, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=162, start_offset=162, starts_line=16, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=164, start_offset=164, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=18, argval='<', argrepr='bool(<)', offset=166, start_offset=166, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=174, argrepr='to 174', offset=170, start_offset=170, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=17, argval=208, argrepr='to 208', offset=172, start_offset=172, starts_line=17, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=174, start_offset=174, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=176, start_offset=176, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=186, argrepr='to 186', offset=180, start_offset=180, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=35, argval=116, argrepr='to 116', offset=182, start_offset=182, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=186, start_offset=186, starts_line=19, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=196, start_offset=196, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=198, start_offset=198, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=206, start_offset=206, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=208, start_offset=208, starts_line=20, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=210, start_offset=210, starts_line=21, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=212, start_offset=212, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=214, start_offset=214, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=218, start_offset=218, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=220, start_offset=220, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=222, start_offset=222, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=224, start_offset=224, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=226, start_offset=226, starts_line=26, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=236, start_offset=236, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=238, start_offset=238, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=246, start_offset=246, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=248, start_offset=248, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=250, start_offset=250, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=252, start_offset=252, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=254, start_offset=254, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=262, start_offset=262, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=264, start_offset=264, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=266, start_offset=266, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=268, start_offset=268, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=270, start_offset=270, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=278, start_offset=278, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=280, start_offset=280, starts_line=28, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=290, start_offset=290, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=292, start_offset=292, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=300, start_offset=300, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=302, start_offset=302, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=304, start_offset=304, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=306, start_offset=306, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=308, start_offset=308, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=316, argrepr='to 316', offset=312, start_offset=312, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=314, start_offset=314, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=316, start_offset=316, starts_line=None, is_jump_target=True, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=318, start_offset=318, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=320, start_offset=320, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=322, start_offset=322, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=24, argval=280, argrepr='to 280', offset=324, start_offset=324, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=328, start_offset=328, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=330, start_offset=330, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=332, start_offset=332, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=334, start_offset=334, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=336, start_offset=336, starts_line=22, is_jump_target=False, positions=None), - Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=346, start_offset=346, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=380, argrepr='to 380', offset=348, start_offset=348, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=350, start_offset=350, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=352, start_offset=352, starts_line=23, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=362, start_offset=362, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=364, start_offset=364, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=372, start_offset=372, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=374, start_offset=374, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=50, argval=280, argrepr='to 280', offset=376, start_offset=376, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=380, start_offset=380, starts_line=22, is_jump_target=True, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=382, start_offset=382, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=384, start_offset=384, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=386, start_offset=386, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=388, start_offset=388, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=390, start_offset=390, starts_line=28, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=400, start_offset=400, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=402, start_offset=402, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=410, start_offset=410, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=412, start_offset=412, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=414, start_offset=414, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=416, start_offset=416, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=418, start_offset=418, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=264, start_offset=264, starts_line=28, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=274, start_offset=274, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=276, start_offset=276, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=284, start_offset=284, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=286, start_offset=286, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=288, start_offset=288, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=290, start_offset=290, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=292, start_offset=292, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=300, argrepr='to 300', offset=296, start_offset=296, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=298, start_offset=298, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=300, start_offset=300, starts_line=None, is_jump_target=True, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=302, start_offset=302, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=304, start_offset=304, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=306, start_offset=306, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=24, argval=264, argrepr='to 264', offset=308, start_offset=308, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=312, start_offset=312, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=314, start_offset=314, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=316, start_offset=316, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=318, start_offset=318, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=320, start_offset=320, starts_line=22, is_jump_target=False, positions=None), + Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=330, start_offset=330, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=364, argrepr='to 364', offset=332, start_offset=332, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=334, start_offset=334, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=336, start_offset=336, starts_line=23, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=346, start_offset=346, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=348, start_offset=348, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=356, start_offset=356, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=358, start_offset=358, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=50, argval=264, argrepr='to 264', offset=360, start_offset=360, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=364, start_offset=364, starts_line=22, is_jump_target=True, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=366, start_offset=366, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=368, start_offset=368, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=370, start_offset=370, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=372, start_offset=372, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=374, start_offset=374, starts_line=28, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=384, start_offset=384, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=386, start_offset=386, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=394, start_offset=394, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=396, start_offset=396, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=398, start_offset=398, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=400, start_offset=400, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=402, start_offset=402, starts_line=None, is_jump_target=False, positions=None), ] # One last piece of inspect fodder to check the default line number handling diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 69dfad792a77e5..850e6ae8a516c2 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2110,10 +2110,16 @@ dummy_func( STAT_INC(COMPARE_OP, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - assert((oparg >> 4) <= Py_GE); - res = PyObject_RichCompare(left, right, oparg>>4); + assert((oparg >> 5) <= Py_GE); + res = PyObject_RichCompare(left, right, oparg >> 5); DECREF_INPUTS(); ERROR_IF(res == NULL, error); + if (oparg & 16) { + int res_bool = PyObject_IsTrue(res); + Py_DECREF(res); + ERROR_IF(res_bool < 0, error); + res = res_bool ? Py_True : Py_False; + } } inst(COMPARE_OP_FLOAT, (unused/1, left, right -- res)) { @@ -2127,6 +2133,7 @@ dummy_func( _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; + // It's always a bool, so we don't care about oparg & 16. } // Similar to COMPARE_OP_FLOAT @@ -2145,6 +2152,7 @@ dummy_func( _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; + // It's always a bool, so we don't care about oparg & 16. } // Similar to COMPARE_OP_FLOAT, but for ==, != only @@ -2153,13 +2161,14 @@ dummy_func( DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); int eq = _PyUnicode_Equal(left, right); - assert((oparg >>4) == Py_EQ || (oparg >>4) == Py_NE); + assert((oparg >> 5) == Py_EQ || (oparg >> 5) == Py_NE); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); assert(eq == 0 || eq == 1); assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS); assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; + // It's always a bool, so we don't care about oparg & 16. } inst(IS_OP, (left, right -- b)) { diff --git a/Python/compile.c b/Python/compile.c index f6e659a2e0276f..fe8234ff853481 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2795,9 +2795,11 @@ static int compiler_addcompare(struct compiler *c, location loc, default: Py_UNREACHABLE(); } - /* cmp goes in top bits of the oparg, while the low bits are used by quickened - * versions of this opcode to store the comparison mask. */ - ADDOP_I(c, loc, COMPARE_OP, (cmp << 4) | compare_masks[cmp]); + // cmp goes in top three bits of the oparg, while the low four bits are used + // by quickened versions of this opcode to store the comparison mask. The + // fifth-lowest bit indicates whether the result should be converted to bool + // and is set later): + ADDOP_I(c, loc, COMPARE_OP, (cmp << 5) | compare_masks[cmp]); return SUCCESS; } diff --git a/Python/flowgraph.c b/Python/flowgraph.c index 8e53ca99fa838e..5166b8089649d1 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1491,6 +1491,31 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) } break; } + case COMPARE_OP: + if (nextop == TO_BOOL) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP1(&bb->b_instr[i + 1], COMPARE_OP, oparg | 16); + continue; + } + break; + case TO_BOOL: + if (nextop == TO_BOOL) { + INSTR_SET_OP0(inst, NOP); + continue; + } + break; + case UNARY_NOT: + if (nextop == TO_BOOL) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP0(&bb->b_instr[i + 1], UNARY_NOT); + continue; + } + if (nextop == UNARY_NOT) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); + continue; + } + break; case IS_OP: case CONTAINS_OP: if (nextop == TO_BOOL) { diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 6b11d8feb3d619..f51bb22bec356a 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2964,14 +2964,20 @@ STAT_INC(COMPARE_OP, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - assert((oparg >> 4) <= Py_GE); - res = PyObject_RichCompare(left, right, oparg>>4); + assert((oparg >> 5) <= Py_GE); + res = PyObject_RichCompare(left, right, oparg >> 5); #line 2970 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); #line 2116 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2975 "Python/generated_cases.c.h" + if (oparg & 16) { + int res_bool = PyObject_IsTrue(res); + Py_DECREF(res); + if (res_bool < 0) goto pop_2_error; + res = res_bool ? Py_True : Py_False; + } + #line 2981 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2982,7 +2988,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2120 "Python/bytecodes.c" + #line 2126 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2993,7 +2999,8 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2997 "Python/generated_cases.c.h" + // It's always a bool, so we don't care about oparg & 16. + #line 3004 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3004,7 +3011,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2134 "Python/bytecodes.c" + #line 2141 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -3019,7 +3026,8 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 3023 "Python/generated_cases.c.h" + // It's always a bool, so we don't care about oparg & 16. + #line 3031 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3030,19 +3038,20 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2152 "Python/bytecodes.c" + #line 2160 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); int eq = _PyUnicode_Equal(left, right); - assert((oparg >>4) == Py_EQ || (oparg >>4) == Py_NE); + assert((oparg >> 5) == Py_EQ || (oparg >> 5) == Py_NE); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); assert(eq == 0 || eq == 1); assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS); assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; - #line 3046 "Python/generated_cases.c.h" + // It's always a bool, so we don't care about oparg & 16. + #line 3055 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3053,14 +3062,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2166 "Python/bytecodes.c" + #line 2175 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3059 "Python/generated_cases.c.h" + #line 3068 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2168 "Python/bytecodes.c" + #line 2177 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3064 "Python/generated_cases.c.h" + #line 3073 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3070,15 +3079,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2172 "Python/bytecodes.c" + #line 2181 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3076 "Python/generated_cases.c.h" + #line 3085 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2174 "Python/bytecodes.c" + #line 2183 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3082 "Python/generated_cases.c.h" + #line 3091 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3089,12 +3098,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2179 "Python/bytecodes.c" + #line 2188 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3095 "Python/generated_cases.c.h" + #line 3104 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2181 "Python/bytecodes.c" + #line 2190 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3102,10 +3111,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3106 "Python/generated_cases.c.h" + #line 3115 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2189 "Python/bytecodes.c" + #line 2198 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3114,7 +3123,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3118 "Python/generated_cases.c.h" + #line 3127 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3124,21 +3133,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2200 "Python/bytecodes.c" + #line 2209 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3131 "Python/generated_cases.c.h" + #line 3140 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2203 "Python/bytecodes.c" + #line 2212 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3138 "Python/generated_cases.c.h" + #line 3147 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2208 "Python/bytecodes.c" + #line 2217 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3142 "Python/generated_cases.c.h" + #line 3151 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3147,15 +3156,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2212 "Python/bytecodes.c" + #line 2221 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3154 "Python/generated_cases.c.h" + #line 3163 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2215 "Python/bytecodes.c" + #line 2224 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3159 "Python/generated_cases.c.h" + #line 3168 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3164,25 +3173,25 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2219 "Python/bytecodes.c" + #line 2228 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3172 "Python/generated_cases.c.h" + #line 3181 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2225 "Python/bytecodes.c" + #line 2234 "Python/bytecodes.c" JUMPBY(oparg); - #line 3181 "Python/generated_cases.c.h" + #line 3190 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2229 "Python/bytecodes.c" + #line 2238 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3200,13 +3209,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3204 "Python/generated_cases.c.h" + #line 3213 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2260 "Python/bytecodes.c" + #line 2269 "Python/bytecodes.c" PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255]; Py_INCREF(executor); @@ -3216,81 +3225,81 @@ goto error; } goto resume_frame; - #line 3220 "Python/generated_cases.c.h" + #line 3229 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2272 "Python/bytecodes.c" + #line 2281 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsFalse(cond)); - #line 3228 "Python/generated_cases.c.h" + #line 3237 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2277 "Python/bytecodes.c" + #line 2286 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsTrue(cond)); - #line 3238 "Python/generated_cases.c.h" + #line 3247 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2282 "Python/bytecodes.c" + #line 2291 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3247 "Python/generated_cases.c.h" + #line 3256 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2284 "Python/bytecodes.c" + #line 2293 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3252 "Python/generated_cases.c.h" + #line 3261 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2289 "Python/bytecodes.c" + #line 2298 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3264 "Python/generated_cases.c.h" + #line 3273 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2294 "Python/bytecodes.c" + #line 2303 "Python/bytecodes.c" } - #line 3268 "Python/generated_cases.c.h" + #line 3277 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2298 "Python/bytecodes.c" + #line 2307 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3281 "Python/generated_cases.c.h" + #line 3290 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2307 "Python/bytecodes.c" + #line 2316 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3294 "Python/generated_cases.c.h" + #line 3303 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3301,16 +3310,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2315 "Python/bytecodes.c" + #line 2324 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3310 "Python/generated_cases.c.h" + #line 3319 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2320 "Python/bytecodes.c" + #line 2329 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3318,7 +3327,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3322 "Python/generated_cases.c.h" + #line 3331 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3327,10 +3336,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2330 "Python/bytecodes.c" + #line 2339 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3334 "Python/generated_cases.c.h" + #line 3343 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3339,10 +3348,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2335 "Python/bytecodes.c" + #line 2344 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3346 "Python/generated_cases.c.h" + #line 3355 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3352,11 +3361,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2340 "Python/bytecodes.c" + #line 2349 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3360 "Python/generated_cases.c.h" + #line 3369 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3365,14 +3374,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2346 "Python/bytecodes.c" + #line 2355 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3372 "Python/generated_cases.c.h" + #line 3381 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2349 "Python/bytecodes.c" + #line 2358 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3376 "Python/generated_cases.c.h" + #line 3385 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3380,7 +3389,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2353 "Python/bytecodes.c" + #line 2362 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3403,11 +3412,11 @@ if (iter == NULL) { goto error; } - #line 3407 "Python/generated_cases.c.h" + #line 3416 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2376 "Python/bytecodes.c" + #line 2385 "Python/bytecodes.c" } - #line 3411 "Python/generated_cases.c.h" + #line 3420 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3417,7 +3426,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2394 "Python/bytecodes.c" + #line 2403 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3449,7 +3458,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3453 "Python/generated_cases.c.h" + #line 3462 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3457,7 +3466,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2428 "Python/bytecodes.c" + #line 2437 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3483,14 +3492,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3487 "Python/generated_cases.c.h" + #line 3496 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2456 "Python/bytecodes.c" + #line 2465 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3511,7 +3520,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3515 "Python/generated_cases.c.h" + #line 3524 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3521,7 +3530,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2479 "Python/bytecodes.c" + #line 2488 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3542,7 +3551,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3546 "Python/generated_cases.c.h" + #line 3555 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3552,7 +3561,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2502 "Python/bytecodes.c" + #line 2511 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3571,7 +3580,7 @@ if (next == NULL) { goto error; } - #line 3575 "Python/generated_cases.c.h" + #line 3584 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3580,7 +3589,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2523 "Python/bytecodes.c" + #line 2532 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3596,14 +3605,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3600 "Python/generated_cases.c.h" + #line 3609 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2541 "Python/bytecodes.c" + #line 2550 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3626,16 +3635,16 @@ Py_DECREF(enter); goto error; } - #line 3630 "Python/generated_cases.c.h" + #line 3639 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2564 "Python/bytecodes.c" + #line 2573 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3639 "Python/generated_cases.c.h" + #line 3648 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3646,7 +3655,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2573 "Python/bytecodes.c" + #line 2582 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3672,16 +3681,16 @@ Py_DECREF(enter); goto error; } - #line 3676 "Python/generated_cases.c.h" + #line 3685 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2599 "Python/bytecodes.c" + #line 2608 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3685 "Python/generated_cases.c.h" + #line 3694 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3693,7 +3702,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2608 "Python/bytecodes.c" + #line 2617 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3714,7 +3723,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3718 "Python/generated_cases.c.h" + #line 3727 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3723,7 +3732,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2647 "Python/bytecodes.c" + #line 2656 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3733,7 +3742,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3737 "Python/generated_cases.c.h" + #line 3746 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3747,7 +3756,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2659 "Python/bytecodes.c" + #line 2668 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3764,7 +3773,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3768 "Python/generated_cases.c.h" + #line 3777 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3778,7 +3787,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2678 "Python/bytecodes.c" + #line 2687 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3788,7 +3797,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3792 "Python/generated_cases.c.h" + #line 3801 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3802,7 +3811,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2690 "Python/bytecodes.c" + #line 2699 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3816,7 +3825,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3820 "Python/generated_cases.c.h" + #line 3829 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3825,16 +3834,16 @@ } TARGET(KW_NAMES) { - #line 2706 "Python/bytecodes.c" + #line 2715 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - #line 3833 "Python/generated_cases.c.h" + #line 3842 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2712 "Python/bytecodes.c" + #line 2721 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3847,7 +3856,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3851 "Python/generated_cases.c.h" + #line 3860 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3857,7 +3866,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2757 "Python/bytecodes.c" + #line 2766 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3939,7 +3948,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3943 "Python/generated_cases.c.h" + #line 3952 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3951,7 +3960,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2845 "Python/bytecodes.c" + #line 2854 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3961,7 +3970,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3965 "Python/generated_cases.c.h" + #line 3974 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3970,7 +3979,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2857 "Python/bytecodes.c" + #line 2866 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3996,7 +4005,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4000 "Python/generated_cases.c.h" + #line 4009 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4004,7 +4013,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2885 "Python/bytecodes.c" + #line 2894 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4040,7 +4049,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4044 "Python/generated_cases.c.h" + #line 4053 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4048,7 +4057,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2923 "Python/bytecodes.c" + #line 2932 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4058,7 +4067,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4062 "Python/generated_cases.c.h" + #line 4071 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4071,7 +4080,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2935 "Python/bytecodes.c" + #line 2944 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4082,7 +4091,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4086 "Python/generated_cases.c.h" + #line 4095 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4096,7 +4105,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2949 "Python/bytecodes.c" + #line 2958 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4107,7 +4116,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4111 "Python/generated_cases.c.h" + #line 4120 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4121,7 +4130,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2963 "Python/bytecodes.c" + #line 2972 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4143,7 +4152,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4147 "Python/generated_cases.c.h" + #line 4156 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4157,7 +4166,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2988 "Python/bytecodes.c" + #line 2997 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4185,7 +4194,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4189 "Python/generated_cases.c.h" + #line 4198 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4199,7 +4208,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3019 "Python/bytecodes.c" + #line 3028 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4231,7 +4240,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4235 "Python/generated_cases.c.h" + #line 4244 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4245,7 +4254,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3054 "Python/bytecodes.c" + #line 3063 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4277,7 +4286,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4281 "Python/generated_cases.c.h" + #line 4290 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4291,7 +4300,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3089 "Python/bytecodes.c" + #line 3098 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4316,7 +4325,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4320 "Python/generated_cases.c.h" + #line 4329 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4329,7 +4338,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3116 "Python/bytecodes.c" + #line 3125 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4356,7 +4365,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4360 "Python/generated_cases.c.h" + #line 4369 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4368,7 +4377,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3146 "Python/bytecodes.c" + #line 3155 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4386,14 +4395,14 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4390 "Python/generated_cases.c.h" + #line 4399 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3166 "Python/bytecodes.c" + #line 3175 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4424,7 +4433,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4428 "Python/generated_cases.c.h" + #line 4437 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4437,7 +4446,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3200 "Python/bytecodes.c" + #line 3209 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4466,7 +4475,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4470 "Python/generated_cases.c.h" + #line 4479 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4479,7 +4488,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3232 "Python/bytecodes.c" + #line 3241 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4508,7 +4517,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4512 "Python/generated_cases.c.h" + #line 4521 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4521,7 +4530,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3264 "Python/bytecodes.c" + #line 3273 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4549,7 +4558,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4553 "Python/generated_cases.c.h" + #line 4562 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4559,9 +4568,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3295 "Python/bytecodes.c" + #line 3304 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4565 "Python/generated_cases.c.h" + #line 4574 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4570,7 +4579,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3299 "Python/bytecodes.c" + #line 3308 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4632,14 +4641,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4636 "Python/generated_cases.c.h" + #line 4645 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3361 "Python/bytecodes.c" + #line 3370 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4643 "Python/generated_cases.c.h" + #line 4652 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4650,7 +4659,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3367 "Python/bytecodes.c" + #line 3376 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4662,7 +4671,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4666 "Python/generated_cases.c.h" + #line 4675 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4670,7 +4679,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3381 "Python/bytecodes.c" + #line 3390 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4695,14 +4704,14 @@ default: Py_UNREACHABLE(); } - #line 4699 "Python/generated_cases.c.h" + #line 4708 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3408 "Python/bytecodes.c" + #line 3417 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4723,7 +4732,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4727 "Python/generated_cases.c.h" + #line 4736 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4731,15 +4740,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3431 "Python/bytecodes.c" + #line 3440 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4737 "Python/generated_cases.c.h" + #line 4746 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3433 "Python/bytecodes.c" + #line 3442 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4743 "Python/generated_cases.c.h" + #line 4752 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4749,14 +4758,14 @@ TARGET(CONVERT_VALUE) { PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3437 "Python/bytecodes.c" + #line 3446 "Python/bytecodes.c" convertion_func_ptr conv_fn; assert(oparg >= FVC_STR && oparg <= FVC_ASCII); conv_fn = CONVERSION_FUNCTIONS[oparg]; result = conv_fn(value); Py_DECREF(value); if (result == NULL) goto pop_1_error; - #line 4760 "Python/generated_cases.c.h" + #line 4769 "Python/generated_cases.c.h" stack_pointer[-1] = result; DISPATCH(); } @@ -4764,7 +4773,7 @@ TARGET(FORMAT_SIMPLE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 3446 "Python/bytecodes.c" + #line 3455 "Python/bytecodes.c" /* If value is a unicode object, then we know the result * of format(value) is value itself. */ if (!PyUnicode_CheckExact(value)) { @@ -4775,7 +4784,7 @@ else { res = value; } - #line 4779 "Python/generated_cases.c.h" + #line 4788 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -4784,12 +4793,12 @@ PyObject *fmt_spec = stack_pointer[-1]; PyObject *value = stack_pointer[-2]; PyObject *res; - #line 3459 "Python/bytecodes.c" + #line 3468 "Python/bytecodes.c" res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); if (res == NULL) goto pop_2_error; - #line 4793 "Python/generated_cases.c.h" + #line 4802 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -4798,10 +4807,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3466 "Python/bytecodes.c" + #line 3475 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4805 "Python/generated_cases.c.h" + #line 4814 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4813,7 +4822,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3471 "Python/bytecodes.c" + #line 3480 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4828,12 +4837,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4832 "Python/generated_cases.c.h" + #line 4841 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3486 "Python/bytecodes.c" + #line 3495 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4837 "Python/generated_cases.c.h" + #line 4846 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4843,16 +4852,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3491 "Python/bytecodes.c" + #line 3500 "Python/bytecodes.c" assert(oparg >= 2); - #line 4849 "Python/generated_cases.c.h" + #line 4858 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3495 "Python/bytecodes.c" + #line 3504 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4864,26 +4873,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4868 "Python/generated_cases.c.h" + #line 4877 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3509 "Python/bytecodes.c" + #line 3518 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4874 "Python/generated_cases.c.h" + #line 4883 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3513 "Python/bytecodes.c" + #line 3522 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4881 "Python/generated_cases.c.h" + #line 4890 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3518 "Python/bytecodes.c" + #line 3527 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4892,12 +4901,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4896 "Python/generated_cases.c.h" + #line 4905 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3529 "Python/bytecodes.c" + #line 3538 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4906,12 +4915,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4910 "Python/generated_cases.c.h" + #line 4919 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3540 "Python/bytecodes.c" + #line 3549 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4923,12 +4932,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4927 "Python/generated_cases.c.h" + #line 4936 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3554 "Python/bytecodes.c" + #line 3563 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4940,30 +4949,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4944 "Python/generated_cases.c.h" + #line 4953 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3568 "Python/bytecodes.c" + #line 3577 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4955 "Python/generated_cases.c.h" + #line 4964 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3576 "Python/bytecodes.c" + #line 3585 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4962 "Python/generated_cases.c.h" + #line 4971 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3581 "Python/bytecodes.c" + #line 3590 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4969 "Python/generated_cases.c.h" + #line 4978 "Python/generated_cases.c.h" } diff --git a/Python/specialize.c b/Python/specialize.c index ea5672c3255fcf..cde2d76f7b8f82 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -2003,6 +2003,8 @@ _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, { assert(ENABLE_SPECIALIZATION); assert(_PyOpcode_Caches[COMPARE_OP] == INLINE_CACHE_ENTRIES_COMPARE_OP); + // All of these specializations compute boolean values, so they're all valid + // regardless of the fifth-lowest oparg bit. _PyCompareOpCache *cache = (_PyCompareOpCache *)(instr + 1); if (Py_TYPE(lhs) != Py_TYPE(rhs)) { SPECIALIZATION_FAIL(COMPARE_OP, compare_op_fail_kind(lhs, rhs)); @@ -2023,7 +2025,7 @@ _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, } } if (PyUnicode_CheckExact(lhs)) { - int cmp = oparg >> 4; + int cmp = oparg >> 5; if (cmp != Py_EQ && cmp != Py_NE) { SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_OP_STRING); goto failure; From bab539bf50f769912c96f51ae427d4bac122e5d4 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 20 Jun 2023 19:36:26 -0700 Subject: [PATCH 08/15] More stats for heap types --- Python/specialize.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/Python/specialize.c b/Python/specialize.c index cde2d76f7b8f82..7cdf99c08a2a9c 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -443,14 +443,17 @@ _PyCode_Quicken(PyCodeObject *code) #define SPEC_FAIL_UNPACK_SEQUENCE_SEQUENCE 10 // TO_BOOL -#define SPEC_FAIL_TO_BOOL_BYTEARRAY 9 -#define SPEC_FAIL_TO_BOOL_BYTES 10 -#define SPEC_FAIL_TO_BOOL_DICT 11 -#define SPEC_FAIL_TO_BOOL_FLOAT 12 -#define SPEC_FAIL_TO_BOOL_HEAP_TYPE 13 -#define SPEC_FAIL_TO_BOOL_MEMORY_VIEW 14 -#define SPEC_FAIL_TO_BOOL_SET 15 -#define SPEC_FAIL_TO_BOOL_TUPLE 16 +#define SPEC_FAIL_TO_BOOL_BYTEARRAY 9 +#define SPEC_FAIL_TO_BOOL_BYTES 10 +#define SPEC_FAIL_TO_BOOL_DICT 11 +#define SPEC_FAIL_TO_BOOL_FLOAT 12 +#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_MAPPING 13 +#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_NUMBER 14 +#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_SEQUENCE 15 +#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_TRUE 16 +#define SPEC_FAIL_TO_BOOL_MEMORY_VIEW 17 +#define SPEC_FAIL_TO_BOOL_SET 18 +#define SPEC_FAIL_TO_BOOL_TUPLE 19 static int function_kind(PyCodeObject *code); static bool function_check_args(PyObject *o, int expected_argcount, int opcode); @@ -2286,7 +2289,22 @@ _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr) goto failure; } if (PyType_HasFeature(Py_TYPE(value), Py_TPFLAGS_HEAPTYPE)) { - SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE); + PyNumberMethods *nb = Py_TYPE(value)->tp_as_number; + if (nb && nb->nb_bool) { + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_NUMBER); + goto failure; + } + PyMappingMethods *mp = Py_TYPE(value)->tp_as_mapping; + if (mp && mp->mp_length) { + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_MAPPING); + goto failure; + } + PySequenceMethods *sq = Py_TYPE(value)->tp_as_sequence; + if (sq && sq->sq_length) { + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_SEQUENCE); + goto failure; + } + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_TRUE); goto failure; } if (PyMemoryView_Check(value)) { From 757b1ccf830e46f7ee68e7e2e2c12869d81fc81c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 20 Jun 2023 23:11:42 -0700 Subject: [PATCH 09/15] Specialize TO_BOOL_ALWAYS_TRUE --- Include/internal/pycore_code.h | 1 + Include/internal/pycore_opcode.h | 52 +- Include/opcode.h | 129 ++-- Lib/_opcode_metadata.py | 1 + Lib/opcode.py | 1 + Lib/test/test_dis.py | 225 +++---- Python/bytecodes.c | 25 +- Python/generated_cases.c.h | 986 ++++++++++++++++--------------- Python/opcode_metadata.h | 19 +- Python/opcode_targets.h | 48 +- Python/specialize.c | 68 ++- 11 files changed, 809 insertions(+), 746 deletions(-) diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 643e277e2f605b..d1829eb3245d26 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -103,6 +103,7 @@ typedef struct { typedef struct { uint16_t counter; + uint16_t version[2]; } _PyToBoolCache; #define INLINE_CACHE_ENTRIES_TO_BOOL CACHE_ENTRIES(_PyToBoolCache) diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h index 410c1c0d8c3ced..814f768bc46392 100644 --- a/Include/internal/pycore_opcode.h +++ b/Include/internal/pycore_opcode.h @@ -19,7 +19,7 @@ extern const uint8_t _PyOpcode_Deopt[256]; #ifdef NEED_OPCODE_TABLES const uint8_t _PyOpcode_Caches[256] = { - [TO_BOOL] = 1, + [TO_BOOL] = 3, [BINARY_SUBSCR] = 1, [STORE_SUBSCR] = 1, [UNPACK_SEQUENCE] = 1, @@ -222,6 +222,7 @@ const uint8_t _PyOpcode_Deopt[256] = { [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR, [SWAP] = SWAP, [TO_BOOL] = TO_BOOL, + [TO_BOOL_ALWAYS_TRUE] = TO_BOOL, [TO_BOOL_BOOL] = TO_BOOL, [TO_BOOL_INT] = TO_BOOL, [TO_BOOL_LIST] = TO_BOOL, @@ -249,48 +250,48 @@ static const char *const _PyOpcode_OpName[267] = { [END_FOR] = "END_FOR", [END_SEND] = "END_SEND", [TO_BOOL] = "TO_BOOL", + [TO_BOOL_ALWAYS_TRUE] = "TO_BOOL_ALWAYS_TRUE", [TO_BOOL_BOOL] = "TO_BOOL_BOOL", - [TO_BOOL_INT] = "TO_BOOL_INT", [NOP] = "NOP", - [TO_BOOL_LIST] = "TO_BOOL_LIST", + [TO_BOOL_INT] = "TO_BOOL_INT", [UNARY_NEGATIVE] = "UNARY_NEGATIVE", [UNARY_NOT] = "UNARY_NOT", + [TO_BOOL_LIST] = "TO_BOOL_LIST", [TO_BOOL_NONE] = "TO_BOOL_NONE", - [TO_BOOL_STR] = "TO_BOOL_STR", [UNARY_INVERT] = "UNARY_INVERT", - [BINARY_OP_MULTIPLY_INT] = "BINARY_OP_MULTIPLY_INT", + [TO_BOOL_STR] = "TO_BOOL_STR", [RESERVED] = "RESERVED", + [BINARY_OP_MULTIPLY_INT] = "BINARY_OP_MULTIPLY_INT", [BINARY_OP_ADD_INT] = "BINARY_OP_ADD_INT", [BINARY_OP_SUBTRACT_INT] = "BINARY_OP_SUBTRACT_INT", [BINARY_OP_MULTIPLY_FLOAT] = "BINARY_OP_MULTIPLY_FLOAT", [BINARY_OP_ADD_FLOAT] = "BINARY_OP_ADD_FLOAT", [BINARY_OP_SUBTRACT_FLOAT] = "BINARY_OP_SUBTRACT_FLOAT", - [BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE", [MAKE_FUNCTION] = "MAKE_FUNCTION", [BINARY_SUBSCR] = "BINARY_SUBSCR", [BINARY_SLICE] = "BINARY_SLICE", [STORE_SLICE] = "STORE_SLICE", + [BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE", [BINARY_OP_INPLACE_ADD_UNICODE] = "BINARY_OP_INPLACE_ADD_UNICODE", - [BINARY_SUBSCR_DICT] = "BINARY_SUBSCR_DICT", [GET_LEN] = "GET_LEN", [MATCH_MAPPING] = "MATCH_MAPPING", [MATCH_SEQUENCE] = "MATCH_SEQUENCE", [MATCH_KEYS] = "MATCH_KEYS", - [BINARY_SUBSCR_GETITEM] = "BINARY_SUBSCR_GETITEM", + [BINARY_SUBSCR_DICT] = "BINARY_SUBSCR_DICT", [PUSH_EXC_INFO] = "PUSH_EXC_INFO", [CHECK_EXC_MATCH] = "CHECK_EXC_MATCH", [CHECK_EG_MATCH] = "CHECK_EG_MATCH", + [BINARY_SUBSCR_GETITEM] = "BINARY_SUBSCR_GETITEM", [BINARY_SUBSCR_LIST_INT] = "BINARY_SUBSCR_LIST_INT", - [BINARY_SUBSCR_TUPLE_INT] = "BINARY_SUBSCR_TUPLE_INT", [FORMAT_SIMPLE] = "FORMAT_SIMPLE", [FORMAT_WITH_SPEC] = "FORMAT_WITH_SPEC", + [BINARY_SUBSCR_TUPLE_INT] = "BINARY_SUBSCR_TUPLE_INT", [STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT", [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT", [SEND_GEN] = "SEND_GEN", [UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE", [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST", - [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", [WITH_EXCEPT_START] = "WITH_EXCEPT_START", [GET_AITER] = "GET_AITER", [GET_ANEXT] = "GET_ANEXT", @@ -298,39 +299,39 @@ static const char *const _PyOpcode_OpName[267] = { [BEFORE_WITH] = "BEFORE_WITH", [END_ASYNC_FOR] = "END_ASYNC_FOR", [CLEANUP_THROW] = "CLEANUP_THROW", + [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT", [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT", [LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE", - [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN", [STORE_SUBSCR] = "STORE_SUBSCR", [DELETE_SUBSCR] = "DELETE_SUBSCR", + [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN", [LOAD_SUPER_ATTR_ATTR] = "LOAD_SUPER_ATTR_ATTR", [LOAD_SUPER_ATTR_METHOD] = "LOAD_SUPER_ATTR_METHOD", [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE", [LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE", [LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT", - [LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT", [GET_ITER] = "GET_ITER", [GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER", - [LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS", + [LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT", [LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS", + [LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS", [LOAD_ATTR_PROPERTY] = "LOAD_ATTR_PROPERTY", - [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN", [LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR", [RETURN_GENERATOR] = "RETURN_GENERATOR", + [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN", [LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES", [LOAD_ATTR_METHOD_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT", [LOAD_ATTR_METHOD_LAZY_DICT] = "LOAD_ATTR_METHOD_LAZY_DICT", [COMPARE_OP_FLOAT] = "COMPARE_OP_FLOAT", [COMPARE_OP_INT] = "COMPARE_OP_INT", [COMPARE_OP_STR] = "COMPARE_OP_STR", - [FOR_ITER_LIST] = "FOR_ITER_LIST", [RETURN_VALUE] = "RETURN_VALUE", - [FOR_ITER_TUPLE] = "FOR_ITER_TUPLE", + [FOR_ITER_LIST] = "FOR_ITER_LIST", [SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS", - [FOR_ITER_RANGE] = "FOR_ITER_RANGE", + [FOR_ITER_TUPLE] = "FOR_ITER_TUPLE", [LOAD_LOCALS] = "LOAD_LOCALS", - [FOR_ITER_GEN] = "FOR_ITER_GEN", + [FOR_ITER_RANGE] = "FOR_ITER_RANGE", [POP_EXCEPT] = "POP_EXCEPT", [STORE_NAME] = "STORE_NAME", [DELETE_NAME] = "DELETE_NAME", @@ -353,9 +354,9 @@ static const char *const _PyOpcode_OpName[267] = { [IMPORT_NAME] = "IMPORT_NAME", [IMPORT_FROM] = "IMPORT_FROM", [JUMP_FORWARD] = "JUMP_FORWARD", + [FOR_ITER_GEN] = "FOR_ITER_GEN", [CALL_BOUND_METHOD_EXACT_ARGS] = "CALL_BOUND_METHOD_EXACT_ARGS", [CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS", - [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS", [POP_JUMP_IF_FALSE] = "POP_JUMP_IF_FALSE", [POP_JUMP_IF_TRUE] = "POP_JUMP_IF_TRUE", [LOAD_GLOBAL] = "LOAD_GLOBAL", @@ -374,7 +375,7 @@ static const char *const _PyOpcode_OpName[267] = { [POP_JUMP_IF_NONE] = "POP_JUMP_IF_NONE", [RAISE_VARARGS] = "RAISE_VARARGS", [GET_AWAITABLE] = "GET_AWAITABLE", - [CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1", + [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS", [BUILD_SLICE] = "BUILD_SLICE", [JUMP_BACKWARD_NO_INTERRUPT] = "JUMP_BACKWARD_NO_INTERRUPT", [MAKE_CELL] = "MAKE_CELL", @@ -390,26 +391,26 @@ static const char *const _PyOpcode_OpName[267] = { [LIST_APPEND] = "LIST_APPEND", [SET_ADD] = "SET_ADD", [MAP_ADD] = "MAP_ADD", - [CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1", + [CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1", [COPY_FREE_VARS] = "COPY_FREE_VARS", [YIELD_VALUE] = "YIELD_VALUE", [RESUME] = "RESUME", [MATCH_CLASS] = "MATCH_CLASS", + [CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1", [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1", [CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS", - [CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O", [BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP", [BUILD_STRING] = "BUILD_STRING", [CONVERT_VALUE] = "CONVERT_VALUE", + [CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O", [CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST", [CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS", - [CALL_NO_KW_LEN] = "CALL_NO_KW_LEN", [LIST_EXTEND] = "LIST_EXTEND", [SET_UPDATE] = "SET_UPDATE", [DICT_MERGE] = "DICT_MERGE", [DICT_UPDATE] = "DICT_UPDATE", + [CALL_NO_KW_LEN] = "CALL_NO_KW_LEN", [CALL_NO_KW_ISINSTANCE] = "CALL_NO_KW_ISINSTANCE", - [CALL_NO_KW_LIST_APPEND] = "CALL_NO_KW_LIST_APPEND", [LOAD_FAST_LOAD_FAST] = "LOAD_FAST_LOAD_FAST", [STORE_FAST_LOAD_FAST] = "STORE_FAST_LOAD_FAST", [STORE_FAST_STORE_FAST] = "STORE_FAST_STORE_FAST", @@ -420,11 +421,11 @@ static const char *const _PyOpcode_OpName[267] = { [LOAD_FROM_DICT_OR_GLOBALS] = "LOAD_FROM_DICT_OR_GLOBALS", [LOAD_FROM_DICT_OR_DEREF] = "LOAD_FROM_DICT_OR_DEREF", [SET_FUNCTION_ATTRIBUTE] = "SET_FUNCTION_ATTRIBUTE", + [CALL_NO_KW_LIST_APPEND] = "CALL_NO_KW_LIST_APPEND", [CALL_NO_KW_METHOD_DESCRIPTOR_O] = "CALL_NO_KW_METHOD_DESCRIPTOR_O", [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS", [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = "CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS", [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = "CALL_NO_KW_METHOD_DESCRIPTOR_FAST", - [182] = "<182>", [183] = "<183>", [184] = "<184>", [185] = "<185>", @@ -513,7 +514,6 @@ static const char *const _PyOpcode_OpName[267] = { #endif #define EXTRA_CASES \ - case 182: \ case 183: \ case 184: \ case 185: \ diff --git a/Include/opcode.h b/Include/opcode.h index ce6c010b021921..9717f06c6f9ee0 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -159,70 +159,71 @@ extern "C" { #define LOAD_ZERO_SUPER_ATTR 265 #define STORE_FAST_MAYBE_NULL 266 #define MAX_PSEUDO_OPCODE 266 -#define TO_BOOL_BOOL 7 -#define TO_BOOL_INT 8 -#define TO_BOOL_LIST 10 -#define TO_BOOL_NONE 13 -#define TO_BOOL_STR 14 -#define BINARY_OP_MULTIPLY_INT 16 -#define BINARY_OP_ADD_INT 18 -#define BINARY_OP_SUBTRACT_INT 19 -#define BINARY_OP_MULTIPLY_FLOAT 20 -#define BINARY_OP_ADD_FLOAT 21 -#define BINARY_OP_SUBTRACT_FLOAT 22 -#define BINARY_OP_ADD_UNICODE 23 -#define BINARY_OP_INPLACE_ADD_UNICODE 28 -#define BINARY_SUBSCR_DICT 29 -#define BINARY_SUBSCR_GETITEM 34 -#define BINARY_SUBSCR_LIST_INT 38 -#define BINARY_SUBSCR_TUPLE_INT 39 -#define STORE_SUBSCR_DICT 42 -#define STORE_SUBSCR_LIST_INT 43 -#define SEND_GEN 44 -#define UNPACK_SEQUENCE_TWO_TUPLE 45 -#define UNPACK_SEQUENCE_TUPLE 46 -#define UNPACK_SEQUENCE_LIST 47 -#define STORE_ATTR_INSTANCE_VALUE 48 -#define STORE_ATTR_SLOT 56 -#define STORE_ATTR_WITH_HINT 57 -#define LOAD_GLOBAL_MODULE 58 -#define LOAD_GLOBAL_BUILTIN 59 -#define LOAD_SUPER_ATTR_ATTR 62 -#define LOAD_SUPER_ATTR_METHOD 63 -#define LOAD_ATTR_INSTANCE_VALUE 64 -#define LOAD_ATTR_MODULE 65 -#define LOAD_ATTR_WITH_HINT 66 -#define LOAD_ATTR_SLOT 67 -#define LOAD_ATTR_CLASS 70 -#define LOAD_ATTR_PROPERTY 72 -#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 73 -#define LOAD_ATTR_METHOD_WITH_VALUES 76 -#define LOAD_ATTR_METHOD_NO_DICT 77 -#define LOAD_ATTR_METHOD_LAZY_DICT 78 -#define COMPARE_OP_FLOAT 79 -#define COMPARE_OP_INT 80 -#define COMPARE_OP_STR 81 -#define FOR_ITER_LIST 82 -#define FOR_ITER_TUPLE 84 -#define FOR_ITER_RANGE 86 -#define FOR_ITER_GEN 88 -#define CALL_BOUND_METHOD_EXACT_ARGS 111 -#define CALL_PY_EXACT_ARGS 112 -#define CALL_PY_WITH_DEFAULTS 113 -#define CALL_NO_KW_TYPE_1 132 -#define CALL_NO_KW_STR_1 148 -#define CALL_NO_KW_TUPLE_1 153 -#define CALL_BUILTIN_CLASS 154 -#define CALL_NO_KW_BUILTIN_O 155 -#define CALL_NO_KW_BUILTIN_FAST 159 -#define CALL_BUILTIN_FAST_WITH_KEYWORDS 160 -#define CALL_NO_KW_LEN 161 -#define CALL_NO_KW_ISINSTANCE 166 -#define CALL_NO_KW_LIST_APPEND 167 -#define CALL_NO_KW_METHOD_DESCRIPTOR_O 178 -#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 179 -#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 180 -#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 181 +#define TO_BOOL_ALWAYS_TRUE 7 +#define TO_BOOL_BOOL 8 +#define TO_BOOL_INT 10 +#define TO_BOOL_LIST 13 +#define TO_BOOL_NONE 14 +#define TO_BOOL_STR 16 +#define BINARY_OP_MULTIPLY_INT 18 +#define BINARY_OP_ADD_INT 19 +#define BINARY_OP_SUBTRACT_INT 20 +#define BINARY_OP_MULTIPLY_FLOAT 21 +#define BINARY_OP_ADD_FLOAT 22 +#define BINARY_OP_SUBTRACT_FLOAT 23 +#define BINARY_OP_ADD_UNICODE 28 +#define BINARY_OP_INPLACE_ADD_UNICODE 29 +#define BINARY_SUBSCR_DICT 34 +#define BINARY_SUBSCR_GETITEM 38 +#define BINARY_SUBSCR_LIST_INT 39 +#define BINARY_SUBSCR_TUPLE_INT 42 +#define STORE_SUBSCR_DICT 43 +#define STORE_SUBSCR_LIST_INT 44 +#define SEND_GEN 45 +#define UNPACK_SEQUENCE_TWO_TUPLE 46 +#define UNPACK_SEQUENCE_TUPLE 47 +#define UNPACK_SEQUENCE_LIST 48 +#define STORE_ATTR_INSTANCE_VALUE 56 +#define STORE_ATTR_SLOT 57 +#define STORE_ATTR_WITH_HINT 58 +#define LOAD_GLOBAL_MODULE 59 +#define LOAD_GLOBAL_BUILTIN 62 +#define LOAD_SUPER_ATTR_ATTR 63 +#define LOAD_SUPER_ATTR_METHOD 64 +#define LOAD_ATTR_INSTANCE_VALUE 65 +#define LOAD_ATTR_MODULE 66 +#define LOAD_ATTR_WITH_HINT 67 +#define LOAD_ATTR_SLOT 70 +#define LOAD_ATTR_CLASS 72 +#define LOAD_ATTR_PROPERTY 73 +#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 76 +#define LOAD_ATTR_METHOD_WITH_VALUES 77 +#define LOAD_ATTR_METHOD_NO_DICT 78 +#define LOAD_ATTR_METHOD_LAZY_DICT 79 +#define COMPARE_OP_FLOAT 80 +#define COMPARE_OP_INT 81 +#define COMPARE_OP_STR 82 +#define FOR_ITER_LIST 84 +#define FOR_ITER_TUPLE 86 +#define FOR_ITER_RANGE 88 +#define FOR_ITER_GEN 111 +#define CALL_BOUND_METHOD_EXACT_ARGS 112 +#define CALL_PY_EXACT_ARGS 113 +#define CALL_PY_WITH_DEFAULTS 132 +#define CALL_NO_KW_TYPE_1 148 +#define CALL_NO_KW_STR_1 153 +#define CALL_NO_KW_TUPLE_1 154 +#define CALL_BUILTIN_CLASS 155 +#define CALL_NO_KW_BUILTIN_O 159 +#define CALL_NO_KW_BUILTIN_FAST 160 +#define CALL_BUILTIN_FAST_WITH_KEYWORDS 161 +#define CALL_NO_KW_LEN 166 +#define CALL_NO_KW_ISINSTANCE 167 +#define CALL_NO_KW_LIST_APPEND 178 +#define CALL_NO_KW_METHOD_DESCRIPTOR_O 179 +#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 180 +#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 181 +#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 182 #define NB_ADD 0 #define NB_AND 1 diff --git a/Lib/_opcode_metadata.py b/Lib/_opcode_metadata.py index b1d109383d293e..cf34fadf9a6eda 100644 --- a/Lib/_opcode_metadata.py +++ b/Lib/_opcode_metadata.py @@ -5,6 +5,7 @@ _specializations = { "TO_BOOL": [ + "TO_BOOL_ALWAYS_TRUE", "TO_BOOL_BOOL", "TO_BOOL_INT", "TO_BOOL_LIST", diff --git a/Lib/opcode.py b/Lib/opcode.py index a61ec7846a517a..c2bc51903d595a 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -406,6 +406,7 @@ def pseudo_op(name, op, real_ops): }, "TO_BOOL": { "counter": 1, + "version": 2, }, } diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 924b131983a158..84c76fc17e6d4f 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -489,7 +489,7 @@ def _with(c): %3d >> PUSH_EXC_INFO WITH_EXCEPT_START TO_BOOL - POP_JUMP_IF_TRUE 1 (to 46) + POP_JUMP_IF_TRUE 1 (to 50) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -569,7 +569,7 @@ async def _asyncwith(c): >> CLEANUP_THROW >> END_SEND TO_BOOL - POP_JUMP_IF_TRUE 1 (to 112) + POP_JUMP_IF_TRUE 1 (to 116) RERAISE 2 >> POP_TOP POP_EXCEPT @@ -1572,24 +1572,43 @@ def jumpy(): def _stringify_instruction(instr): # Since line numbers and other offsets change a lot for these # test cases, ignore them. - return repr(instr._replace(positions=None)) + return f" {instr._replace(positions=None)!r}," def _prepare_test_cases(): - _instructions = dis.get_instructions(outer, first_line=expected_outer_line) - print('expected_opinfo_outer = [\n ', - ',\n '.join(map(_stringify_instruction, _instructions)), ',\n]', sep='') - _instructions = dis.get_instructions(outer(), first_line=expected_f_line) - print('expected_opinfo_f = [\n ', - ',\n '.join(map(_stringify_instruction, _instructions)), ',\n]', sep='') - _instructions = dis.get_instructions(outer()(), first_line=expected_inner_line) - print('expected_opinfo_inner = [\n ', - ',\n '.join(map(_stringify_instruction, _instructions)), ',\n]', sep='') - _instructions = dis.get_instructions(jumpy, first_line=expected_jumpy_line) - print('expected_opinfo_jumpy = [\n ', - ',\n '.join(map(_stringify_instruction, _instructions)), ',\n]', sep='') - dis.dis(outer) - -#_prepare_test_cases() + ignore = io.StringIO() + with contextlib.redirect_stdout(ignore): + f = outer() + inner = f() + _instructions_outer = dis.get_instructions(outer, first_line=expected_outer_line) + _instructions_f = dis.get_instructions(f, first_line=expected_f_line) + _instructions_inner = dis.get_instructions(inner, first_line=expected_inner_line) + _instructions_jumpy = dis.get_instructions(jumpy, first_line=expected_jumpy_line) + result = "\n".join( + [ + "expected_opinfo_outer = [", + *map(_stringify_instruction, _instructions_outer), + "]", + "", + "expected_opinfo_f = [", + *map(_stringify_instruction, _instructions_f), + "]", + "", + "expected_opinfo_inner = [", + *map(_stringify_instruction, _instructions_inner), + "]", + "", + "expected_opinfo_jumpy = [", + *map(_stringify_instruction, _instructions_jumpy), + "]", + ] + ) + result = result.replace(repr(repr(code_object_f)), "repr(code_object_f)") + result = result.replace(repr(code_object_f), "code_object_f") + result = result.replace(repr(repr(code_object_inner)), "repr(code_object_inner)") + result = result.replace(repr(code_object_inner), "code_object_inner") + print(result) + +# _prepare_test_cases() Instruction = dis.Instruction @@ -1692,92 +1711,92 @@ def _prepare_test_cases(): Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=106, start_offset=106, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST_CHECK', opcode=127, arg=0, argval='i', argrepr='i', offset=108, start_offset=108, starts_line=11, is_jump_target=True, positions=None), Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=110, start_offset=110, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=35, argval=186, argrepr='to 186', offset=114, start_offset=114, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=116, start_offset=116, starts_line=12, is_jump_target=True, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=126, start_offset=126, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=128, start_offset=128, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=136, start_offset=136, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=138, start_offset=138, starts_line=13, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=140, start_offset=140, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=142, start_offset=142, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=146, start_offset=146, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=148, start_offset=148, starts_line=14, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=150, start_offset=150, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=148, argval='>', argrepr='bool(>)', offset=152, start_offset=152, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=162, argrepr='to 162', offset=156, start_offset=156, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=27, argval=108, argrepr='to 108', offset=158, start_offset=158, starts_line=15, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=162, start_offset=162, starts_line=16, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=164, start_offset=164, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COMPARE_OP', opcode=107, arg=18, argval='<', argrepr='bool(<)', offset=166, start_offset=166, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=174, argrepr='to 174', offset=170, start_offset=170, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=17, argval=208, argrepr='to 208', offset=172, start_offset=172, starts_line=17, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=174, start_offset=174, starts_line=11, is_jump_target=True, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=176, start_offset=176, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=186, argrepr='to 186', offset=180, start_offset=180, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=35, argval=116, argrepr='to 116', offset=182, start_offset=182, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=186, start_offset=186, starts_line=19, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=196, start_offset=196, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=198, start_offset=198, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=206, start_offset=206, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=208, start_offset=208, starts_line=20, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=210, start_offset=210, starts_line=21, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=212, start_offset=212, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=214, start_offset=214, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=218, start_offset=218, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=220, start_offset=220, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=222, start_offset=222, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=224, start_offset=224, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=226, start_offset=226, starts_line=26, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=236, start_offset=236, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=238, start_offset=238, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=246, start_offset=246, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=248, start_offset=248, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=250, start_offset=250, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=252, start_offset=252, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=254, start_offset=254, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=262, start_offset=262, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=264, start_offset=264, starts_line=28, is_jump_target=True, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=274, start_offset=274, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=276, start_offset=276, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=284, start_offset=284, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=286, start_offset=286, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=288, start_offset=288, starts_line=25, is_jump_target=False, positions=None), - Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=290, start_offset=290, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=292, start_offset=292, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=300, argrepr='to 300', offset=296, start_offset=296, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=298, start_offset=298, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=300, start_offset=300, starts_line=None, is_jump_target=True, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=302, start_offset=302, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=304, start_offset=304, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=306, start_offset=306, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=24, argval=264, argrepr='to 264', offset=308, start_offset=308, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=312, start_offset=312, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=37, argval=194, argrepr='to 194', offset=118, start_offset=118, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=120, start_offset=120, starts_line=12, is_jump_target=True, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=130, start_offset=130, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=132, start_offset=132, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=140, start_offset=140, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=142, start_offset=142, starts_line=13, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=144, start_offset=144, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=146, start_offset=146, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=150, start_offset=150, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=152, start_offset=152, starts_line=14, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=154, start_offset=154, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=148, argval='>', argrepr='bool(>)', offset=156, start_offset=156, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=166, argrepr='to 166', offset=160, start_offset=160, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=29, argval=108, argrepr='to 108', offset=162, start_offset=162, starts_line=15, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=166, start_offset=166, starts_line=16, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=168, start_offset=168, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COMPARE_OP', opcode=107, arg=18, argval='<', argrepr='bool(<)', offset=170, start_offset=170, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=1, argval=178, argrepr='to 178', offset=174, start_offset=174, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=19, argval=216, argrepr='to 216', offset=176, start_offset=176, starts_line=17, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=178, start_offset=178, starts_line=11, is_jump_target=True, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=180, start_offset=180, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=2, argval=194, argrepr='to 194', offset=188, start_offset=188, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=37, argval=120, argrepr='to 120', offset=190, start_offset=190, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=194, start_offset=194, starts_line=19, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=204, start_offset=204, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=206, start_offset=206, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=214, start_offset=214, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=216, start_offset=216, starts_line=20, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=218, start_offset=218, starts_line=21, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=220, start_offset=220, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=222, start_offset=222, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=226, start_offset=226, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=228, start_offset=228, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=230, start_offset=230, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=232, start_offset=232, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=234, start_offset=234, starts_line=26, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=244, start_offset=244, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=246, start_offset=246, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=254, start_offset=254, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=256, start_offset=256, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=258, start_offset=258, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=260, start_offset=260, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=262, start_offset=262, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=270, start_offset=270, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=272, start_offset=272, starts_line=28, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=282, start_offset=282, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=284, start_offset=284, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=292, start_offset=292, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RETURN_CONST', opcode=121, arg=0, argval=None, argrepr='None', offset=294, start_offset=294, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=296, start_offset=296, starts_line=25, is_jump_target=False, positions=None), + Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=298, start_offset=298, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='TO_BOOL', opcode=6, arg=None, argval=None, argrepr='', offset=300, start_offset=300, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=1, argval=312, argrepr='to 312', offset=308, start_offset=308, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=310, start_offset=310, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=312, start_offset=312, starts_line=None, is_jump_target=True, positions=None), Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=314, start_offset=314, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=316, start_offset=316, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=318, start_offset=318, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=320, start_offset=320, starts_line=22, is_jump_target=False, positions=None), - Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=330, start_offset=330, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=364, argrepr='to 364', offset=332, start_offset=332, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=334, start_offset=334, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=336, start_offset=336, starts_line=23, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=346, start_offset=346, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=348, start_offset=348, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=356, start_offset=356, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=358, start_offset=358, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_BACKWARD', opcode=140, arg=50, argval=264, argrepr='to 264', offset=360, start_offset=360, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=364, start_offset=364, starts_line=22, is_jump_target=True, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=366, start_offset=366, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=368, start_offset=368, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=370, start_offset=370, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=372, start_offset=372, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=374, start_offset=374, starts_line=28, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=384, start_offset=384, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=386, start_offset=386, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=394, start_offset=394, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=396, start_offset=396, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=398, start_offset=398, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=400, start_offset=400, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=402, start_offset=402, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=316, start_offset=316, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=318, start_offset=318, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=26, argval=272, argrepr='to 272', offset=320, start_offset=320, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=324, start_offset=324, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=326, start_offset=326, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=328, start_offset=328, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=330, start_offset=330, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=332, start_offset=332, starts_line=22, is_jump_target=False, positions=None), + Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=342, start_offset=342, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=376, argrepr='to 376', offset=344, start_offset=344, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=346, start_offset=346, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=348, start_offset=348, starts_line=23, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=358, start_offset=358, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=360, start_offset=360, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=368, start_offset=368, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=370, start_offset=370, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_BACKWARD', opcode=140, arg=52, argval=272, argrepr='to 272', offset=372, start_offset=372, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=376, start_offset=376, starts_line=22, is_jump_target=True, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=378, start_offset=378, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=380, start_offset=380, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=382, start_offset=382, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=384, start_offset=384, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=386, start_offset=386, starts_line=28, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=396, start_offset=396, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=398, start_offset=398, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=406, start_offset=406, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=408, start_offset=408, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=410, start_offset=410, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=412, start_offset=412, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=414, start_offset=414, starts_line=None, is_jump_target=False, positions=None), ] # One last piece of inspect fodder to check the default line number handling diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 850e6ae8a516c2..9c2316f52c2e9b 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -295,6 +295,7 @@ dummy_func( family(to_bool, INLINE_CACHE_ENTRIES_TO_BOOL) = { TO_BOOL, + TO_BOOL_ALWAYS_TRUE, TO_BOOL_BOOL, TO_BOOL_INT, TO_BOOL_LIST, @@ -302,7 +303,7 @@ dummy_func( TO_BOOL_STR, }; - inst(TO_BOOL, (unused/1, value -- res)) { + inst(TO_BOOL, (unused/1, unused/2, value -- res)) { #if ENABLE_SPECIALIZATION _PyToBoolCache *cache = (_PyToBoolCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -324,13 +325,13 @@ dummy_func( } } - inst(TO_BOOL_BOOL, (unused/1, value -- value)) { + inst(TO_BOOL_BOOL, (unused/1, unused/2, value -- value)) { // Coolest (and dumbest-named) specialization ever: DEOPT_IF(!PyBool_Check(value), TO_BOOL); STAT_INC(TO_BOOL, hit); } - inst(TO_BOOL_INT, (unused/1, value -- res)) { + inst(TO_BOOL_INT, (unused/1, unused/2, value -- res)) { DEOPT_IF(!PyLong_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (_PyLong_IsZero((PyLongObject *)value)) { @@ -343,7 +344,7 @@ dummy_func( } } - inst(TO_BOOL_LIST, (unused/1, value -- res)) { + inst(TO_BOOL_LIST, (unused/1, unused/2, value -- res)) { DEOPT_IF(!PyList_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (!Py_SIZE(value)) { @@ -355,14 +356,15 @@ dummy_func( DECREF_INPUTS(); } - inst(TO_BOOL_NONE, (unused/1, value -- res)) { - // This one is a bit weird, because we expect *some* failures: + inst(TO_BOOL_NONE, (unused/1, unused/2, value -- res)) { + // This one is a bit weird, because we expect *some* failures... + // it might be worth combining with TO_BOOL_ALWAYS_TRUE somehow: DEOPT_IF(!Py_IsNone(value), TO_BOOL); STAT_INC(TO_BOOL, hit); res = Py_False; } - inst(TO_BOOL_STR, (unused/1, value -- res)) { + inst(TO_BOOL_STR, (unused/1, unused/2, value -- res)) { DEOPT_IF(!PyUnicode_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (Py_Is(value, &_Py_STR(empty))) { @@ -376,6 +378,15 @@ dummy_func( } } + inst(TO_BOOL_ALWAYS_TRUE, (unused/1, version/2, value -- res)) { + // This one is a bit weird, because we expect *some* failures... + // it might be worth combining with TO_BOOL_NONE somehow: + assert(version); + DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); + STAT_INC(TO_BOOL, hit); + res = Py_True; + } + inst(UNARY_INVERT, (value -- res)) { res = PyNumber_Invert(value); DECREF_INPUTS(); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index f51bb22bec356a..fd2a5a552aae35 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -287,10 +287,10 @@ TARGET(TO_BOOL) { PREDICTED(TO_BOOL); - static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 1, "incorrect cache size"); + static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 3, "incorrect cache size"); PyObject *value = stack_pointer[-1]; PyObject *res; - #line 306 "Python/bytecodes.c" + #line 307 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyToBoolCache *cache = (_PyToBoolCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -304,7 +304,7 @@ int err = PyObject_IsTrue(value); #line 306 "Python/generated_cases.c.h" Py_DECREF(value); - #line 318 "Python/bytecodes.c" + #line 319 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { res = Py_False; @@ -314,25 +314,25 @@ } #line 316 "Python/generated_cases.c.h" stack_pointer[-1] = res; - next_instr += 1; + next_instr += 3; DISPATCH(); } TARGET(TO_BOOL_BOOL) { PyObject *value = stack_pointer[-1]; - #line 328 "Python/bytecodes.c" + #line 329 "Python/bytecodes.c" // Coolest (and dumbest-named) specialization ever: DEOPT_IF(!PyBool_Check(value), TO_BOOL); STAT_INC(TO_BOOL, hit); #line 328 "Python/generated_cases.c.h" - next_instr += 1; + next_instr += 3; DISPATCH(); } TARGET(TO_BOOL_INT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 334 "Python/bytecodes.c" + #line 335 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (_PyLong_IsZero((PyLongObject *)value)) { @@ -342,19 +342,19 @@ else { #line 344 "Python/generated_cases.c.h" Py_DECREF(value); - #line 342 "Python/bytecodes.c" + #line 343 "Python/bytecodes.c" res = Py_True; } #line 349 "Python/generated_cases.c.h" stack_pointer[-1] = res; - next_instr += 1; + next_instr += 3; DISPATCH(); } TARGET(TO_BOOL_LIST) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 347 "Python/bytecodes.c" + #line 348 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (!Py_SIZE(value)) { @@ -366,28 +366,29 @@ #line 367 "Python/generated_cases.c.h" Py_DECREF(value); stack_pointer[-1] = res; - next_instr += 1; + next_instr += 3; DISPATCH(); } TARGET(TO_BOOL_NONE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 359 "Python/bytecodes.c" - // This one is a bit weird, because we expect *some* failures: + #line 360 "Python/bytecodes.c" + // This one is a bit weird, because we expect *some* failures... + // it might be worth combining with TO_BOOL_ALWAYS_TRUE somehow: DEOPT_IF(!Py_IsNone(value), TO_BOOL); STAT_INC(TO_BOOL, hit); res = Py_False; - #line 382 "Python/generated_cases.c.h" + #line 383 "Python/generated_cases.c.h" stack_pointer[-1] = res; - next_instr += 1; + next_instr += 3; DISPATCH(); } TARGET(TO_BOOL_STR) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 366 "Python/bytecodes.c" + #line 368 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (Py_Is(value, &_Py_STR(empty))) { @@ -396,27 +397,44 @@ } else { assert(Py_SIZE(value)); - #line 400 "Python/generated_cases.c.h" + #line 401 "Python/generated_cases.c.h" Py_DECREF(value); - #line 375 "Python/bytecodes.c" + #line 377 "Python/bytecodes.c" res = Py_True; } - #line 405 "Python/generated_cases.c.h" + #line 406 "Python/generated_cases.c.h" stack_pointer[-1] = res; - next_instr += 1; + next_instr += 3; + DISPATCH(); + } + + TARGET(TO_BOOL_ALWAYS_TRUE) { + PyObject *value = stack_pointer[-1]; + PyObject *res; + uint32_t version = read_u32(&next_instr[1].cache); + #line 382 "Python/bytecodes.c" + // This one is a bit weird, because we expect *some* failures... + // it might be worth combining with TO_BOOL_NONE somehow: + assert(version); + DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); + STAT_INC(TO_BOOL, hit); + res = Py_True; + #line 423 "Python/generated_cases.c.h" + stack_pointer[-1] = res; + next_instr += 3; DISPATCH(); } TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 380 "Python/bytecodes.c" + #line 391 "Python/bytecodes.c" res = PyNumber_Invert(value); - #line 416 "Python/generated_cases.c.h" + #line 434 "Python/generated_cases.c.h" Py_DECREF(value); - #line 382 "Python/bytecodes.c" + #line 393 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 420 "Python/generated_cases.c.h" + #line 438 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -427,10 +445,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 398 "Python/bytecodes.c" + #line 409 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 434 "Python/generated_cases.c.h" + #line 452 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -438,13 +456,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 403 "Python/bytecodes.c" + #line 414 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 448 "Python/generated_cases.c.h" + #line 466 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -459,10 +477,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 398 "Python/bytecodes.c" + #line 409 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 466 "Python/generated_cases.c.h" + #line 484 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -470,13 +488,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 411 "Python/bytecodes.c" + #line 422 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 480 "Python/generated_cases.c.h" + #line 498 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -491,10 +509,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 398 "Python/bytecodes.c" + #line 409 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 498 "Python/generated_cases.c.h" + #line 516 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -502,13 +520,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 419 "Python/bytecodes.c" + #line 430 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 512 "Python/generated_cases.c.h" + #line 530 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -523,10 +541,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 434 "Python/bytecodes.c" + #line 445 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 530 "Python/generated_cases.c.h" + #line 548 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -534,13 +552,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 439 "Python/bytecodes.c" + #line 450 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 544 "Python/generated_cases.c.h" + #line 562 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -555,10 +573,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 434 "Python/bytecodes.c" + #line 445 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 562 "Python/generated_cases.c.h" + #line 580 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -566,13 +584,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 447 "Python/bytecodes.c" + #line 458 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 576 "Python/generated_cases.c.h" + #line 594 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -587,10 +605,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 434 "Python/bytecodes.c" + #line 445 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 594 "Python/generated_cases.c.h" + #line 612 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -598,13 +616,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 455 "Python/bytecodes.c" + #line 466 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 608 "Python/generated_cases.c.h" + #line 626 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -619,10 +637,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 470 "Python/bytecodes.c" + #line 481 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 626 "Python/generated_cases.c.h" + #line 644 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -630,13 +648,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 475 "Python/bytecodes.c" + #line 486 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; - #line 640 "Python/generated_cases.c.h" + #line 658 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -651,17 +669,17 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 470 "Python/bytecodes.c" + #line 481 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 658 "Python/generated_cases.c.h" + #line 676 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 492 "Python/bytecodes.c" + #line 503 "Python/bytecodes.c" _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; assert(true_next.op.code == STORE_FAST); PyObject **target_local = &GETLOCAL(true_next.op.arg); @@ -685,7 +703,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_OP + 1); - #line 689 "Python/generated_cases.c.h" + #line 707 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -697,7 +715,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 529 "Python/bytecodes.c" + #line 540 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -709,12 +727,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); - #line 713 "Python/generated_cases.c.h" + #line 731 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 541 "Python/bytecodes.c" + #line 552 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 718 "Python/generated_cases.c.h" + #line 736 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -726,7 +744,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 545 "Python/bytecodes.c" + #line 556 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -739,7 +757,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; - #line 743 "Python/generated_cases.c.h" + #line 761 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -750,7 +768,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 560 "Python/bytecodes.c" + #line 571 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -763,7 +781,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; - #line 767 "Python/generated_cases.c.h" + #line 785 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -772,7 +790,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 575 "Python/bytecodes.c" + #line 586 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -786,7 +804,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 790 "Python/generated_cases.c.h" + #line 808 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -797,7 +815,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 591 "Python/bytecodes.c" + #line 602 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -811,7 +829,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); - #line 815 "Python/generated_cases.c.h" + #line 833 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -822,7 +840,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 607 "Python/bytecodes.c" + #line 618 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -830,14 +848,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } - #line 834 "Python/generated_cases.c.h" + #line 852 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 615 "Python/bytecodes.c" + #line 626 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub - #line 841 "Python/generated_cases.c.h" + #line 859 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -849,7 +867,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 622 "Python/bytecodes.c" + #line 633 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -872,15 +890,15 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 876 "Python/generated_cases.c.h" + #line 894 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 647 "Python/bytecodes.c" + #line 658 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; - #line 884 "Python/generated_cases.c.h" + #line 902 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -888,13 +906,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 651 "Python/bytecodes.c" + #line 662 "Python/bytecodes.c" int err = PySet_Add(set, v); - #line 894 "Python/generated_cases.c.h" + #line 912 "Python/generated_cases.c.h" Py_DECREF(v); - #line 653 "Python/bytecodes.c" + #line 664 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 898 "Python/generated_cases.c.h" + #line 916 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -906,7 +924,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 663 "Python/bytecodes.c" + #line 674 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -921,13 +939,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); - #line 925 "Python/generated_cases.c.h" + #line 943 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 678 "Python/bytecodes.c" + #line 689 "Python/bytecodes.c" if (err) goto pop_3_error; - #line 931 "Python/generated_cases.c.h" + #line 949 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -937,7 +955,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 682 "Python/bytecodes.c" + #line 693 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -954,7 +972,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 958 "Python/generated_cases.c.h" + #line 976 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -964,13 +982,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 701 "Python/bytecodes.c" + #line 712 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; - #line 974 "Python/generated_cases.c.h" + #line 992 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -979,15 +997,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 709 "Python/bytecodes.c" + #line 720 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); - #line 986 "Python/generated_cases.c.h" + #line 1004 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 712 "Python/bytecodes.c" + #line 723 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 991 "Python/generated_cases.c.h" + #line 1009 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -995,14 +1013,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 716 "Python/bytecodes.c" + #line 727 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); - #line 1002 "Python/generated_cases.c.h" + #line 1020 "Python/generated_cases.c.h" Py_DECREF(value); - #line 719 "Python/bytecodes.c" + #line 730 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 1006 "Python/generated_cases.c.h" + #line 1024 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -1011,15 +1029,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 723 "Python/bytecodes.c" + #line 734 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); - #line 1018 "Python/generated_cases.c.h" + #line 1036 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 726 "Python/bytecodes.c" + #line 737 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 1023 "Python/generated_cases.c.h" + #line 1041 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -1027,7 +1045,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 730 "Python/bytecodes.c" + #line 741 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -1045,12 +1063,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } - #line 1049 "Python/generated_cases.c.h" + #line 1067 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 750 "Python/bytecodes.c" + #line 761 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); /* Restore previous cframe and return. */ @@ -1059,12 +1077,12 @@ assert(!_PyErr_Occurred(tstate)); _Py_LeaveRecursiveCallTstate(tstate); return retval; - #line 1063 "Python/generated_cases.c.h" + #line 1081 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 761 "Python/bytecodes.c" + #line 772 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1077,12 +1095,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1081 "Python/generated_cases.c.h" + #line 1099 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 776 "Python/bytecodes.c" + #line 787 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1099,11 +1117,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1103 "Python/generated_cases.c.h" + #line 1121 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 795 "Python/bytecodes.c" + #line 806 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1117,11 +1135,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1121 "Python/generated_cases.c.h" + #line 1139 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 811 "Python/bytecodes.c" + #line 822 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1139,13 +1157,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1143 "Python/generated_cases.c.h" + #line 1161 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 831 "Python/bytecodes.c" + #line 842 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1158,16 +1176,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1162 "Python/generated_cases.c.h" + #line 1180 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 844 "Python/bytecodes.c" + #line 855 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1169 "Python/generated_cases.c.h" + #line 1187 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 849 "Python/bytecodes.c" + #line 860 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1180,7 +1198,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1184 "Python/generated_cases.c.h" + #line 1202 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1188,7 +1206,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 864 "Python/bytecodes.c" + #line 875 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1231,7 +1249,7 @@ Py_DECREF(next_iter); } } - #line 1235 "Python/generated_cases.c.h" + #line 1253 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; DISPATCH(); @@ -1240,16 +1258,16 @@ TARGET(GET_AWAITABLE) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 909 "Python/bytecodes.c" + #line 920 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1251 "Python/generated_cases.c.h" + #line 1269 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 916 "Python/bytecodes.c" + #line 927 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1266,7 +1284,7 @@ } if (iter == NULL) goto pop_1_error; - #line 1270 "Python/generated_cases.c.h" + #line 1288 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1277,7 +1295,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 940 "Python/bytecodes.c" + #line 951 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1324,7 +1342,7 @@ } } Py_DECREF(v); - #line 1328 "Python/generated_cases.c.h" + #line 1346 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1333,7 +1351,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 989 "Python/bytecodes.c" + #line 1000 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1349,12 +1367,12 @@ tstate->exc_info = &gen->gi_exc_state; SKIP_OVER(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1353 "Python/generated_cases.c.h" + #line 1371 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1007 "Python/bytecodes.c" + #line 1018 "Python/bytecodes.c" assert(frame != &entry_frame); assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ PyGenObject *gen = _PyFrame_GetGenerator(frame); @@ -1372,12 +1390,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1376 "Python/generated_cases.c.h" + #line 1394 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1027 "Python/bytecodes.c" + #line 1038 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1394,15 +1412,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1398 "Python/generated_cases.c.h" + #line 1416 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 1046 "Python/bytecodes.c" + #line 1057 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1406 "Python/generated_cases.c.h" + #line 1424 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1410,7 +1428,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 1051 "Python/bytecodes.c" + #line 1062 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1428,26 +1446,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1432 "Python/generated_cases.c.h" + #line 1450 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 1071 "Python/bytecodes.c" + #line 1082 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1441 "Python/generated_cases.c.h" + #line 1459 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 1074 "Python/bytecodes.c" + #line 1085 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1451 "Python/generated_cases.c.h" + #line 1469 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1458,23 +1476,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1083 "Python/bytecodes.c" + #line 1094 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1467 "Python/generated_cases.c.h" + #line 1485 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1088 "Python/bytecodes.c" + #line 1099 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1478 "Python/generated_cases.c.h" + #line 1496 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1483,9 +1501,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1097 "Python/bytecodes.c" + #line 1108 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1489 "Python/generated_cases.c.h" + #line 1507 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1493,7 +1511,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1101 "Python/bytecodes.c" + #line 1112 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1515,7 +1533,7 @@ if (true) goto error; } } - #line 1519 "Python/generated_cases.c.h" + #line 1537 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1523,33 +1541,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1126 "Python/bytecodes.c" + #line 1137 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1534 "Python/generated_cases.c.h" + #line 1552 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1133 "Python/bytecodes.c" + #line 1144 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1543 "Python/generated_cases.c.h" + #line 1561 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1140 "Python/bytecodes.c" + #line 1151 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1547 "Python/generated_cases.c.h" + #line 1565 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1144 "Python/bytecodes.c" + #line 1155 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; @@ -1566,7 +1584,7 @@ name); goto error; } - #line 1570 "Python/generated_cases.c.h" + #line 1588 "Python/generated_cases.c.h" DISPATCH(); } @@ -1574,7 +1592,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1170 "Python/bytecodes.c" + #line 1181 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1587,11 +1605,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1591 "Python/generated_cases.c.h" + #line 1609 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1183 "Python/bytecodes.c" + #line 1194 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1595 "Python/generated_cases.c.h" + #line 1613 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1601,14 +1619,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1187 "Python/bytecodes.c" + #line 1198 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1612 "Python/generated_cases.c.h" + #line 1630 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1619,7 +1637,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1197 "Python/bytecodes.c" + #line 1208 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1627,7 +1645,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1631 "Python/generated_cases.c.h" + #line 1649 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1638,7 +1656,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1208 "Python/bytecodes.c" + #line 1219 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1646,7 +1664,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1650 "Python/generated_cases.c.h" + #line 1668 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1656,15 +1674,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1219 "Python/bytecodes.c" + #line 1230 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); - #line 1664 "Python/generated_cases.c.h" + #line 1682 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1223 "Python/bytecodes.c" + #line 1234 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1668 "Python/generated_cases.c.h" + #line 1686 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1675,7 +1693,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1234 "Python/bytecodes.c" + #line 1245 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); @@ -1691,12 +1709,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1695 "Python/generated_cases.c.h" + #line 1713 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1250 "Python/bytecodes.c" + #line 1261 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1700 "Python/generated_cases.c.h" + #line 1718 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1704,34 +1722,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1254 "Python/bytecodes.c" + #line 1265 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1711 "Python/generated_cases.c.h" + #line 1729 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1257 "Python/bytecodes.c" + #line 1268 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1715 "Python/generated_cases.c.h" + #line 1733 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1261 "Python/bytecodes.c" + #line 1272 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1725 "Python/generated_cases.c.h" + #line 1743 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1264 "Python/bytecodes.c" + #line 1275 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1729 "Python/generated_cases.c.h" + #line 1747 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1268 "Python/bytecodes.c" + #line 1279 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1743,7 +1761,7 @@ } goto error; } - #line 1747 "Python/generated_cases.c.h" + #line 1765 "Python/generated_cases.c.h" DISPATCH(); } @@ -1751,7 +1769,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1282 "Python/bytecodes.c" + #line 1293 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1759,7 +1777,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1763 "Python/generated_cases.c.h" + #line 1781 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1771,7 +1789,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1282 "Python/bytecodes.c" + #line 1293 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1779,13 +1797,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1783 "Python/generated_cases.c.h" + #line 1801 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1294 "Python/bytecodes.c" + #line 1305 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1842,7 +1860,7 @@ } } } - #line 1846 "Python/generated_cases.c.h" + #line 1864 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1855,7 +1873,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1294 "Python/bytecodes.c" + #line 1305 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1912,7 +1930,7 @@ } } } - #line 1916 "Python/generated_cases.c.h" + #line 1934 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1924,7 +1942,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1363 "Python/bytecodes.c" + #line 1374 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1976,7 +1994,7 @@ } } null = NULL; - #line 1980 "Python/generated_cases.c.h" + #line 1998 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1990,7 +2008,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1417 "Python/bytecodes.c" + #line 1428 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -2001,7 +2019,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2005 "Python/generated_cases.c.h" + #line 2023 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2016,7 +2034,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1430 "Python/bytecodes.c" + #line 1441 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -2031,7 +2049,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2035 "Python/generated_cases.c.h" + #line 2053 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2041,16 +2059,16 @@ } TARGET(DELETE_FAST) { - #line 1447 "Python/bytecodes.c" + #line 1458 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 2049 "Python/generated_cases.c.h" + #line 2067 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1453 "Python/bytecodes.c" + #line 1464 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -2059,12 +2077,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2063 "Python/generated_cases.c.h" + #line 2081 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1464 "Python/bytecodes.c" + #line 1475 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2075,14 +2093,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2079 "Python/generated_cases.c.h" + #line 2097 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1477 "Python/bytecodes.c" + #line 1488 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus); @@ -2117,14 +2135,14 @@ } Py_INCREF(value); } - #line 2121 "Python/generated_cases.c.h" + #line 2139 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1514 "Python/bytecodes.c" + #line 1525 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2132,7 +2150,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2136 "Python/generated_cases.c.h" + #line 2154 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2140,18 +2158,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1524 "Python/bytecodes.c" + #line 1535 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2149 "Python/generated_cases.c.h" + #line 2167 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1531 "Python/bytecodes.c" + #line 1542 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = _PyFrame_GetCode(frame); assert(PyFunction_Check(frame->f_funcobj)); @@ -2162,22 +2180,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2166 "Python/generated_cases.c.h" + #line 2184 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1544 "Python/bytecodes.c" + #line 1555 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2175 "Python/generated_cases.c.h" + #line 2193 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1546 "Python/bytecodes.c" + #line 1557 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2181 "Python/generated_cases.c.h" + #line 2199 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2187,10 +2205,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1550 "Python/bytecodes.c" + #line 1561 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2194 "Python/generated_cases.c.h" + #line 2212 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2200,10 +2218,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1555 "Python/bytecodes.c" + #line 1566 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2207 "Python/generated_cases.c.h" + #line 2225 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2213,7 +2231,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1560 "Python/bytecodes.c" + #line 1571 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2224,13 +2242,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2228 "Python/generated_cases.c.h" + #line 2246 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1571 "Python/bytecodes.c" + #line 1582 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2234 "Python/generated_cases.c.h" + #line 2252 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2239,13 +2257,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1578 "Python/bytecodes.c" + #line 1589 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2245 "Python/generated_cases.c.h" + #line 2263 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1580 "Python/bytecodes.c" + #line 1591 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2249 "Python/generated_cases.c.h" + #line 2267 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2253,7 +2271,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1584 "Python/bytecodes.c" + #line 1595 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2268,7 +2286,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2272 "Python/generated_cases.c.h" + #line 2290 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2278,7 +2296,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1601 "Python/bytecodes.c" + #line 1612 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2286,13 +2304,13 @@ if (map == NULL) goto error; - #line 2290 "Python/generated_cases.c.h" + #line 2308 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1609 "Python/bytecodes.c" + #line 1620 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2296 "Python/generated_cases.c.h" + #line 2314 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2300,7 +2318,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1613 "Python/bytecodes.c" + #line 1624 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2340,7 +2358,7 @@ Py_DECREF(ann_dict); } } - #line 2344 "Python/generated_cases.c.h" + #line 2362 "Python/generated_cases.c.h" DISPATCH(); } @@ -2348,7 +2366,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1655 "Python/bytecodes.c" + #line 1666 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2358,14 +2376,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2362 "Python/generated_cases.c.h" + #line 2380 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1665 "Python/bytecodes.c" + #line 1676 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2369 "Python/generated_cases.c.h" + #line 2387 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2373,7 +2391,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1669 "Python/bytecodes.c" + #line 1680 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -2381,12 +2399,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2385 "Python/generated_cases.c.h" + #line 2403 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1677 "Python/bytecodes.c" + #line 1688 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2390 "Python/generated_cases.c.h" + #line 2408 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2394,17 +2412,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1683 "Python/bytecodes.c" + #line 1694 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (_PyDict_MergeEx(dict, update, 2) < 0) { format_kwargs_error(tstate, PEEK(3 + oparg), update); - #line 2403 "Python/generated_cases.c.h" + #line 2421 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1688 "Python/bytecodes.c" + #line 1699 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2408 "Python/generated_cases.c.h" + #line 2426 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2413,25 +2431,25 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1694 "Python/bytecodes.c" + #line 1705 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2423 "Python/generated_cases.c.h" + #line 2441 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1702 "Python/bytecodes.c" + #line 1713 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); - #line 2435 "Python/generated_cases.c.h" + #line 2453 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2442,7 +2460,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1716 "Python/bytecodes.c" + #line 1727 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2484,16 +2502,16 @@ } } } - #line 2488 "Python/generated_cases.c.h" + #line 2506 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1758 "Python/bytecodes.c" + #line 1769 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; - #line 2497 "Python/generated_cases.c.h" + #line 2515 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2508,20 +2526,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1777 "Python/bytecodes.c" + #line 1788 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2519 "Python/generated_cases.c.h" + #line 2537 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1784 "Python/bytecodes.c" + #line 1795 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2525 "Python/generated_cases.c.h" + #line 2543 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2536,7 +2554,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1788 "Python/bytecodes.c" + #line 1799 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2559,7 +2577,7 @@ res = res2; res2 = NULL; } - #line 2563 "Python/generated_cases.c.h" + #line 2581 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2573,7 +2591,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1827 "Python/bytecodes.c" + #line 1838 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2607,9 +2625,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2611 "Python/generated_cases.c.h" + #line 2629 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1861 "Python/bytecodes.c" + #line 1872 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2618,12 +2636,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2622 "Python/generated_cases.c.h" + #line 2640 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1870 "Python/bytecodes.c" + #line 1881 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2627 "Python/generated_cases.c.h" + #line 2645 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2637,7 +2655,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1879 "Python/bytecodes.c" + #line 1890 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2650,7 +2668,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2654 "Python/generated_cases.c.h" + #line 2672 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2665,7 +2683,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1895 "Python/bytecodes.c" + #line 1906 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2678,7 +2696,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2682 "Python/generated_cases.c.h" + #line 2700 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2693,7 +2711,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1911 "Python/bytecodes.c" + #line 1922 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2720,7 +2738,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2724 "Python/generated_cases.c.h" + #line 2742 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2735,7 +2753,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1941 "Python/bytecodes.c" + #line 1952 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2745,7 +2763,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2749 "Python/generated_cases.c.h" + #line 2767 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2760,7 +2778,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1954 "Python/bytecodes.c" + #line 1965 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2772,7 +2790,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2776 "Python/generated_cases.c.h" + #line 2794 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2786,7 +2804,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1969 "Python/bytecodes.c" + #line 1980 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2810,7 +2828,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2814 "Python/generated_cases.c.h" + #line 2832 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2818,7 +2836,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 1995 "Python/bytecodes.c" + #line 2006 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2844,7 +2862,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2848 "Python/generated_cases.c.h" + #line 2866 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2852,7 +2870,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2023 "Python/bytecodes.c" + #line 2034 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2870,7 +2888,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2874 "Python/generated_cases.c.h" + #line 2892 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2881,7 +2899,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 2043 "Python/bytecodes.c" + #line 2054 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2920,7 +2938,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2924 "Python/generated_cases.c.h" + #line 2942 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2931,7 +2949,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2084 "Python/bytecodes.c" + #line 2095 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2941,7 +2959,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2945 "Python/generated_cases.c.h" + #line 2963 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2953,7 +2971,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2103 "Python/bytecodes.c" + #line 2114 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2966,10 +2984,10 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 5) <= Py_GE); res = PyObject_RichCompare(left, right, oparg >> 5); - #line 2970 "Python/generated_cases.c.h" + #line 2988 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2116 "Python/bytecodes.c" + #line 2127 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; if (oparg & 16) { int res_bool = PyObject_IsTrue(res); @@ -2977,7 +2995,7 @@ if (res_bool < 0) goto pop_2_error; res = res_bool ? Py_True : Py_False; } - #line 2981 "Python/generated_cases.c.h" + #line 2999 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2988,7 +3006,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2126 "Python/bytecodes.c" + #line 2137 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3000,7 +3018,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3004 "Python/generated_cases.c.h" + #line 3022 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3011,7 +3029,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2141 "Python/bytecodes.c" + #line 2152 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -3027,7 +3045,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3031 "Python/generated_cases.c.h" + #line 3049 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3038,7 +3056,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2160 "Python/bytecodes.c" + #line 2171 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3051,7 +3069,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3055 "Python/generated_cases.c.h" + #line 3073 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3062,14 +3080,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2175 "Python/bytecodes.c" + #line 2186 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3068 "Python/generated_cases.c.h" + #line 3086 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2177 "Python/bytecodes.c" + #line 2188 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3073 "Python/generated_cases.c.h" + #line 3091 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3079,15 +3097,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2181 "Python/bytecodes.c" + #line 2192 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3085 "Python/generated_cases.c.h" + #line 3103 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2183 "Python/bytecodes.c" + #line 2194 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3091 "Python/generated_cases.c.h" + #line 3109 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3098,12 +3116,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2188 "Python/bytecodes.c" + #line 2199 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3104 "Python/generated_cases.c.h" + #line 3122 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2190 "Python/bytecodes.c" + #line 2201 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3111,10 +3129,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3115 "Python/generated_cases.c.h" + #line 3133 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2198 "Python/bytecodes.c" + #line 2209 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3123,7 +3141,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3127 "Python/generated_cases.c.h" + #line 3145 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3133,21 +3151,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2209 "Python/bytecodes.c" + #line 2220 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3140 "Python/generated_cases.c.h" + #line 3158 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2212 "Python/bytecodes.c" + #line 2223 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3147 "Python/generated_cases.c.h" + #line 3165 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2217 "Python/bytecodes.c" + #line 2228 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3151 "Python/generated_cases.c.h" + #line 3169 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3156,15 +3174,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2221 "Python/bytecodes.c" + #line 2232 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3163 "Python/generated_cases.c.h" + #line 3181 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2224 "Python/bytecodes.c" + #line 2235 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3168 "Python/generated_cases.c.h" + #line 3186 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3173,25 +3191,25 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2228 "Python/bytecodes.c" + #line 2239 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3181 "Python/generated_cases.c.h" + #line 3199 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2234 "Python/bytecodes.c" + #line 2245 "Python/bytecodes.c" JUMPBY(oparg); - #line 3190 "Python/generated_cases.c.h" + #line 3208 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2238 "Python/bytecodes.c" + #line 2249 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3209,13 +3227,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3213 "Python/generated_cases.c.h" + #line 3231 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2269 "Python/bytecodes.c" + #line 2280 "Python/bytecodes.c" PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255]; Py_INCREF(executor); @@ -3225,81 +3243,81 @@ goto error; } goto resume_frame; - #line 3229 "Python/generated_cases.c.h" + #line 3247 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2281 "Python/bytecodes.c" + #line 2292 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsFalse(cond)); - #line 3237 "Python/generated_cases.c.h" + #line 3255 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2286 "Python/bytecodes.c" + #line 2297 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsTrue(cond)); - #line 3247 "Python/generated_cases.c.h" + #line 3265 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2291 "Python/bytecodes.c" + #line 2302 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3256 "Python/generated_cases.c.h" + #line 3274 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2293 "Python/bytecodes.c" + #line 2304 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3261 "Python/generated_cases.c.h" + #line 3279 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2298 "Python/bytecodes.c" + #line 2309 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3273 "Python/generated_cases.c.h" + #line 3291 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2303 "Python/bytecodes.c" + #line 2314 "Python/bytecodes.c" } - #line 3277 "Python/generated_cases.c.h" + #line 3295 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2307 "Python/bytecodes.c" + #line 2318 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3290 "Python/generated_cases.c.h" + #line 3308 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2316 "Python/bytecodes.c" + #line 2327 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3303 "Python/generated_cases.c.h" + #line 3321 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3310,16 +3328,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2324 "Python/bytecodes.c" + #line 2335 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3319 "Python/generated_cases.c.h" + #line 3337 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2329 "Python/bytecodes.c" + #line 2340 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3327,7 +3345,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3331 "Python/generated_cases.c.h" + #line 3349 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3336,10 +3354,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2339 "Python/bytecodes.c" + #line 2350 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3343 "Python/generated_cases.c.h" + #line 3361 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3348,10 +3366,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2344 "Python/bytecodes.c" + #line 2355 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3355 "Python/generated_cases.c.h" + #line 3373 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3361,11 +3379,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2349 "Python/bytecodes.c" + #line 2360 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3369 "Python/generated_cases.c.h" + #line 3387 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3374,14 +3392,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2355 "Python/bytecodes.c" + #line 2366 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3381 "Python/generated_cases.c.h" + #line 3399 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2358 "Python/bytecodes.c" + #line 2369 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3385 "Python/generated_cases.c.h" + #line 3403 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3389,7 +3407,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2362 "Python/bytecodes.c" + #line 2373 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3412,11 +3430,11 @@ if (iter == NULL) { goto error; } - #line 3416 "Python/generated_cases.c.h" + #line 3434 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2385 "Python/bytecodes.c" + #line 2396 "Python/bytecodes.c" } - #line 3420 "Python/generated_cases.c.h" + #line 3438 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3426,7 +3444,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2403 "Python/bytecodes.c" + #line 2414 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3458,7 +3476,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3462 "Python/generated_cases.c.h" + #line 3480 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3466,7 +3484,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2437 "Python/bytecodes.c" + #line 2448 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3492,14 +3510,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3496 "Python/generated_cases.c.h" + #line 3514 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2465 "Python/bytecodes.c" + #line 2476 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3520,7 +3538,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3524 "Python/generated_cases.c.h" + #line 3542 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3530,7 +3548,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2488 "Python/bytecodes.c" + #line 2499 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3551,7 +3569,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3555 "Python/generated_cases.c.h" + #line 3573 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3561,7 +3579,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2511 "Python/bytecodes.c" + #line 2522 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3580,7 +3598,7 @@ if (next == NULL) { goto error; } - #line 3584 "Python/generated_cases.c.h" + #line 3602 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3589,7 +3607,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2532 "Python/bytecodes.c" + #line 2543 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3605,14 +3623,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3609 "Python/generated_cases.c.h" + #line 3627 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2550 "Python/bytecodes.c" + #line 2561 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3635,16 +3653,16 @@ Py_DECREF(enter); goto error; } - #line 3639 "Python/generated_cases.c.h" + #line 3657 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2573 "Python/bytecodes.c" + #line 2584 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3648 "Python/generated_cases.c.h" + #line 3666 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3655,7 +3673,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2582 "Python/bytecodes.c" + #line 2593 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3681,16 +3699,16 @@ Py_DECREF(enter); goto error; } - #line 3685 "Python/generated_cases.c.h" + #line 3703 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2608 "Python/bytecodes.c" + #line 2619 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3694 "Python/generated_cases.c.h" + #line 3712 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3702,7 +3720,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2617 "Python/bytecodes.c" + #line 2628 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3723,7 +3741,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3727 "Python/generated_cases.c.h" + #line 3745 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3732,7 +3750,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2656 "Python/bytecodes.c" + #line 2667 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3742,7 +3760,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3746 "Python/generated_cases.c.h" + #line 3764 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3756,7 +3774,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2668 "Python/bytecodes.c" + #line 2679 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3773,7 +3791,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3777 "Python/generated_cases.c.h" + #line 3795 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3787,7 +3805,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2687 "Python/bytecodes.c" + #line 2698 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3797,7 +3815,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3801 "Python/generated_cases.c.h" + #line 3819 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3811,7 +3829,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2699 "Python/bytecodes.c" + #line 2710 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3825,7 +3843,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3829 "Python/generated_cases.c.h" + #line 3847 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3834,16 +3852,16 @@ } TARGET(KW_NAMES) { - #line 2715 "Python/bytecodes.c" + #line 2726 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - #line 3842 "Python/generated_cases.c.h" + #line 3860 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2721 "Python/bytecodes.c" + #line 2732 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3856,7 +3874,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3860 "Python/generated_cases.c.h" + #line 3878 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3866,7 +3884,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2766 "Python/bytecodes.c" + #line 2777 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3948,7 +3966,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3952 "Python/generated_cases.c.h" + #line 3970 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3960,7 +3978,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2854 "Python/bytecodes.c" + #line 2865 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3970,7 +3988,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3974 "Python/generated_cases.c.h" + #line 3992 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3979,7 +3997,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2866 "Python/bytecodes.c" + #line 2877 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4005,7 +4023,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4009 "Python/generated_cases.c.h" + #line 4027 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4013,7 +4031,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2894 "Python/bytecodes.c" + #line 2905 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4049,7 +4067,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4053 "Python/generated_cases.c.h" + #line 4071 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4057,7 +4075,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2932 "Python/bytecodes.c" + #line 2943 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4067,7 +4085,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4071 "Python/generated_cases.c.h" + #line 4089 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4080,7 +4098,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2944 "Python/bytecodes.c" + #line 2955 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4091,7 +4109,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4095 "Python/generated_cases.c.h" + #line 4113 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4105,7 +4123,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2958 "Python/bytecodes.c" + #line 2969 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4116,7 +4134,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4120 "Python/generated_cases.c.h" + #line 4138 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4130,7 +4148,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2972 "Python/bytecodes.c" + #line 2983 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4152,7 +4170,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4156 "Python/generated_cases.c.h" + #line 4174 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4166,7 +4184,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2997 "Python/bytecodes.c" + #line 3008 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4194,7 +4212,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4198 "Python/generated_cases.c.h" + #line 4216 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4208,7 +4226,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3028 "Python/bytecodes.c" + #line 3039 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4240,7 +4258,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4244 "Python/generated_cases.c.h" + #line 4262 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4254,7 +4272,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3063 "Python/bytecodes.c" + #line 3074 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4286,7 +4304,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4290 "Python/generated_cases.c.h" + #line 4308 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4300,7 +4318,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3098 "Python/bytecodes.c" + #line 3109 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4325,7 +4343,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4329 "Python/generated_cases.c.h" + #line 4347 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4338,7 +4356,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3125 "Python/bytecodes.c" + #line 3136 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4365,7 +4383,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4369 "Python/generated_cases.c.h" + #line 4387 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4377,7 +4395,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3155 "Python/bytecodes.c" + #line 3166 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4395,14 +4413,14 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4399 "Python/generated_cases.c.h" + #line 4417 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3175 "Python/bytecodes.c" + #line 3186 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4433,7 +4451,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4437 "Python/generated_cases.c.h" + #line 4455 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4446,7 +4464,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3209 "Python/bytecodes.c" + #line 3220 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4475,7 +4493,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4479 "Python/generated_cases.c.h" + #line 4497 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4488,7 +4506,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3241 "Python/bytecodes.c" + #line 3252 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4517,7 +4535,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4521 "Python/generated_cases.c.h" + #line 4539 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4530,7 +4548,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3273 "Python/bytecodes.c" + #line 3284 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4558,7 +4576,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4562 "Python/generated_cases.c.h" + #line 4580 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4568,9 +4586,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3304 "Python/bytecodes.c" + #line 3315 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4574 "Python/generated_cases.c.h" + #line 4592 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4579,7 +4597,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3308 "Python/bytecodes.c" + #line 3319 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4641,14 +4659,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4645 "Python/generated_cases.c.h" + #line 4663 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3370 "Python/bytecodes.c" + #line 3381 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4652 "Python/generated_cases.c.h" + #line 4670 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4659,7 +4677,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3376 "Python/bytecodes.c" + #line 3387 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4671,7 +4689,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4675 "Python/generated_cases.c.h" + #line 4693 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4679,7 +4697,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3390 "Python/bytecodes.c" + #line 3401 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4704,14 +4722,14 @@ default: Py_UNREACHABLE(); } - #line 4708 "Python/generated_cases.c.h" + #line 4726 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3417 "Python/bytecodes.c" + #line 3428 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4732,7 +4750,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4736 "Python/generated_cases.c.h" + #line 4754 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4740,15 +4758,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3440 "Python/bytecodes.c" + #line 3451 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4746 "Python/generated_cases.c.h" + #line 4764 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3442 "Python/bytecodes.c" + #line 3453 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4752 "Python/generated_cases.c.h" + #line 4770 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4758,14 +4776,14 @@ TARGET(CONVERT_VALUE) { PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3446 "Python/bytecodes.c" + #line 3457 "Python/bytecodes.c" convertion_func_ptr conv_fn; assert(oparg >= FVC_STR && oparg <= FVC_ASCII); conv_fn = CONVERSION_FUNCTIONS[oparg]; result = conv_fn(value); Py_DECREF(value); if (result == NULL) goto pop_1_error; - #line 4769 "Python/generated_cases.c.h" + #line 4787 "Python/generated_cases.c.h" stack_pointer[-1] = result; DISPATCH(); } @@ -4773,7 +4791,7 @@ TARGET(FORMAT_SIMPLE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 3455 "Python/bytecodes.c" + #line 3466 "Python/bytecodes.c" /* If value is a unicode object, then we know the result * of format(value) is value itself. */ if (!PyUnicode_CheckExact(value)) { @@ -4784,7 +4802,7 @@ else { res = value; } - #line 4788 "Python/generated_cases.c.h" + #line 4806 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -4793,12 +4811,12 @@ PyObject *fmt_spec = stack_pointer[-1]; PyObject *value = stack_pointer[-2]; PyObject *res; - #line 3468 "Python/bytecodes.c" + #line 3479 "Python/bytecodes.c" res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); if (res == NULL) goto pop_2_error; - #line 4802 "Python/generated_cases.c.h" + #line 4820 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -4807,10 +4825,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3475 "Python/bytecodes.c" + #line 3486 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4814 "Python/generated_cases.c.h" + #line 4832 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4822,7 +4840,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3480 "Python/bytecodes.c" + #line 3491 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4837,12 +4855,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4841 "Python/generated_cases.c.h" + #line 4859 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3495 "Python/bytecodes.c" + #line 3506 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4846 "Python/generated_cases.c.h" + #line 4864 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4852,16 +4870,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3500 "Python/bytecodes.c" + #line 3511 "Python/bytecodes.c" assert(oparg >= 2); - #line 4858 "Python/generated_cases.c.h" + #line 4876 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3504 "Python/bytecodes.c" + #line 3515 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4873,26 +4891,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4877 "Python/generated_cases.c.h" + #line 4895 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3518 "Python/bytecodes.c" + #line 3529 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4883 "Python/generated_cases.c.h" + #line 4901 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3522 "Python/bytecodes.c" + #line 3533 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4890 "Python/generated_cases.c.h" + #line 4908 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3527 "Python/bytecodes.c" + #line 3538 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4901,12 +4919,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4905 "Python/generated_cases.c.h" + #line 4923 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3538 "Python/bytecodes.c" + #line 3549 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4915,12 +4933,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4919 "Python/generated_cases.c.h" + #line 4937 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3549 "Python/bytecodes.c" + #line 3560 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4932,12 +4950,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4936 "Python/generated_cases.c.h" + #line 4954 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3563 "Python/bytecodes.c" + #line 3574 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4949,30 +4967,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4953 "Python/generated_cases.c.h" + #line 4971 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3577 "Python/bytecodes.c" + #line 3588 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4964 "Python/generated_cases.c.h" + #line 4982 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3585 "Python/bytecodes.c" + #line 3596 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4971 "Python/generated_cases.c.h" + #line 4989 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3590 "Python/bytecodes.c" + #line 3601 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4978 "Python/generated_cases.c.h" + #line 4996 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 376ff45ba29518..73efd17eccc0ec 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -78,6 +78,8 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case TO_BOOL_STR: return 1; + case TO_BOOL_ALWAYS_TRUE: + return 1; case UNARY_INVERT: return 1; case BINARY_OP_MULTIPLY_INT: @@ -512,6 +514,8 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 1; case TO_BOOL_STR: return 1; + case TO_BOOL_ALWAYS_TRUE: + return 1; case UNARY_INVERT: return 1; case BINARY_OP_MULTIPLY_INT: @@ -886,7 +890,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { } #endif -enum InstructionFormat { INSTR_FMT_IB, INSTR_FMT_IBC, INSTR_FMT_IBC00, INSTR_FMT_IBC000, INSTR_FMT_IBC00000000, INSTR_FMT_IX, INSTR_FMT_IXC, INSTR_FMT_IXC000 }; +enum InstructionFormat { INSTR_FMT_IB, INSTR_FMT_IBC, INSTR_FMT_IBC00, INSTR_FMT_IBC000, INSTR_FMT_IBC00000000, INSTR_FMT_IX, INSTR_FMT_IXC, INSTR_FMT_IXC00, INSTR_FMT_IXC000 }; #define HAS_ARG_FLAG (1) #define HAS_CONST_FLAG (2) #define HAS_NAME_FLAG (4) @@ -930,12 +934,13 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[512] = { [INSTRUMENTED_END_SEND] = { true, INSTR_FMT_IX, 0 }, [UNARY_NEGATIVE] = { true, INSTR_FMT_IX, 0 }, [UNARY_NOT] = { true, INSTR_FMT_IX, 0 }, - [TO_BOOL] = { true, INSTR_FMT_IXC, 0 }, - [TO_BOOL_BOOL] = { true, INSTR_FMT_IXC, 0 }, - [TO_BOOL_INT] = { true, INSTR_FMT_IXC, 0 }, - [TO_BOOL_LIST] = { true, INSTR_FMT_IXC, 0 }, - [TO_BOOL_NONE] = { true, INSTR_FMT_IXC, 0 }, - [TO_BOOL_STR] = { true, INSTR_FMT_IXC, 0 }, + [TO_BOOL] = { true, INSTR_FMT_IXC00, 0 }, + [TO_BOOL_BOOL] = { true, INSTR_FMT_IXC00, 0 }, + [TO_BOOL_INT] = { true, INSTR_FMT_IXC00, 0 }, + [TO_BOOL_LIST] = { true, INSTR_FMT_IXC00, 0 }, + [TO_BOOL_NONE] = { true, INSTR_FMT_IXC00, 0 }, + [TO_BOOL_STR] = { true, INSTR_FMT_IXC00, 0 }, + [TO_BOOL_ALWAYS_TRUE] = { true, INSTR_FMT_IXC00, 0 }, [UNARY_INVERT] = { true, INSTR_FMT_IX, 0 }, [BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IBC, 0 }, [BINARY_OP_ADD_INT] = { true, INSTR_FMT_IBC, 0 }, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 9454c8609acb7b..9f17b6c4bf94f9 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -6,48 +6,48 @@ static void *opcode_targets[256] = { &&TARGET_END_FOR, &&TARGET_END_SEND, &&TARGET_TO_BOOL, + &&TARGET_TO_BOOL_ALWAYS_TRUE, &&TARGET_TO_BOOL_BOOL, - &&TARGET_TO_BOOL_INT, &&TARGET_NOP, - &&TARGET_TO_BOOL_LIST, + &&TARGET_TO_BOOL_INT, &&TARGET_UNARY_NEGATIVE, &&TARGET_UNARY_NOT, + &&TARGET_TO_BOOL_LIST, &&TARGET_TO_BOOL_NONE, - &&TARGET_TO_BOOL_STR, &&TARGET_UNARY_INVERT, - &&TARGET_BINARY_OP_MULTIPLY_INT, + &&TARGET_TO_BOOL_STR, &&TARGET_RESERVED, + &&TARGET_BINARY_OP_MULTIPLY_INT, &&TARGET_BINARY_OP_ADD_INT, &&TARGET_BINARY_OP_SUBTRACT_INT, &&TARGET_BINARY_OP_MULTIPLY_FLOAT, &&TARGET_BINARY_OP_ADD_FLOAT, &&TARGET_BINARY_OP_SUBTRACT_FLOAT, - &&TARGET_BINARY_OP_ADD_UNICODE, &&TARGET_MAKE_FUNCTION, &&TARGET_BINARY_SUBSCR, &&TARGET_BINARY_SLICE, &&TARGET_STORE_SLICE, + &&TARGET_BINARY_OP_ADD_UNICODE, &&TARGET_BINARY_OP_INPLACE_ADD_UNICODE, - &&TARGET_BINARY_SUBSCR_DICT, &&TARGET_GET_LEN, &&TARGET_MATCH_MAPPING, &&TARGET_MATCH_SEQUENCE, &&TARGET_MATCH_KEYS, - &&TARGET_BINARY_SUBSCR_GETITEM, + &&TARGET_BINARY_SUBSCR_DICT, &&TARGET_PUSH_EXC_INFO, &&TARGET_CHECK_EXC_MATCH, &&TARGET_CHECK_EG_MATCH, + &&TARGET_BINARY_SUBSCR_GETITEM, &&TARGET_BINARY_SUBSCR_LIST_INT, - &&TARGET_BINARY_SUBSCR_TUPLE_INT, &&TARGET_FORMAT_SIMPLE, &&TARGET_FORMAT_WITH_SPEC, + &&TARGET_BINARY_SUBSCR_TUPLE_INT, &&TARGET_STORE_SUBSCR_DICT, &&TARGET_STORE_SUBSCR_LIST_INT, &&TARGET_SEND_GEN, &&TARGET_UNPACK_SEQUENCE_TWO_TUPLE, &&TARGET_UNPACK_SEQUENCE_TUPLE, &&TARGET_UNPACK_SEQUENCE_LIST, - &&TARGET_STORE_ATTR_INSTANCE_VALUE, &&TARGET_WITH_EXCEPT_START, &&TARGET_GET_AITER, &&TARGET_GET_ANEXT, @@ -55,39 +55,39 @@ static void *opcode_targets[256] = { &&TARGET_BEFORE_WITH, &&TARGET_END_ASYNC_FOR, &&TARGET_CLEANUP_THROW, + &&TARGET_STORE_ATTR_INSTANCE_VALUE, &&TARGET_STORE_ATTR_SLOT, &&TARGET_STORE_ATTR_WITH_HINT, &&TARGET_LOAD_GLOBAL_MODULE, - &&TARGET_LOAD_GLOBAL_BUILTIN, &&TARGET_STORE_SUBSCR, &&TARGET_DELETE_SUBSCR, + &&TARGET_LOAD_GLOBAL_BUILTIN, &&TARGET_LOAD_SUPER_ATTR_ATTR, &&TARGET_LOAD_SUPER_ATTR_METHOD, &&TARGET_LOAD_ATTR_INSTANCE_VALUE, &&TARGET_LOAD_ATTR_MODULE, &&TARGET_LOAD_ATTR_WITH_HINT, - &&TARGET_LOAD_ATTR_SLOT, &&TARGET_GET_ITER, &&TARGET_GET_YIELD_FROM_ITER, - &&TARGET_LOAD_ATTR_CLASS, + &&TARGET_LOAD_ATTR_SLOT, &&TARGET_LOAD_BUILD_CLASS, + &&TARGET_LOAD_ATTR_CLASS, &&TARGET_LOAD_ATTR_PROPERTY, - &&TARGET_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN, &&TARGET_LOAD_ASSERTION_ERROR, &&TARGET_RETURN_GENERATOR, + &&TARGET_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN, &&TARGET_LOAD_ATTR_METHOD_WITH_VALUES, &&TARGET_LOAD_ATTR_METHOD_NO_DICT, &&TARGET_LOAD_ATTR_METHOD_LAZY_DICT, &&TARGET_COMPARE_OP_FLOAT, &&TARGET_COMPARE_OP_INT, &&TARGET_COMPARE_OP_STR, - &&TARGET_FOR_ITER_LIST, &&TARGET_RETURN_VALUE, - &&TARGET_FOR_ITER_TUPLE, + &&TARGET_FOR_ITER_LIST, &&TARGET_SETUP_ANNOTATIONS, - &&TARGET_FOR_ITER_RANGE, + &&TARGET_FOR_ITER_TUPLE, &&TARGET_LOAD_LOCALS, - &&TARGET_FOR_ITER_GEN, + &&TARGET_FOR_ITER_RANGE, &&TARGET_POP_EXCEPT, &&TARGET_STORE_NAME, &&TARGET_DELETE_NAME, @@ -110,9 +110,9 @@ static void *opcode_targets[256] = { &&TARGET_IMPORT_NAME, &&TARGET_IMPORT_FROM, &&TARGET_JUMP_FORWARD, + &&TARGET_FOR_ITER_GEN, &&TARGET_CALL_BOUND_METHOD_EXACT_ARGS, &&TARGET_CALL_PY_EXACT_ARGS, - &&TARGET_CALL_PY_WITH_DEFAULTS, &&TARGET_POP_JUMP_IF_FALSE, &&TARGET_POP_JUMP_IF_TRUE, &&TARGET_LOAD_GLOBAL, @@ -131,7 +131,7 @@ static void *opcode_targets[256] = { &&TARGET_POP_JUMP_IF_NONE, &&TARGET_RAISE_VARARGS, &&TARGET_GET_AWAITABLE, - &&TARGET_CALL_NO_KW_TYPE_1, + &&TARGET_CALL_PY_WITH_DEFAULTS, &&TARGET_BUILD_SLICE, &&TARGET_JUMP_BACKWARD_NO_INTERRUPT, &&TARGET_MAKE_CELL, @@ -147,26 +147,26 @@ static void *opcode_targets[256] = { &&TARGET_LIST_APPEND, &&TARGET_SET_ADD, &&TARGET_MAP_ADD, - &&TARGET_CALL_NO_KW_STR_1, + &&TARGET_CALL_NO_KW_TYPE_1, &&TARGET_COPY_FREE_VARS, &&TARGET_YIELD_VALUE, &&TARGET_RESUME, &&TARGET_MATCH_CLASS, + &&TARGET_CALL_NO_KW_STR_1, &&TARGET_CALL_NO_KW_TUPLE_1, &&TARGET_CALL_BUILTIN_CLASS, - &&TARGET_CALL_NO_KW_BUILTIN_O, &&TARGET_BUILD_CONST_KEY_MAP, &&TARGET_BUILD_STRING, &&TARGET_CONVERT_VALUE, + &&TARGET_CALL_NO_KW_BUILTIN_O, &&TARGET_CALL_NO_KW_BUILTIN_FAST, &&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS, - &&TARGET_CALL_NO_KW_LEN, &&TARGET_LIST_EXTEND, &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, + &&TARGET_CALL_NO_KW_LEN, &&TARGET_CALL_NO_KW_ISINSTANCE, - &&TARGET_CALL_NO_KW_LIST_APPEND, &&TARGET_LOAD_FAST_LOAD_FAST, &&TARGET_STORE_FAST_LOAD_FAST, &&TARGET_STORE_FAST_STORE_FAST, @@ -177,6 +177,7 @@ static void *opcode_targets[256] = { &&TARGET_LOAD_FROM_DICT_OR_GLOBALS, &&TARGET_LOAD_FROM_DICT_OR_DEREF, &&TARGET_SET_FUNCTION_ATTRIBUTE, + &&TARGET_CALL_NO_KW_LIST_APPEND, &&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_O, &&TARGET_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, &&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS, @@ -228,7 +229,6 @@ static void *opcode_targets[256] = { &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, - &&_unknown_opcode, &&TARGET_ENTER_EXECUTOR, &&_unknown_opcode, &&_unknown_opcode, diff --git a/Python/specialize.c b/Python/specialize.c index 7cdf99c08a2a9c..5f6e451b62f830 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -443,17 +443,16 @@ _PyCode_Quicken(PyCodeObject *code) #define SPEC_FAIL_UNPACK_SEQUENCE_SEQUENCE 10 // TO_BOOL -#define SPEC_FAIL_TO_BOOL_BYTEARRAY 9 -#define SPEC_FAIL_TO_BOOL_BYTES 10 -#define SPEC_FAIL_TO_BOOL_DICT 11 -#define SPEC_FAIL_TO_BOOL_FLOAT 12 -#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_MAPPING 13 -#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_NUMBER 14 -#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_SEQUENCE 15 -#define SPEC_FAIL_TO_BOOL_HEAP_TYPE_TRUE 16 -#define SPEC_FAIL_TO_BOOL_MEMORY_VIEW 17 -#define SPEC_FAIL_TO_BOOL_SET 18 -#define SPEC_FAIL_TO_BOOL_TUPLE 19 +#define SPEC_FAIL_TO_BOOL_BYTEARRAY 9 +#define SPEC_FAIL_TO_BOOL_BYTES 10 +#define SPEC_FAIL_TO_BOOL_DICT 11 +#define SPEC_FAIL_TO_BOOL_FLOAT 12 +#define SPEC_FAIL_TO_BOOL_MAPPING 13 +#define SPEC_FAIL_TO_BOOL_NUMBER 14 +#define SPEC_FAIL_TO_BOOL_SEQUENCE 15 +#define SPEC_FAIL_TO_BOOL_MEMORY_VIEW 16 +#define SPEC_FAIL_TO_BOOL_SET 17 +#define SPEC_FAIL_TO_BOOL_TUPLE 18 static int function_kind(PyCodeObject *code); static bool function_check_args(PyObject *o, int expected_argcount, int opcode); @@ -2271,6 +2270,32 @@ _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr) instr->op.code = TO_BOOL_STR; goto success; } + if (PyType_HasFeature(Py_TYPE(value), Py_TPFLAGS_HEAPTYPE)) { + PyNumberMethods *nb = Py_TYPE(value)->tp_as_number; + if (nb && nb->nb_bool) { + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_NUMBER); + goto failure; + } + PyMappingMethods *mp = Py_TYPE(value)->tp_as_mapping; + if (mp && mp->mp_length) { + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_MAPPING); + goto failure; + } + PySequenceMethods *sq = Py_TYPE(value)->tp_as_sequence; + if (sq && sq->sq_length) { + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_SEQUENCE); + goto failure; + } + if (PyUnstable_Type_AssignVersionTag(Py_TYPE(value))) { + SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_OUT_OF_VERSIONS); + goto failure; + } + uint32_t version = Py_TYPE(value)->tp_version_tag; + instr->op.code = TO_BOOL_ALWAYS_TRUE; + write_u32(cache->version, version); + assert(version); + goto success; + } #ifdef Py_STATS if (PyByteArray_CheckExact(value)) { SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_BYTEARRAY); @@ -2288,25 +2313,6 @@ _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr) SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_FLOAT); goto failure; } - if (PyType_HasFeature(Py_TYPE(value), Py_TPFLAGS_HEAPTYPE)) { - PyNumberMethods *nb = Py_TYPE(value)->tp_as_number; - if (nb && nb->nb_bool) { - SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_NUMBER); - goto failure; - } - PyMappingMethods *mp = Py_TYPE(value)->tp_as_mapping; - if (mp && mp->mp_length) { - SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_MAPPING); - goto failure; - } - PySequenceMethods *sq = Py_TYPE(value)->tp_as_sequence; - if (sq && sq->sq_length) { - SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_SEQUENCE); - goto failure; - } - SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_HEAP_TYPE_TRUE); - goto failure; - } if (PyMemoryView_Check(value)) { SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_MEMORY_VIEW); goto failure; @@ -2320,8 +2326,8 @@ _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr) goto failure; } SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_OTHER); -failure: #endif +failure: STAT_INC(TO_BOOL, failure); instr->op.code = TO_BOOL; cache->counter = adaptive_counter_backoff(cache->counter); From f9fa498686bbcb7e1b98a1e2769c5b1d37f26e9a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 21 Jun 2023 01:53:11 -0700 Subject: [PATCH 10/15] Fix refleak and error handling --- Python/bytecodes.c | 1 + Python/generated_cases.c.h | 933 +++++++++++++++++++------------------ Python/specialize.c | 2 +- 3 files changed, 470 insertions(+), 466 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 9c2316f52c2e9b..ef02ff163fef13 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -384,6 +384,7 @@ dummy_func( assert(version); DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); STAT_INC(TO_BOOL, hit); + DECREF_INPUTS(); res = Py_True; } diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index fd2a5a552aae35..6bcf9765fba98a 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -418,8 +418,11 @@ assert(version); DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); STAT_INC(TO_BOOL, hit); + #line 422 "Python/generated_cases.c.h" + Py_DECREF(value); + #line 388 "Python/bytecodes.c" res = Py_True; - #line 423 "Python/generated_cases.c.h" + #line 426 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -428,13 +431,13 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 391 "Python/bytecodes.c" + #line 392 "Python/bytecodes.c" res = PyNumber_Invert(value); - #line 434 "Python/generated_cases.c.h" + #line 437 "Python/generated_cases.c.h" Py_DECREF(value); - #line 393 "Python/bytecodes.c" + #line 394 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 438 "Python/generated_cases.c.h" + #line 441 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -445,10 +448,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 409 "Python/bytecodes.c" + #line 410 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 452 "Python/generated_cases.c.h" + #line 455 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -456,13 +459,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 414 "Python/bytecodes.c" + #line 415 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 466 "Python/generated_cases.c.h" + #line 469 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -477,10 +480,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 409 "Python/bytecodes.c" + #line 410 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 484 "Python/generated_cases.c.h" + #line 487 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -488,13 +491,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 422 "Python/bytecodes.c" + #line 423 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 498 "Python/generated_cases.c.h" + #line 501 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -509,10 +512,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 409 "Python/bytecodes.c" + #line 410 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 516 "Python/generated_cases.c.h" + #line 519 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -520,13 +523,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 430 "Python/bytecodes.c" + #line 431 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 530 "Python/generated_cases.c.h" + #line 533 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -541,10 +544,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 445 "Python/bytecodes.c" + #line 446 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 548 "Python/generated_cases.c.h" + #line 551 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -552,13 +555,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 450 "Python/bytecodes.c" + #line 451 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 562 "Python/generated_cases.c.h" + #line 565 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -573,10 +576,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 445 "Python/bytecodes.c" + #line 446 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 580 "Python/generated_cases.c.h" + #line 583 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -584,13 +587,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 458 "Python/bytecodes.c" + #line 459 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 594 "Python/generated_cases.c.h" + #line 597 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -605,10 +608,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 445 "Python/bytecodes.c" + #line 446 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 612 "Python/generated_cases.c.h" + #line 615 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -616,13 +619,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 466 "Python/bytecodes.c" + #line 467 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 626 "Python/generated_cases.c.h" + #line 629 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -637,10 +640,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 481 "Python/bytecodes.c" + #line 482 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 644 "Python/generated_cases.c.h" + #line 647 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -648,13 +651,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 486 "Python/bytecodes.c" + #line 487 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; - #line 658 "Python/generated_cases.c.h" + #line 661 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -669,17 +672,17 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 481 "Python/bytecodes.c" + #line 482 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 676 "Python/generated_cases.c.h" + #line 679 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 503 "Python/bytecodes.c" + #line 504 "Python/bytecodes.c" _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; assert(true_next.op.code == STORE_FAST); PyObject **target_local = &GETLOCAL(true_next.op.arg); @@ -703,7 +706,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_OP + 1); - #line 707 "Python/generated_cases.c.h" + #line 710 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -715,7 +718,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 540 "Python/bytecodes.c" + #line 541 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -727,12 +730,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); - #line 731 "Python/generated_cases.c.h" + #line 734 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 552 "Python/bytecodes.c" + #line 553 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 736 "Python/generated_cases.c.h" + #line 739 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -744,7 +747,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 556 "Python/bytecodes.c" + #line 557 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -757,7 +760,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; - #line 761 "Python/generated_cases.c.h" + #line 764 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -768,7 +771,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 571 "Python/bytecodes.c" + #line 572 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -781,7 +784,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; - #line 785 "Python/generated_cases.c.h" + #line 788 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -790,7 +793,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 586 "Python/bytecodes.c" + #line 587 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -804,7 +807,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 808 "Python/generated_cases.c.h" + #line 811 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -815,7 +818,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 602 "Python/bytecodes.c" + #line 603 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -829,7 +832,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); - #line 833 "Python/generated_cases.c.h" + #line 836 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -840,7 +843,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 618 "Python/bytecodes.c" + #line 619 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -848,14 +851,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } - #line 852 "Python/generated_cases.c.h" + #line 855 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 626 "Python/bytecodes.c" + #line 627 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub - #line 859 "Python/generated_cases.c.h" + #line 862 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -867,7 +870,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 633 "Python/bytecodes.c" + #line 634 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -890,15 +893,15 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 894 "Python/generated_cases.c.h" + #line 897 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 658 "Python/bytecodes.c" + #line 659 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; - #line 902 "Python/generated_cases.c.h" + #line 905 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -906,13 +909,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 662 "Python/bytecodes.c" + #line 663 "Python/bytecodes.c" int err = PySet_Add(set, v); - #line 912 "Python/generated_cases.c.h" + #line 915 "Python/generated_cases.c.h" Py_DECREF(v); - #line 664 "Python/bytecodes.c" + #line 665 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 916 "Python/generated_cases.c.h" + #line 919 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -924,7 +927,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 674 "Python/bytecodes.c" + #line 675 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -939,13 +942,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); - #line 943 "Python/generated_cases.c.h" + #line 946 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 689 "Python/bytecodes.c" + #line 690 "Python/bytecodes.c" if (err) goto pop_3_error; - #line 949 "Python/generated_cases.c.h" + #line 952 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -955,7 +958,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 693 "Python/bytecodes.c" + #line 694 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -972,7 +975,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 976 "Python/generated_cases.c.h" + #line 979 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -982,13 +985,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 712 "Python/bytecodes.c" + #line 713 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; - #line 992 "Python/generated_cases.c.h" + #line 995 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -997,15 +1000,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 720 "Python/bytecodes.c" + #line 721 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); - #line 1004 "Python/generated_cases.c.h" + #line 1007 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 723 "Python/bytecodes.c" + #line 724 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1009 "Python/generated_cases.c.h" + #line 1012 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1013,14 +1016,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 727 "Python/bytecodes.c" + #line 728 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); - #line 1020 "Python/generated_cases.c.h" + #line 1023 "Python/generated_cases.c.h" Py_DECREF(value); - #line 730 "Python/bytecodes.c" + #line 731 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 1024 "Python/generated_cases.c.h" + #line 1027 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -1029,15 +1032,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 734 "Python/bytecodes.c" + #line 735 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); - #line 1036 "Python/generated_cases.c.h" + #line 1039 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 737 "Python/bytecodes.c" + #line 738 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 1041 "Python/generated_cases.c.h" + #line 1044 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -1045,7 +1048,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 741 "Python/bytecodes.c" + #line 742 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -1063,12 +1066,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } - #line 1067 "Python/generated_cases.c.h" + #line 1070 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 761 "Python/bytecodes.c" + #line 762 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); /* Restore previous cframe and return. */ @@ -1077,12 +1080,12 @@ assert(!_PyErr_Occurred(tstate)); _Py_LeaveRecursiveCallTstate(tstate); return retval; - #line 1081 "Python/generated_cases.c.h" + #line 1084 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 772 "Python/bytecodes.c" + #line 773 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1095,12 +1098,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1099 "Python/generated_cases.c.h" + #line 1102 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 787 "Python/bytecodes.c" + #line 788 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1117,11 +1120,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1121 "Python/generated_cases.c.h" + #line 1124 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 806 "Python/bytecodes.c" + #line 807 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1135,11 +1138,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1139 "Python/generated_cases.c.h" + #line 1142 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 822 "Python/bytecodes.c" + #line 823 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1157,13 +1160,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1161 "Python/generated_cases.c.h" + #line 1164 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 842 "Python/bytecodes.c" + #line 843 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1176,16 +1179,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1180 "Python/generated_cases.c.h" + #line 1183 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 855 "Python/bytecodes.c" + #line 856 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1187 "Python/generated_cases.c.h" + #line 1190 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 860 "Python/bytecodes.c" + #line 861 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1198,7 +1201,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1202 "Python/generated_cases.c.h" + #line 1205 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1206,7 +1209,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 875 "Python/bytecodes.c" + #line 876 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1249,7 +1252,7 @@ Py_DECREF(next_iter); } } - #line 1253 "Python/generated_cases.c.h" + #line 1256 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; DISPATCH(); @@ -1258,16 +1261,16 @@ TARGET(GET_AWAITABLE) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 920 "Python/bytecodes.c" + #line 921 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1269 "Python/generated_cases.c.h" + #line 1272 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 927 "Python/bytecodes.c" + #line 928 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1284,7 +1287,7 @@ } if (iter == NULL) goto pop_1_error; - #line 1288 "Python/generated_cases.c.h" + #line 1291 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1295,7 +1298,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 951 "Python/bytecodes.c" + #line 952 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1342,7 +1345,7 @@ } } Py_DECREF(v); - #line 1346 "Python/generated_cases.c.h" + #line 1349 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1351,7 +1354,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 1000 "Python/bytecodes.c" + #line 1001 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1367,12 +1370,12 @@ tstate->exc_info = &gen->gi_exc_state; SKIP_OVER(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1371 "Python/generated_cases.c.h" + #line 1374 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1018 "Python/bytecodes.c" + #line 1019 "Python/bytecodes.c" assert(frame != &entry_frame); assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ PyGenObject *gen = _PyFrame_GetGenerator(frame); @@ -1390,12 +1393,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1394 "Python/generated_cases.c.h" + #line 1397 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1038 "Python/bytecodes.c" + #line 1039 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1412,15 +1415,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1416 "Python/generated_cases.c.h" + #line 1419 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 1057 "Python/bytecodes.c" + #line 1058 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1424 "Python/generated_cases.c.h" + #line 1427 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1428,7 +1431,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 1062 "Python/bytecodes.c" + #line 1063 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1446,26 +1449,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1450 "Python/generated_cases.c.h" + #line 1453 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 1082 "Python/bytecodes.c" + #line 1083 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1459 "Python/generated_cases.c.h" + #line 1462 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 1085 "Python/bytecodes.c" + #line 1086 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1469 "Python/generated_cases.c.h" + #line 1472 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1476,23 +1479,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1094 "Python/bytecodes.c" + #line 1095 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1485 "Python/generated_cases.c.h" + #line 1488 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1099 "Python/bytecodes.c" + #line 1100 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1496 "Python/generated_cases.c.h" + #line 1499 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1501,9 +1504,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1108 "Python/bytecodes.c" + #line 1109 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1507 "Python/generated_cases.c.h" + #line 1510 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1511,7 +1514,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1112 "Python/bytecodes.c" + #line 1113 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1533,7 +1536,7 @@ if (true) goto error; } } - #line 1537 "Python/generated_cases.c.h" + #line 1540 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1541,33 +1544,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1137 "Python/bytecodes.c" + #line 1138 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1552 "Python/generated_cases.c.h" + #line 1555 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1144 "Python/bytecodes.c" + #line 1145 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1561 "Python/generated_cases.c.h" + #line 1564 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1151 "Python/bytecodes.c" + #line 1152 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1565 "Python/generated_cases.c.h" + #line 1568 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1155 "Python/bytecodes.c" + #line 1156 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; @@ -1584,7 +1587,7 @@ name); goto error; } - #line 1588 "Python/generated_cases.c.h" + #line 1591 "Python/generated_cases.c.h" DISPATCH(); } @@ -1592,7 +1595,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1181 "Python/bytecodes.c" + #line 1182 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1605,11 +1608,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1609 "Python/generated_cases.c.h" + #line 1612 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1194 "Python/bytecodes.c" + #line 1195 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1613 "Python/generated_cases.c.h" + #line 1616 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1619,14 +1622,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1198 "Python/bytecodes.c" + #line 1199 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1630 "Python/generated_cases.c.h" + #line 1633 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1637,7 +1640,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1208 "Python/bytecodes.c" + #line 1209 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1645,7 +1648,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1649 "Python/generated_cases.c.h" + #line 1652 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1656,7 +1659,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1219 "Python/bytecodes.c" + #line 1220 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1664,7 +1667,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1668 "Python/generated_cases.c.h" + #line 1671 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1674,15 +1677,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1230 "Python/bytecodes.c" + #line 1231 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); - #line 1682 "Python/generated_cases.c.h" + #line 1685 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1234 "Python/bytecodes.c" + #line 1235 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1686 "Python/generated_cases.c.h" + #line 1689 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1693,7 +1696,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1245 "Python/bytecodes.c" + #line 1246 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); @@ -1709,12 +1712,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1713 "Python/generated_cases.c.h" + #line 1716 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1261 "Python/bytecodes.c" + #line 1262 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1718 "Python/generated_cases.c.h" + #line 1721 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1722,34 +1725,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1265 "Python/bytecodes.c" + #line 1266 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1729 "Python/generated_cases.c.h" + #line 1732 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1268 "Python/bytecodes.c" + #line 1269 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1733 "Python/generated_cases.c.h" + #line 1736 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1272 "Python/bytecodes.c" + #line 1273 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1743 "Python/generated_cases.c.h" + #line 1746 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1275 "Python/bytecodes.c" + #line 1276 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1747 "Python/generated_cases.c.h" + #line 1750 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1279 "Python/bytecodes.c" + #line 1280 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1761,7 +1764,7 @@ } goto error; } - #line 1765 "Python/generated_cases.c.h" + #line 1768 "Python/generated_cases.c.h" DISPATCH(); } @@ -1769,7 +1772,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1293 "Python/bytecodes.c" + #line 1294 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1777,7 +1780,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1781 "Python/generated_cases.c.h" + #line 1784 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1789,7 +1792,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1293 "Python/bytecodes.c" + #line 1294 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1797,13 +1800,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1801 "Python/generated_cases.c.h" + #line 1804 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1305 "Python/bytecodes.c" + #line 1306 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1860,7 +1863,7 @@ } } } - #line 1864 "Python/generated_cases.c.h" + #line 1867 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1873,7 +1876,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1305 "Python/bytecodes.c" + #line 1306 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1930,7 +1933,7 @@ } } } - #line 1934 "Python/generated_cases.c.h" + #line 1937 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1942,7 +1945,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1374 "Python/bytecodes.c" + #line 1375 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1994,7 +1997,7 @@ } } null = NULL; - #line 1998 "Python/generated_cases.c.h" + #line 2001 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -2008,7 +2011,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1428 "Python/bytecodes.c" + #line 1429 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -2019,7 +2022,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2023 "Python/generated_cases.c.h" + #line 2026 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2034,7 +2037,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1441 "Python/bytecodes.c" + #line 1442 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -2049,7 +2052,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2053 "Python/generated_cases.c.h" + #line 2056 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2059,16 +2062,16 @@ } TARGET(DELETE_FAST) { - #line 1458 "Python/bytecodes.c" + #line 1459 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 2067 "Python/generated_cases.c.h" + #line 2070 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1464 "Python/bytecodes.c" + #line 1465 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -2077,12 +2080,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2081 "Python/generated_cases.c.h" + #line 2084 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1475 "Python/bytecodes.c" + #line 1476 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2093,14 +2096,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2097 "Python/generated_cases.c.h" + #line 2100 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1488 "Python/bytecodes.c" + #line 1489 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus); @@ -2135,14 +2138,14 @@ } Py_INCREF(value); } - #line 2139 "Python/generated_cases.c.h" + #line 2142 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1525 "Python/bytecodes.c" + #line 1526 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2150,7 +2153,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2154 "Python/generated_cases.c.h" + #line 2157 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2158,18 +2161,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1535 "Python/bytecodes.c" + #line 1536 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2167 "Python/generated_cases.c.h" + #line 2170 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1542 "Python/bytecodes.c" + #line 1543 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = _PyFrame_GetCode(frame); assert(PyFunction_Check(frame->f_funcobj)); @@ -2180,22 +2183,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2184 "Python/generated_cases.c.h" + #line 2187 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1555 "Python/bytecodes.c" + #line 1556 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2193 "Python/generated_cases.c.h" + #line 2196 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1557 "Python/bytecodes.c" + #line 1558 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2199 "Python/generated_cases.c.h" + #line 2202 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2205,10 +2208,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1561 "Python/bytecodes.c" + #line 1562 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2212 "Python/generated_cases.c.h" + #line 2215 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2218,10 +2221,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1566 "Python/bytecodes.c" + #line 1567 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2225 "Python/generated_cases.c.h" + #line 2228 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2231,7 +2234,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1571 "Python/bytecodes.c" + #line 1572 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2242,13 +2245,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2246 "Python/generated_cases.c.h" + #line 2249 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1582 "Python/bytecodes.c" + #line 1583 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2252 "Python/generated_cases.c.h" + #line 2255 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2257,13 +2260,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1589 "Python/bytecodes.c" + #line 1590 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2263 "Python/generated_cases.c.h" + #line 2266 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1591 "Python/bytecodes.c" + #line 1592 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2267 "Python/generated_cases.c.h" + #line 2270 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2271,7 +2274,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1595 "Python/bytecodes.c" + #line 1596 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2286,7 +2289,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2290 "Python/generated_cases.c.h" + #line 2293 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2296,7 +2299,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1612 "Python/bytecodes.c" + #line 1613 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2304,13 +2307,13 @@ if (map == NULL) goto error; - #line 2308 "Python/generated_cases.c.h" + #line 2311 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1620 "Python/bytecodes.c" + #line 1621 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2314 "Python/generated_cases.c.h" + #line 2317 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2318,7 +2321,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1624 "Python/bytecodes.c" + #line 1625 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2358,7 +2361,7 @@ Py_DECREF(ann_dict); } } - #line 2362 "Python/generated_cases.c.h" + #line 2365 "Python/generated_cases.c.h" DISPATCH(); } @@ -2366,7 +2369,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1666 "Python/bytecodes.c" + #line 1667 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2376,14 +2379,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2380 "Python/generated_cases.c.h" + #line 2383 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1676 "Python/bytecodes.c" + #line 1677 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2387 "Python/generated_cases.c.h" + #line 2390 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2391,7 +2394,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1680 "Python/bytecodes.c" + #line 1681 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -2399,12 +2402,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2403 "Python/generated_cases.c.h" + #line 2406 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1688 "Python/bytecodes.c" + #line 1689 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2408 "Python/generated_cases.c.h" + #line 2411 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2412,17 +2415,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1694 "Python/bytecodes.c" + #line 1695 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (_PyDict_MergeEx(dict, update, 2) < 0) { format_kwargs_error(tstate, PEEK(3 + oparg), update); - #line 2421 "Python/generated_cases.c.h" + #line 2424 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1699 "Python/bytecodes.c" + #line 1700 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2426 "Python/generated_cases.c.h" + #line 2429 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2431,25 +2434,25 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1705 "Python/bytecodes.c" + #line 1706 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2441 "Python/generated_cases.c.h" + #line 2444 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1713 "Python/bytecodes.c" + #line 1714 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); - #line 2453 "Python/generated_cases.c.h" + #line 2456 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2460,7 +2463,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1727 "Python/bytecodes.c" + #line 1728 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2502,16 +2505,16 @@ } } } - #line 2506 "Python/generated_cases.c.h" + #line 2509 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1769 "Python/bytecodes.c" + #line 1770 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; - #line 2515 "Python/generated_cases.c.h" + #line 2518 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2526,20 +2529,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1788 "Python/bytecodes.c" + #line 1789 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2537 "Python/generated_cases.c.h" + #line 2540 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1795 "Python/bytecodes.c" + #line 1796 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2543 "Python/generated_cases.c.h" + #line 2546 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2554,7 +2557,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1799 "Python/bytecodes.c" + #line 1800 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2577,7 +2580,7 @@ res = res2; res2 = NULL; } - #line 2581 "Python/generated_cases.c.h" + #line 2584 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2591,7 +2594,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1838 "Python/bytecodes.c" + #line 1839 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2625,9 +2628,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2629 "Python/generated_cases.c.h" + #line 2632 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1872 "Python/bytecodes.c" + #line 1873 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2636,12 +2639,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2640 "Python/generated_cases.c.h" + #line 2643 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1881 "Python/bytecodes.c" + #line 1882 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2645 "Python/generated_cases.c.h" + #line 2648 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2655,7 +2658,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1890 "Python/bytecodes.c" + #line 1891 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2668,7 +2671,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2672 "Python/generated_cases.c.h" + #line 2675 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2683,7 +2686,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1906 "Python/bytecodes.c" + #line 1907 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2696,7 +2699,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2700 "Python/generated_cases.c.h" + #line 2703 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2711,7 +2714,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1922 "Python/bytecodes.c" + #line 1923 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2738,7 +2741,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2742 "Python/generated_cases.c.h" + #line 2745 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2753,7 +2756,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1952 "Python/bytecodes.c" + #line 1953 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2763,7 +2766,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2767 "Python/generated_cases.c.h" + #line 2770 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2778,7 +2781,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1965 "Python/bytecodes.c" + #line 1966 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2790,7 +2793,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2794 "Python/generated_cases.c.h" + #line 2797 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2804,7 +2807,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1980 "Python/bytecodes.c" + #line 1981 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2828,7 +2831,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2832 "Python/generated_cases.c.h" + #line 2835 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2836,7 +2839,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 2006 "Python/bytecodes.c" + #line 2007 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2862,7 +2865,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2866 "Python/generated_cases.c.h" + #line 2869 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2870,7 +2873,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2034 "Python/bytecodes.c" + #line 2035 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2888,7 +2891,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2892 "Python/generated_cases.c.h" + #line 2895 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2899,7 +2902,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 2054 "Python/bytecodes.c" + #line 2055 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2938,7 +2941,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2942 "Python/generated_cases.c.h" + #line 2945 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2949,7 +2952,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2095 "Python/bytecodes.c" + #line 2096 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2959,7 +2962,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2963 "Python/generated_cases.c.h" + #line 2966 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2971,7 +2974,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2114 "Python/bytecodes.c" + #line 2115 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2984,10 +2987,10 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 5) <= Py_GE); res = PyObject_RichCompare(left, right, oparg >> 5); - #line 2988 "Python/generated_cases.c.h" + #line 2991 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2127 "Python/bytecodes.c" + #line 2128 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; if (oparg & 16) { int res_bool = PyObject_IsTrue(res); @@ -2995,7 +2998,7 @@ if (res_bool < 0) goto pop_2_error; res = res_bool ? Py_True : Py_False; } - #line 2999 "Python/generated_cases.c.h" + #line 3002 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3006,7 +3009,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2137 "Python/bytecodes.c" + #line 2138 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3018,7 +3021,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3022 "Python/generated_cases.c.h" + #line 3025 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3029,7 +3032,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2152 "Python/bytecodes.c" + #line 2153 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -3045,7 +3048,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3049 "Python/generated_cases.c.h" + #line 3052 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3056,7 +3059,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2171 "Python/bytecodes.c" + #line 2172 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3069,7 +3072,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3073 "Python/generated_cases.c.h" + #line 3076 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3080,14 +3083,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2186 "Python/bytecodes.c" + #line 2187 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3086 "Python/generated_cases.c.h" + #line 3089 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2188 "Python/bytecodes.c" + #line 2189 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3091 "Python/generated_cases.c.h" + #line 3094 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3097,15 +3100,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2192 "Python/bytecodes.c" + #line 2193 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3103 "Python/generated_cases.c.h" + #line 3106 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2194 "Python/bytecodes.c" + #line 2195 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3109 "Python/generated_cases.c.h" + #line 3112 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3116,12 +3119,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2199 "Python/bytecodes.c" + #line 2200 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3122 "Python/generated_cases.c.h" + #line 3125 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2201 "Python/bytecodes.c" + #line 2202 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3129,10 +3132,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3133 "Python/generated_cases.c.h" + #line 3136 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2209 "Python/bytecodes.c" + #line 2210 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3141,7 +3144,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3145 "Python/generated_cases.c.h" + #line 3148 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3151,21 +3154,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2220 "Python/bytecodes.c" + #line 2221 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3158 "Python/generated_cases.c.h" + #line 3161 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2223 "Python/bytecodes.c" + #line 2224 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3165 "Python/generated_cases.c.h" + #line 3168 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2228 "Python/bytecodes.c" + #line 2229 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3169 "Python/generated_cases.c.h" + #line 3172 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3174,15 +3177,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2232 "Python/bytecodes.c" + #line 2233 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3181 "Python/generated_cases.c.h" + #line 3184 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2235 "Python/bytecodes.c" + #line 2236 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3186 "Python/generated_cases.c.h" + #line 3189 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3191,25 +3194,25 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2239 "Python/bytecodes.c" + #line 2240 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3199 "Python/generated_cases.c.h" + #line 3202 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2245 "Python/bytecodes.c" + #line 2246 "Python/bytecodes.c" JUMPBY(oparg); - #line 3208 "Python/generated_cases.c.h" + #line 3211 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2249 "Python/bytecodes.c" + #line 2250 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3227,13 +3230,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3231 "Python/generated_cases.c.h" + #line 3234 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2280 "Python/bytecodes.c" + #line 2281 "Python/bytecodes.c" PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255]; Py_INCREF(executor); @@ -3243,81 +3246,81 @@ goto error; } goto resume_frame; - #line 3247 "Python/generated_cases.c.h" + #line 3250 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2292 "Python/bytecodes.c" + #line 2293 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsFalse(cond)); - #line 3255 "Python/generated_cases.c.h" + #line 3258 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2297 "Python/bytecodes.c" + #line 2298 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsTrue(cond)); - #line 3265 "Python/generated_cases.c.h" + #line 3268 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2302 "Python/bytecodes.c" + #line 2303 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3274 "Python/generated_cases.c.h" + #line 3277 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2304 "Python/bytecodes.c" + #line 2305 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3279 "Python/generated_cases.c.h" + #line 3282 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2309 "Python/bytecodes.c" + #line 2310 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3291 "Python/generated_cases.c.h" + #line 3294 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2314 "Python/bytecodes.c" + #line 2315 "Python/bytecodes.c" } - #line 3295 "Python/generated_cases.c.h" + #line 3298 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2318 "Python/bytecodes.c" + #line 2319 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3308 "Python/generated_cases.c.h" + #line 3311 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2327 "Python/bytecodes.c" + #line 2328 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3321 "Python/generated_cases.c.h" + #line 3324 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3328,16 +3331,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2335 "Python/bytecodes.c" + #line 2336 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3337 "Python/generated_cases.c.h" + #line 3340 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2340 "Python/bytecodes.c" + #line 2341 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3345,7 +3348,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3349 "Python/generated_cases.c.h" + #line 3352 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3354,10 +3357,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2350 "Python/bytecodes.c" + #line 2351 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3361 "Python/generated_cases.c.h" + #line 3364 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3366,10 +3369,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2355 "Python/bytecodes.c" + #line 2356 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3373 "Python/generated_cases.c.h" + #line 3376 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3379,11 +3382,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2360 "Python/bytecodes.c" + #line 2361 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3387 "Python/generated_cases.c.h" + #line 3390 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3392,14 +3395,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2366 "Python/bytecodes.c" + #line 2367 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3399 "Python/generated_cases.c.h" + #line 3402 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2369 "Python/bytecodes.c" + #line 2370 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3403 "Python/generated_cases.c.h" + #line 3406 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3407,7 +3410,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2373 "Python/bytecodes.c" + #line 2374 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3430,11 +3433,11 @@ if (iter == NULL) { goto error; } - #line 3434 "Python/generated_cases.c.h" + #line 3437 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2396 "Python/bytecodes.c" + #line 2397 "Python/bytecodes.c" } - #line 3438 "Python/generated_cases.c.h" + #line 3441 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3444,7 +3447,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2414 "Python/bytecodes.c" + #line 2415 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3476,7 +3479,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3480 "Python/generated_cases.c.h" + #line 3483 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3484,7 +3487,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2448 "Python/bytecodes.c" + #line 2449 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3510,14 +3513,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3514 "Python/generated_cases.c.h" + #line 3517 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2476 "Python/bytecodes.c" + #line 2477 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3538,7 +3541,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3542 "Python/generated_cases.c.h" + #line 3545 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3548,7 +3551,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2499 "Python/bytecodes.c" + #line 2500 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3569,7 +3572,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3573 "Python/generated_cases.c.h" + #line 3576 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3579,7 +3582,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2522 "Python/bytecodes.c" + #line 2523 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3598,7 +3601,7 @@ if (next == NULL) { goto error; } - #line 3602 "Python/generated_cases.c.h" + #line 3605 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3607,7 +3610,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2543 "Python/bytecodes.c" + #line 2544 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3623,14 +3626,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3627 "Python/generated_cases.c.h" + #line 3630 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2561 "Python/bytecodes.c" + #line 2562 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3653,16 +3656,16 @@ Py_DECREF(enter); goto error; } - #line 3657 "Python/generated_cases.c.h" + #line 3660 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2584 "Python/bytecodes.c" + #line 2585 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3666 "Python/generated_cases.c.h" + #line 3669 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3673,7 +3676,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2593 "Python/bytecodes.c" + #line 2594 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3699,16 +3702,16 @@ Py_DECREF(enter); goto error; } - #line 3703 "Python/generated_cases.c.h" + #line 3706 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2619 "Python/bytecodes.c" + #line 2620 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3712 "Python/generated_cases.c.h" + #line 3715 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3720,7 +3723,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2628 "Python/bytecodes.c" + #line 2629 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3741,7 +3744,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3745 "Python/generated_cases.c.h" + #line 3748 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3750,7 +3753,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2667 "Python/bytecodes.c" + #line 2668 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3760,7 +3763,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3764 "Python/generated_cases.c.h" + #line 3767 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3774,7 +3777,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2679 "Python/bytecodes.c" + #line 2680 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3791,7 +3794,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3795 "Python/generated_cases.c.h" + #line 3798 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3805,7 +3808,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2698 "Python/bytecodes.c" + #line 2699 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3815,7 +3818,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3819 "Python/generated_cases.c.h" + #line 3822 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3829,7 +3832,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2710 "Python/bytecodes.c" + #line 2711 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3843,7 +3846,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3847 "Python/generated_cases.c.h" + #line 3850 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3852,16 +3855,16 @@ } TARGET(KW_NAMES) { - #line 2726 "Python/bytecodes.c" + #line 2727 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - #line 3860 "Python/generated_cases.c.h" + #line 3863 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2732 "Python/bytecodes.c" + #line 2733 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3874,7 +3877,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3878 "Python/generated_cases.c.h" + #line 3881 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3884,7 +3887,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2777 "Python/bytecodes.c" + #line 2778 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3966,7 +3969,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3970 "Python/generated_cases.c.h" + #line 3973 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3978,7 +3981,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2865 "Python/bytecodes.c" + #line 2866 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3988,7 +3991,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3992 "Python/generated_cases.c.h" + #line 3995 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3997,7 +4000,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2877 "Python/bytecodes.c" + #line 2878 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4023,7 +4026,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4027 "Python/generated_cases.c.h" + #line 4030 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4031,7 +4034,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2905 "Python/bytecodes.c" + #line 2906 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4067,7 +4070,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4071 "Python/generated_cases.c.h" + #line 4074 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4075,7 +4078,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2943 "Python/bytecodes.c" + #line 2944 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4085,7 +4088,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4089 "Python/generated_cases.c.h" + #line 4092 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4098,7 +4101,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2955 "Python/bytecodes.c" + #line 2956 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4109,7 +4112,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4113 "Python/generated_cases.c.h" + #line 4116 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4123,7 +4126,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2969 "Python/bytecodes.c" + #line 2970 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4134,7 +4137,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4138 "Python/generated_cases.c.h" + #line 4141 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4148,7 +4151,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2983 "Python/bytecodes.c" + #line 2984 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4170,7 +4173,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4174 "Python/generated_cases.c.h" + #line 4177 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4184,7 +4187,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3008 "Python/bytecodes.c" + #line 3009 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4212,7 +4215,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4216 "Python/generated_cases.c.h" + #line 4219 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4226,7 +4229,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3039 "Python/bytecodes.c" + #line 3040 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4258,7 +4261,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4262 "Python/generated_cases.c.h" + #line 4265 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4272,7 +4275,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3074 "Python/bytecodes.c" + #line 3075 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4304,7 +4307,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4308 "Python/generated_cases.c.h" + #line 4311 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4318,7 +4321,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3109 "Python/bytecodes.c" + #line 3110 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4343,7 +4346,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4347 "Python/generated_cases.c.h" + #line 4350 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4356,7 +4359,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3136 "Python/bytecodes.c" + #line 3137 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4383,7 +4386,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4387 "Python/generated_cases.c.h" + #line 4390 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4395,7 +4398,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3166 "Python/bytecodes.c" + #line 3167 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4413,14 +4416,14 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4417 "Python/generated_cases.c.h" + #line 4420 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3186 "Python/bytecodes.c" + #line 3187 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4451,7 +4454,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4455 "Python/generated_cases.c.h" + #line 4458 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4464,7 +4467,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3220 "Python/bytecodes.c" + #line 3221 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4493,7 +4496,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4497 "Python/generated_cases.c.h" + #line 4500 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4506,7 +4509,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3252 "Python/bytecodes.c" + #line 3253 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4535,7 +4538,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4539 "Python/generated_cases.c.h" + #line 4542 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4548,7 +4551,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3284 "Python/bytecodes.c" + #line 3285 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4576,7 +4579,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4580 "Python/generated_cases.c.h" + #line 4583 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4586,9 +4589,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3315 "Python/bytecodes.c" + #line 3316 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4592 "Python/generated_cases.c.h" + #line 4595 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4597,7 +4600,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3319 "Python/bytecodes.c" + #line 3320 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4659,14 +4662,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4663 "Python/generated_cases.c.h" + #line 4666 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3381 "Python/bytecodes.c" + #line 3382 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4670 "Python/generated_cases.c.h" + #line 4673 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4677,7 +4680,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3387 "Python/bytecodes.c" + #line 3388 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4689,7 +4692,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4693 "Python/generated_cases.c.h" + #line 4696 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4697,7 +4700,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3401 "Python/bytecodes.c" + #line 3402 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4722,14 +4725,14 @@ default: Py_UNREACHABLE(); } - #line 4726 "Python/generated_cases.c.h" + #line 4729 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3428 "Python/bytecodes.c" + #line 3429 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4750,7 +4753,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4754 "Python/generated_cases.c.h" + #line 4757 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4758,15 +4761,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3451 "Python/bytecodes.c" + #line 3452 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4764 "Python/generated_cases.c.h" + #line 4767 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3453 "Python/bytecodes.c" + #line 3454 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4770 "Python/generated_cases.c.h" + #line 4773 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4776,14 +4779,14 @@ TARGET(CONVERT_VALUE) { PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3457 "Python/bytecodes.c" + #line 3458 "Python/bytecodes.c" convertion_func_ptr conv_fn; assert(oparg >= FVC_STR && oparg <= FVC_ASCII); conv_fn = CONVERSION_FUNCTIONS[oparg]; result = conv_fn(value); Py_DECREF(value); if (result == NULL) goto pop_1_error; - #line 4787 "Python/generated_cases.c.h" + #line 4790 "Python/generated_cases.c.h" stack_pointer[-1] = result; DISPATCH(); } @@ -4791,7 +4794,7 @@ TARGET(FORMAT_SIMPLE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 3466 "Python/bytecodes.c" + #line 3467 "Python/bytecodes.c" /* If value is a unicode object, then we know the result * of format(value) is value itself. */ if (!PyUnicode_CheckExact(value)) { @@ -4802,7 +4805,7 @@ else { res = value; } - #line 4806 "Python/generated_cases.c.h" + #line 4809 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -4811,12 +4814,12 @@ PyObject *fmt_spec = stack_pointer[-1]; PyObject *value = stack_pointer[-2]; PyObject *res; - #line 3479 "Python/bytecodes.c" + #line 3480 "Python/bytecodes.c" res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); if (res == NULL) goto pop_2_error; - #line 4820 "Python/generated_cases.c.h" + #line 4823 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -4825,10 +4828,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3486 "Python/bytecodes.c" + #line 3487 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4832 "Python/generated_cases.c.h" + #line 4835 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4840,7 +4843,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3491 "Python/bytecodes.c" + #line 3492 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4855,12 +4858,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4859 "Python/generated_cases.c.h" + #line 4862 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3506 "Python/bytecodes.c" + #line 3507 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4864 "Python/generated_cases.c.h" + #line 4867 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4870,16 +4873,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3511 "Python/bytecodes.c" + #line 3512 "Python/bytecodes.c" assert(oparg >= 2); - #line 4876 "Python/generated_cases.c.h" + #line 4879 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3515 "Python/bytecodes.c" + #line 3516 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4891,26 +4894,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4895 "Python/generated_cases.c.h" + #line 4898 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3529 "Python/bytecodes.c" + #line 3530 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4901 "Python/generated_cases.c.h" + #line 4904 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3533 "Python/bytecodes.c" + #line 3534 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4908 "Python/generated_cases.c.h" + #line 4911 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3538 "Python/bytecodes.c" + #line 3539 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4919,12 +4922,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4923 "Python/generated_cases.c.h" + #line 4926 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3549 "Python/bytecodes.c" + #line 3550 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); // XXX Py_DECREF(cond); @@ -4933,12 +4936,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4937 "Python/generated_cases.c.h" + #line 4940 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3560 "Python/bytecodes.c" + #line 3561 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4950,12 +4953,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4954 "Python/generated_cases.c.h" + #line 4957 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3574 "Python/bytecodes.c" + #line 3575 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4967,30 +4970,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4971 "Python/generated_cases.c.h" + #line 4974 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3588 "Python/bytecodes.c" + #line 3589 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4982 "Python/generated_cases.c.h" + #line 4985 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3596 "Python/bytecodes.c" + #line 3597 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4989 "Python/generated_cases.c.h" + #line 4992 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3601 "Python/bytecodes.c" + #line 3602 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4996 "Python/generated_cases.c.h" + #line 4999 "Python/generated_cases.c.h" } diff --git a/Python/specialize.c b/Python/specialize.c index 5f6e451b62f830..755e788ec6c622 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -2286,7 +2286,7 @@ _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr) SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_TO_BOOL_SEQUENCE); goto failure; } - if (PyUnstable_Type_AssignVersionTag(Py_TYPE(value))) { + if (!PyUnstable_Type_AssignVersionTag(Py_TYPE(value))) { SPECIALIZATION_FAIL(TO_BOOL, SPEC_FAIL_OUT_OF_VERSIONS); goto failure; } From d31407825cac7b01443449db0636e6b1af6dbb5d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Jun 2023 17:04:28 -0700 Subject: [PATCH 11/15] Cleanup --- .gitattributes | 1 + Python/bytecodes.c | 41 +- Python/flowgraph.c | 137 +++-- Python/generated_cases.c.h | 1023 ++++++++++++++++++------------------ Python/specialize.c | 6 +- 5 files changed, 596 insertions(+), 612 deletions(-) diff --git a/.gitattributes b/.gitattributes index bab1ef0d010460..9cc47cdbc37607 100644 --- a/.gitattributes +++ b/.gitattributes @@ -86,6 +86,7 @@ Parser/token.c generated Programs/test_frozenmain.h generated Python/Python-ast.c generated Python/generated_cases.c.h generated +Python/opcode_metadata.h generated Python/opcode_targets.h generated Python/stdlib_module_names.h generated Tools/peg_generator/pegen/grammar_parser.py generated diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 2bd5093150af7f..c0897ec23820eb 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -285,12 +285,7 @@ dummy_func( inst(UNARY_NOT, (value -- res)) { assert(PyBool_Check(value)); - if (Py_IsFalse(value)) { - res = Py_True; - } - else { - res = Py_False; - } + res = Py_IsFalse(value) ? Py_True : Py_False; } family(to_bool, INLINE_CACHE_ENTRIES_TO_BOOL) = { @@ -317,12 +312,7 @@ dummy_func( int err = PyObject_IsTrue(value); DECREF_INPUTS(); ERROR_IF(err < 0, error); - if (err == 0) { - res = Py_False; - } - else { - res = Py_True; - } + res = err ? Py_True : Py_False; } inst(TO_BOOL_BOOL, (unused/1, unused/2, value -- value)) { @@ -347,12 +337,7 @@ dummy_func( inst(TO_BOOL_LIST, (unused/1, unused/2, value -- res)) { DEOPT_IF(!PyList_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); - if (!Py_SIZE(value)) { - res = Py_False; - } - else { - res = Py_True; - } + res = Py_SIZE(value) ? Py_True : Py_False; DECREF_INPUTS(); } @@ -3600,23 +3585,17 @@ dummy_func( inst(INSTRUMENTED_POP_JUMP_IF_TRUE, ( -- )) { PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); // XXX - Py_DECREF(cond); - ERROR_IF(err < 0, error); - _Py_CODEUNIT *here = next_instr-1; - assert(err == 0 || err == 1); - int offset = err*oparg; + assert(PyBool_Check(cond)); + _Py_CODEUNIT *here = next_instr - 1; + int offset = Py_IsTrue(cond) * oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); } inst(INSTRUMENTED_POP_JUMP_IF_FALSE, ( -- )) { PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); // XXX - Py_DECREF(cond); - ERROR_IF(err < 0, error); - _Py_CODEUNIT *here = next_instr-1; - assert(err == 0 || err == 1); - int offset = (1-err)*oparg; + assert(PyBool_Check(cond)); + _Py_CODEUNIT *here = next_instr - 1; + int offset = Py_IsFalse(cond) * oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); } @@ -3643,7 +3622,7 @@ dummy_func( } else { Py_DECREF(value); - offset = oparg; + offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); } diff --git a/Python/flowgraph.c b/Python/flowgraph.c index 5166b8089649d1..a817374472bde6 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1447,6 +1447,54 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); } break; + case IS_OP: + // Fold to POP_JUMP_IF_NONE: + // - LOAD_CONST(None) IS_OP(0) POP_JUMP_IF_TRUE + // - LOAD_CONST(None) IS_OP(1) POP_JUMP_IF_FALSE + // - LOAD_CONST(None) IS_OP(0) TO_BOOL POP_JUMP_IF_TRUE + // - LOAD_CONST(None) IS_OP(1) TO_BOOL POP_JUMP_IF_FALSE + // Fold to POP_JUMP_IF_NOT_NONE: + // - LOAD_CONST(None) IS_OP(0) POP_JUMP_IF_FALSE + // - LOAD_CONST(None) IS_OP(1) POP_JUMP_IF_TRUE + // - LOAD_CONST(None) IS_OP(0) TO_BOOL POP_JUMP_IF_FALSE + // - LOAD_CONST(None) IS_OP(1) TO_BOOL POP_JUMP_IF_TRUE + cnt = get_const_value(opcode, oparg, consts); + if (cnt == NULL) { + goto error; + } + if (!Py_IsNone(cnt)) { + break; + } + Py_DECREF(cnt); + if (bb->b_iused <= i + 2) { + break; + } + cfg_instr *is_instr = &bb->b_instr[i + 1]; + cfg_instr *jump_instr = &bb->b_instr[i + 2]; + // Get rid of TO_BOOL regardless: + if (jump_instr->i_opcode == TO_BOOL) { + INSTR_SET_OP0(jump_instr, NOP); + if (bb->b_iused <= i + 3) { + break; + } + jump_instr = &bb->b_instr[i + 3]; + } + bool invert = is_instr->i_oparg; + if (jump_instr->i_opcode == POP_JUMP_IF_FALSE) { + invert = !invert; + } + else if (jump_instr->i_opcode != POP_JUMP_IF_TRUE) { + break; + } + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP0(is_instr, NOP); + jump_instr->i_opcode = invert ? POP_JUMP_IF_NOT_NONE + : POP_JUMP_IF_NONE; + break; + case RETURN_VALUE: + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP1(&bb->b_instr[++i], RETURN_CONST, oparg); + break; case TO_BOOL: cnt = get_const_value(opcode, oparg, consts); if (cnt == NULL) { @@ -1465,65 +1513,9 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) INSTR_SET_OP0(inst, NOP); INSTR_SET_OP1(&bb->b_instr[i + 1], LOAD_CONST, index); break; - case IS_OP: - cnt = get_const_value(opcode, oparg, consts); - if (cnt == NULL) { - goto error; - } - int to_bool = i + 2 < bb->b_iused && bb->b_instr[i + 2].i_opcode == TO_BOOL; - int jump_op = i + to_bool + 2 < bb->b_iused ? bb->b_instr[i + to_bool + 2].i_opcode : 0; - if (Py_IsNone(cnt) && (jump_op == POP_JUMP_IF_FALSE || jump_op == POP_JUMP_IF_TRUE)) { - unsigned char nextarg = bb->b_instr[i+1].i_oparg; - INSTR_SET_OP0(inst, NOP); - INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); - if (to_bool) { - INSTR_SET_OP0(&bb->b_instr[i + 2], NOP); - } - bb->b_instr[i + to_bool + 2].i_opcode = nextarg ^ (jump_op == POP_JUMP_IF_FALSE) ? - POP_JUMP_IF_NOT_NONE : POP_JUMP_IF_NONE; - } - Py_DECREF(cnt); - break; - case RETURN_VALUE: - INSTR_SET_OP0(inst, NOP); - INSTR_SET_OP1(&bb->b_instr[++i], RETURN_CONST, oparg); - break; } break; } - case COMPARE_OP: - if (nextop == TO_BOOL) { - INSTR_SET_OP0(inst, NOP); - INSTR_SET_OP1(&bb->b_instr[i + 1], COMPARE_OP, oparg | 16); - continue; - } - break; - case TO_BOOL: - if (nextop == TO_BOOL) { - INSTR_SET_OP0(inst, NOP); - continue; - } - break; - case UNARY_NOT: - if (nextop == TO_BOOL) { - INSTR_SET_OP0(inst, NOP); - INSTR_SET_OP0(&bb->b_instr[i + 1], UNARY_NOT); - continue; - } - if (nextop == UNARY_NOT) { - INSTR_SET_OP0(inst, NOP); - INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); - continue; - } - break; - case IS_OP: - case CONTAINS_OP: - if (nextop == TO_BOOL) { - INSTR_SET_OP0(inst, NOP); - INSTR_SET_OP1(&bb->b_instr[i + 1], opcode, oparg); - continue; - } - break; /* Try to fold tuples of constants. Skip over BUILD_TUPLE(1) UNPACK_SEQUENCE(1). Replace BUILD_TUPLE(2) UNPACK_SEQUENCE(2) with SWAP(2). @@ -1606,6 +1598,39 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) inst[1].i_oparg |= 1; } break; + case COMPARE_OP: + if (nextop == TO_BOOL) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP1(&bb->b_instr[i + 1], COMPARE_OP, oparg | 16); + continue; + } + break; + case CONTAINS_OP: + case IS_OP: + if (nextop == TO_BOOL) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP1(&bb->b_instr[i + 1], opcode, oparg); + continue; + } + break; + case TO_BOOL: + if (nextop == TO_BOOL) { + INSTR_SET_OP0(inst, NOP); + continue; + } + break; + case UNARY_NOT: + if (nextop == TO_BOOL) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP0(&bb->b_instr[i + 1], UNARY_NOT); + continue; + } + if (nextop == UNARY_NOT) { + INSTR_SET_OP0(inst, NOP); + INSTR_SET_OP0(&bb->b_instr[i + 1], NOP); + continue; + } + break; default: /* All OPCODE_HAS_CONST opcodes should be handled with LOAD_CONST */ assert (!OPCODE_HAS_CONST(inst->i_opcode)); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 589b7084beddf1..bf146ef56a15d4 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -274,13 +274,8 @@ PyObject *res; #line 287 "Python/bytecodes.c" assert(PyBool_Check(value)); - if (Py_IsFalse(value)) { - res = Py_True; - } - else { - res = Py_False; - } - #line 284 "Python/generated_cases.c.h" + res = Py_IsFalse(value) ? Py_True : Py_False; + #line 279 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -290,7 +285,7 @@ static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 3, "incorrect cache size"); PyObject *value = stack_pointer[-1]; PyObject *res; - #line 307 "Python/bytecodes.c" + #line 302 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyToBoolCache *cache = (_PyToBoolCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -302,17 +297,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ int err = PyObject_IsTrue(value); - #line 306 "Python/generated_cases.c.h" + #line 301 "Python/generated_cases.c.h" Py_DECREF(value); - #line 319 "Python/bytecodes.c" + #line 314 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - if (err == 0) { - res = Py_False; - } - else { - res = Py_True; - } - #line 316 "Python/generated_cases.c.h" + res = err ? Py_True : Py_False; + #line 306 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -320,11 +310,11 @@ TARGET(TO_BOOL_BOOL) { PyObject *value = stack_pointer[-1]; - #line 329 "Python/bytecodes.c" + #line 319 "Python/bytecodes.c" // Coolest (and dumbest-named) specialization ever: DEOPT_IF(!PyBool_Check(value), TO_BOOL); STAT_INC(TO_BOOL, hit); - #line 328 "Python/generated_cases.c.h" + #line 318 "Python/generated_cases.c.h" next_instr += 3; DISPATCH(); } @@ -332,7 +322,7 @@ TARGET(TO_BOOL_INT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 335 "Python/bytecodes.c" + #line 325 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (_PyLong_IsZero((PyLongObject *)value)) { @@ -340,12 +330,12 @@ res = Py_False; } else { - #line 344 "Python/generated_cases.c.h" + #line 334 "Python/generated_cases.c.h" Py_DECREF(value); - #line 343 "Python/bytecodes.c" + #line 333 "Python/bytecodes.c" res = Py_True; } - #line 349 "Python/generated_cases.c.h" + #line 339 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -354,16 +344,11 @@ TARGET(TO_BOOL_LIST) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 348 "Python/bytecodes.c" + #line 338 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); - if (!Py_SIZE(value)) { - res = Py_False; - } - else { - res = Py_True; - } - #line 367 "Python/generated_cases.c.h" + res = Py_SIZE(value) ? Py_True : Py_False; + #line 352 "Python/generated_cases.c.h" Py_DECREF(value); stack_pointer[-1] = res; next_instr += 3; @@ -373,13 +358,13 @@ TARGET(TO_BOOL_NONE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 360 "Python/bytecodes.c" + #line 345 "Python/bytecodes.c" // This one is a bit weird, because we expect *some* failures... // it might be worth combining with TO_BOOL_ALWAYS_TRUE somehow: DEOPT_IF(!Py_IsNone(value), TO_BOOL); STAT_INC(TO_BOOL, hit); res = Py_False; - #line 383 "Python/generated_cases.c.h" + #line 368 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -388,7 +373,7 @@ TARGET(TO_BOOL_STR) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 368 "Python/bytecodes.c" + #line 353 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (Py_Is(value, &_Py_STR(empty))) { @@ -397,12 +382,12 @@ } else { assert(Py_SIZE(value)); - #line 401 "Python/generated_cases.c.h" + #line 386 "Python/generated_cases.c.h" Py_DECREF(value); - #line 377 "Python/bytecodes.c" + #line 362 "Python/bytecodes.c" res = Py_True; } - #line 406 "Python/generated_cases.c.h" + #line 391 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -412,17 +397,17 @@ PyObject *value = stack_pointer[-1]; PyObject *res; uint32_t version = read_u32(&next_instr[1].cache); - #line 382 "Python/bytecodes.c" + #line 367 "Python/bytecodes.c" // This one is a bit weird, because we expect *some* failures... // it might be worth combining with TO_BOOL_NONE somehow: assert(version); DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); STAT_INC(TO_BOOL, hit); - #line 422 "Python/generated_cases.c.h" + #line 407 "Python/generated_cases.c.h" Py_DECREF(value); - #line 388 "Python/bytecodes.c" + #line 373 "Python/bytecodes.c" res = Py_True; - #line 426 "Python/generated_cases.c.h" + #line 411 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -431,13 +416,13 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 392 "Python/bytecodes.c" + #line 377 "Python/bytecodes.c" res = PyNumber_Invert(value); - #line 437 "Python/generated_cases.c.h" + #line 422 "Python/generated_cases.c.h" Py_DECREF(value); - #line 394 "Python/bytecodes.c" + #line 379 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 441 "Python/generated_cases.c.h" + #line 426 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -448,10 +433,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 410 "Python/bytecodes.c" + #line 395 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 455 "Python/generated_cases.c.h" + #line 440 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -459,13 +444,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 415 "Python/bytecodes.c" + #line 400 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 469 "Python/generated_cases.c.h" + #line 454 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -480,10 +465,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 410 "Python/bytecodes.c" + #line 395 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 487 "Python/generated_cases.c.h" + #line 472 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -491,13 +476,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 423 "Python/bytecodes.c" + #line 408 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 501 "Python/generated_cases.c.h" + #line 486 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -512,10 +497,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 410 "Python/bytecodes.c" + #line 395 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 519 "Python/generated_cases.c.h" + #line 504 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -523,13 +508,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 431 "Python/bytecodes.c" + #line 416 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 533 "Python/generated_cases.c.h" + #line 518 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -544,10 +529,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 446 "Python/bytecodes.c" + #line 431 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 551 "Python/generated_cases.c.h" + #line 536 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -555,13 +540,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 451 "Python/bytecodes.c" + #line 436 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 565 "Python/generated_cases.c.h" + #line 550 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -576,10 +561,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 446 "Python/bytecodes.c" + #line 431 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 583 "Python/generated_cases.c.h" + #line 568 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -587,13 +572,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 459 "Python/bytecodes.c" + #line 444 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 597 "Python/generated_cases.c.h" + #line 582 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -608,10 +593,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 446 "Python/bytecodes.c" + #line 431 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 615 "Python/generated_cases.c.h" + #line 600 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -619,13 +604,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 467 "Python/bytecodes.c" + #line 452 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 629 "Python/generated_cases.c.h" + #line 614 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -640,10 +625,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 482 "Python/bytecodes.c" + #line 467 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 647 "Python/generated_cases.c.h" + #line 632 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -651,13 +636,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 487 "Python/bytecodes.c" + #line 472 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; - #line 661 "Python/generated_cases.c.h" + #line 646 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -672,17 +657,17 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 482 "Python/bytecodes.c" + #line 467 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 679 "Python/generated_cases.c.h" + #line 664 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 504 "Python/bytecodes.c" + #line 489 "Python/bytecodes.c" _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; assert(true_next.op.code == STORE_FAST); PyObject **target_local = &GETLOCAL(true_next.op.arg); @@ -706,7 +691,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_OP + 1); - #line 710 "Python/generated_cases.c.h" + #line 695 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -718,7 +703,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 541 "Python/bytecodes.c" + #line 526 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -730,12 +715,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); - #line 734 "Python/generated_cases.c.h" + #line 719 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 553 "Python/bytecodes.c" + #line 538 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 739 "Python/generated_cases.c.h" + #line 724 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -747,7 +732,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 557 "Python/bytecodes.c" + #line 542 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -760,7 +745,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; - #line 764 "Python/generated_cases.c.h" + #line 749 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -771,7 +756,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 572 "Python/bytecodes.c" + #line 557 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -784,7 +769,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; - #line 788 "Python/generated_cases.c.h" + #line 773 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -793,7 +778,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 587 "Python/bytecodes.c" + #line 572 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -807,7 +792,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 811 "Python/generated_cases.c.h" + #line 796 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -818,7 +803,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 603 "Python/bytecodes.c" + #line 588 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -832,7 +817,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); - #line 836 "Python/generated_cases.c.h" + #line 821 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -843,7 +828,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 619 "Python/bytecodes.c" + #line 604 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -851,14 +836,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } - #line 855 "Python/generated_cases.c.h" + #line 840 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 627 "Python/bytecodes.c" + #line 612 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub - #line 862 "Python/generated_cases.c.h" + #line 847 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -870,7 +855,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 634 "Python/bytecodes.c" + #line 619 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -893,15 +878,15 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 897 "Python/generated_cases.c.h" + #line 882 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 659 "Python/bytecodes.c" + #line 644 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; - #line 905 "Python/generated_cases.c.h" + #line 890 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -909,13 +894,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 663 "Python/bytecodes.c" + #line 648 "Python/bytecodes.c" int err = PySet_Add(set, v); - #line 915 "Python/generated_cases.c.h" + #line 900 "Python/generated_cases.c.h" Py_DECREF(v); - #line 665 "Python/bytecodes.c" + #line 650 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 919 "Python/generated_cases.c.h" + #line 904 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -927,7 +912,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 675 "Python/bytecodes.c" + #line 660 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -942,13 +927,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); - #line 946 "Python/generated_cases.c.h" + #line 931 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 690 "Python/bytecodes.c" + #line 675 "Python/bytecodes.c" if (err) goto pop_3_error; - #line 952 "Python/generated_cases.c.h" + #line 937 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -958,7 +943,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 694 "Python/bytecodes.c" + #line 679 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -975,7 +960,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 979 "Python/generated_cases.c.h" + #line 964 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -985,13 +970,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 713 "Python/bytecodes.c" + #line 698 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; - #line 995 "Python/generated_cases.c.h" + #line 980 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -1000,15 +985,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 721 "Python/bytecodes.c" + #line 706 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); - #line 1007 "Python/generated_cases.c.h" + #line 992 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 724 "Python/bytecodes.c" + #line 709 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1012 "Python/generated_cases.c.h" + #line 997 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1016,14 +1001,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 728 "Python/bytecodes.c" + #line 713 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); - #line 1023 "Python/generated_cases.c.h" + #line 1008 "Python/generated_cases.c.h" Py_DECREF(value); - #line 731 "Python/bytecodes.c" + #line 716 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 1027 "Python/generated_cases.c.h" + #line 1012 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -1032,15 +1017,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 735 "Python/bytecodes.c" + #line 720 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); - #line 1039 "Python/generated_cases.c.h" + #line 1024 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 738 "Python/bytecodes.c" + #line 723 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 1044 "Python/generated_cases.c.h" + #line 1029 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -1048,7 +1033,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 742 "Python/bytecodes.c" + #line 727 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -1066,12 +1051,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } - #line 1070 "Python/generated_cases.c.h" + #line 1055 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 762 "Python/bytecodes.c" + #line 747 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); /* Restore previous cframe and return. */ @@ -1080,12 +1065,12 @@ assert(!_PyErr_Occurred(tstate)); _Py_LeaveRecursiveCallTstate(tstate); return retval; - #line 1084 "Python/generated_cases.c.h" + #line 1069 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 773 "Python/bytecodes.c" + #line 758 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1098,12 +1083,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1102 "Python/generated_cases.c.h" + #line 1087 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 788 "Python/bytecodes.c" + #line 773 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1120,11 +1105,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1124 "Python/generated_cases.c.h" + #line 1109 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 807 "Python/bytecodes.c" + #line 792 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1138,11 +1123,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1142 "Python/generated_cases.c.h" + #line 1127 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 823 "Python/bytecodes.c" + #line 808 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1160,13 +1145,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1164 "Python/generated_cases.c.h" + #line 1149 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 843 "Python/bytecodes.c" + #line 828 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1179,16 +1164,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1183 "Python/generated_cases.c.h" + #line 1168 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 856 "Python/bytecodes.c" + #line 841 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1190 "Python/generated_cases.c.h" + #line 1175 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 861 "Python/bytecodes.c" + #line 846 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1201,7 +1186,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1205 "Python/generated_cases.c.h" + #line 1190 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1209,7 +1194,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 876 "Python/bytecodes.c" + #line 861 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1252,7 +1237,7 @@ Py_DECREF(next_iter); } } - #line 1256 "Python/generated_cases.c.h" + #line 1241 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; DISPATCH(); @@ -1261,16 +1246,16 @@ TARGET(GET_AWAITABLE) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 921 "Python/bytecodes.c" + #line 906 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1272 "Python/generated_cases.c.h" + #line 1257 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 928 "Python/bytecodes.c" + #line 913 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1287,7 +1272,7 @@ } if (iter == NULL) goto pop_1_error; - #line 1291 "Python/generated_cases.c.h" + #line 1276 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1298,7 +1283,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 952 "Python/bytecodes.c" + #line 937 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1345,7 +1330,7 @@ } } Py_DECREF(v); - #line 1349 "Python/generated_cases.c.h" + #line 1334 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1354,7 +1339,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 1001 "Python/bytecodes.c" + #line 986 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1370,12 +1355,12 @@ tstate->exc_info = &gen->gi_exc_state; SKIP_OVER(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1374 "Python/generated_cases.c.h" + #line 1359 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1019 "Python/bytecodes.c" + #line 1004 "Python/bytecodes.c" assert(frame != &entry_frame); assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ PyGenObject *gen = _PyFrame_GetGenerator(frame); @@ -1393,12 +1378,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1397 "Python/generated_cases.c.h" + #line 1382 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1039 "Python/bytecodes.c" + #line 1024 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1415,15 +1400,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1419 "Python/generated_cases.c.h" + #line 1404 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 1058 "Python/bytecodes.c" + #line 1043 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1427 "Python/generated_cases.c.h" + #line 1412 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1431,7 +1416,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 1063 "Python/bytecodes.c" + #line 1048 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1449,26 +1434,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1453 "Python/generated_cases.c.h" + #line 1438 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 1083 "Python/bytecodes.c" + #line 1068 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1462 "Python/generated_cases.c.h" + #line 1447 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 1086 "Python/bytecodes.c" + #line 1071 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1472 "Python/generated_cases.c.h" + #line 1457 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1479,23 +1464,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1095 "Python/bytecodes.c" + #line 1080 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1488 "Python/generated_cases.c.h" + #line 1473 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1100 "Python/bytecodes.c" + #line 1085 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1499 "Python/generated_cases.c.h" + #line 1484 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1504,9 +1489,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1109 "Python/bytecodes.c" + #line 1094 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1510 "Python/generated_cases.c.h" + #line 1495 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1514,7 +1499,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1113 "Python/bytecodes.c" + #line 1098 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1536,7 +1521,7 @@ if (true) goto error; } } - #line 1540 "Python/generated_cases.c.h" + #line 1525 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1544,33 +1529,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1138 "Python/bytecodes.c" + #line 1123 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1555 "Python/generated_cases.c.h" + #line 1540 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1145 "Python/bytecodes.c" + #line 1130 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1564 "Python/generated_cases.c.h" + #line 1549 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1152 "Python/bytecodes.c" + #line 1137 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1568 "Python/generated_cases.c.h" + #line 1553 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1156 "Python/bytecodes.c" + #line 1141 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; @@ -1587,7 +1572,7 @@ name); goto error; } - #line 1591 "Python/generated_cases.c.h" + #line 1576 "Python/generated_cases.c.h" DISPATCH(); } @@ -1595,7 +1580,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1182 "Python/bytecodes.c" + #line 1167 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1608,11 +1593,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1612 "Python/generated_cases.c.h" + #line 1597 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1195 "Python/bytecodes.c" + #line 1180 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1616 "Python/generated_cases.c.h" + #line 1601 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1622,14 +1607,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1199 "Python/bytecodes.c" + #line 1184 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1633 "Python/generated_cases.c.h" + #line 1618 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1640,7 +1625,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1209 "Python/bytecodes.c" + #line 1194 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1648,7 +1633,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1652 "Python/generated_cases.c.h" + #line 1637 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1659,7 +1644,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1220 "Python/bytecodes.c" + #line 1205 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1667,7 +1652,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1671 "Python/generated_cases.c.h" + #line 1656 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1677,15 +1662,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1231 "Python/bytecodes.c" + #line 1216 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); - #line 1685 "Python/generated_cases.c.h" + #line 1670 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1235 "Python/bytecodes.c" + #line 1220 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1689 "Python/generated_cases.c.h" + #line 1674 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1696,7 +1681,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1246 "Python/bytecodes.c" + #line 1231 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); @@ -1712,12 +1697,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1716 "Python/generated_cases.c.h" + #line 1701 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1262 "Python/bytecodes.c" + #line 1247 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1721 "Python/generated_cases.c.h" + #line 1706 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1725,34 +1710,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1266 "Python/bytecodes.c" + #line 1251 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1732 "Python/generated_cases.c.h" + #line 1717 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1269 "Python/bytecodes.c" + #line 1254 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1736 "Python/generated_cases.c.h" + #line 1721 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1273 "Python/bytecodes.c" + #line 1258 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1746 "Python/generated_cases.c.h" + #line 1731 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1276 "Python/bytecodes.c" + #line 1261 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1750 "Python/generated_cases.c.h" + #line 1735 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1280 "Python/bytecodes.c" + #line 1265 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1764,7 +1749,7 @@ } goto error; } - #line 1768 "Python/generated_cases.c.h" + #line 1753 "Python/generated_cases.c.h" DISPATCH(); } @@ -1772,7 +1757,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1294 "Python/bytecodes.c" + #line 1279 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1780,7 +1765,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1784 "Python/generated_cases.c.h" + #line 1769 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1792,7 +1777,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1294 "Python/bytecodes.c" + #line 1279 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1800,13 +1785,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1804 "Python/generated_cases.c.h" + #line 1789 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1306 "Python/bytecodes.c" + #line 1291 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1863,7 +1848,7 @@ } } } - #line 1867 "Python/generated_cases.c.h" + #line 1852 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1876,7 +1861,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1306 "Python/bytecodes.c" + #line 1291 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1933,7 +1918,7 @@ } } } - #line 1937 "Python/generated_cases.c.h" + #line 1922 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1945,7 +1930,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1375 "Python/bytecodes.c" + #line 1360 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1997,7 +1982,7 @@ } } null = NULL; - #line 2001 "Python/generated_cases.c.h" + #line 1986 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -2011,7 +1996,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1429 "Python/bytecodes.c" + #line 1414 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -2022,7 +2007,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2026 "Python/generated_cases.c.h" + #line 2011 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2037,7 +2022,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1442 "Python/bytecodes.c" + #line 1427 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -2052,7 +2037,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2056 "Python/generated_cases.c.h" + #line 2041 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2062,16 +2047,16 @@ } TARGET(DELETE_FAST) { - #line 1459 "Python/bytecodes.c" + #line 1444 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 2070 "Python/generated_cases.c.h" + #line 2055 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1465 "Python/bytecodes.c" + #line 1450 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -2080,12 +2065,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2084 "Python/generated_cases.c.h" + #line 2069 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1476 "Python/bytecodes.c" + #line 1461 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2096,14 +2081,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2100 "Python/generated_cases.c.h" + #line 2085 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1489 "Python/bytecodes.c" + #line 1474 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus); @@ -2138,14 +2123,14 @@ } Py_INCREF(value); } - #line 2142 "Python/generated_cases.c.h" + #line 2127 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1526 "Python/bytecodes.c" + #line 1511 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2153,7 +2138,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2157 "Python/generated_cases.c.h" + #line 2142 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2161,18 +2146,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1536 "Python/bytecodes.c" + #line 1521 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2170 "Python/generated_cases.c.h" + #line 2155 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1543 "Python/bytecodes.c" + #line 1528 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = _PyFrame_GetCode(frame); assert(PyFunction_Check(frame->f_funcobj)); @@ -2183,22 +2168,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2187 "Python/generated_cases.c.h" + #line 2172 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1556 "Python/bytecodes.c" + #line 1541 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2196 "Python/generated_cases.c.h" + #line 2181 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1558 "Python/bytecodes.c" + #line 1543 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2202 "Python/generated_cases.c.h" + #line 2187 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2208,10 +2193,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1562 "Python/bytecodes.c" + #line 1547 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2215 "Python/generated_cases.c.h" + #line 2200 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2221,10 +2206,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1567 "Python/bytecodes.c" + #line 1552 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2228 "Python/generated_cases.c.h" + #line 2213 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2234,7 +2219,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1572 "Python/bytecodes.c" + #line 1557 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2245,13 +2230,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2249 "Python/generated_cases.c.h" + #line 2234 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1583 "Python/bytecodes.c" + #line 1568 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2255 "Python/generated_cases.c.h" + #line 2240 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2260,13 +2245,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1590 "Python/bytecodes.c" + #line 1575 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2266 "Python/generated_cases.c.h" + #line 2251 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1592 "Python/bytecodes.c" + #line 1577 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2270 "Python/generated_cases.c.h" + #line 2255 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2274,7 +2259,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1596 "Python/bytecodes.c" + #line 1581 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2289,7 +2274,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2293 "Python/generated_cases.c.h" + #line 2278 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2299,7 +2284,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1613 "Python/bytecodes.c" + #line 1598 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2307,13 +2292,13 @@ if (map == NULL) goto error; - #line 2311 "Python/generated_cases.c.h" + #line 2296 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1621 "Python/bytecodes.c" + #line 1606 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2317 "Python/generated_cases.c.h" + #line 2302 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2321,7 +2306,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1625 "Python/bytecodes.c" + #line 1610 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2361,7 +2346,7 @@ Py_DECREF(ann_dict); } } - #line 2365 "Python/generated_cases.c.h" + #line 2350 "Python/generated_cases.c.h" DISPATCH(); } @@ -2369,7 +2354,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1667 "Python/bytecodes.c" + #line 1652 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2379,14 +2364,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2383 "Python/generated_cases.c.h" + #line 2368 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1677 "Python/bytecodes.c" + #line 1662 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2390 "Python/generated_cases.c.h" + #line 2375 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2394,7 +2379,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1681 "Python/bytecodes.c" + #line 1666 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -2402,12 +2387,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2406 "Python/generated_cases.c.h" + #line 2391 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1689 "Python/bytecodes.c" + #line 1674 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2411 "Python/generated_cases.c.h" + #line 2396 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2415,17 +2400,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1695 "Python/bytecodes.c" + #line 1680 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (_PyDict_MergeEx(dict, update, 2) < 0) { format_kwargs_error(tstate, PEEK(3 + oparg), update); - #line 2424 "Python/generated_cases.c.h" + #line 2409 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1700 "Python/bytecodes.c" + #line 1685 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2429 "Python/generated_cases.c.h" + #line 2414 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2434,25 +2419,25 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1706 "Python/bytecodes.c" + #line 1691 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2444 "Python/generated_cases.c.h" + #line 2429 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1714 "Python/bytecodes.c" + #line 1699 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); - #line 2456 "Python/generated_cases.c.h" + #line 2441 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2463,7 +2448,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1728 "Python/bytecodes.c" + #line 1713 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2505,16 +2490,16 @@ } } } - #line 2509 "Python/generated_cases.c.h" + #line 2494 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1770 "Python/bytecodes.c" + #line 1755 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; - #line 2518 "Python/generated_cases.c.h" + #line 2503 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2529,20 +2514,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1789 "Python/bytecodes.c" + #line 1774 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2540 "Python/generated_cases.c.h" + #line 2525 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1796 "Python/bytecodes.c" + #line 1781 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2546 "Python/generated_cases.c.h" + #line 2531 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2557,7 +2542,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1800 "Python/bytecodes.c" + #line 1785 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2580,7 +2565,7 @@ res = res2; res2 = NULL; } - #line 2584 "Python/generated_cases.c.h" + #line 2569 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2594,7 +2579,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1839 "Python/bytecodes.c" + #line 1824 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2628,9 +2613,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2632 "Python/generated_cases.c.h" + #line 2617 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1873 "Python/bytecodes.c" + #line 1858 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2639,12 +2624,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2643 "Python/generated_cases.c.h" + #line 2628 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1882 "Python/bytecodes.c" + #line 1867 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2648 "Python/generated_cases.c.h" + #line 2633 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2658,7 +2643,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1891 "Python/bytecodes.c" + #line 1876 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2671,7 +2656,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2675 "Python/generated_cases.c.h" + #line 2660 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2686,7 +2671,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1907 "Python/bytecodes.c" + #line 1892 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2699,7 +2684,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2703 "Python/generated_cases.c.h" + #line 2688 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2714,7 +2699,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1923 "Python/bytecodes.c" + #line 1908 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2741,7 +2726,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2745 "Python/generated_cases.c.h" + #line 2730 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2756,7 +2741,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1953 "Python/bytecodes.c" + #line 1938 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2766,7 +2751,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2770 "Python/generated_cases.c.h" + #line 2755 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2781,7 +2766,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1966 "Python/bytecodes.c" + #line 1951 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2793,7 +2778,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2797 "Python/generated_cases.c.h" + #line 2782 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2807,7 +2792,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1981 "Python/bytecodes.c" + #line 1966 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2831,7 +2816,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2835 "Python/generated_cases.c.h" + #line 2820 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2839,7 +2824,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 2007 "Python/bytecodes.c" + #line 1992 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2865,7 +2850,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2869 "Python/generated_cases.c.h" + #line 2854 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2873,7 +2858,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2035 "Python/bytecodes.c" + #line 2020 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2891,7 +2876,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2895 "Python/generated_cases.c.h" + #line 2880 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2902,7 +2887,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 2055 "Python/bytecodes.c" + #line 2040 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2941,7 +2926,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2945 "Python/generated_cases.c.h" + #line 2930 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2952,7 +2937,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2096 "Python/bytecodes.c" + #line 2081 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2962,7 +2947,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2966 "Python/generated_cases.c.h" + #line 2951 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2974,7 +2959,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2115 "Python/bytecodes.c" + #line 2100 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2987,10 +2972,10 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 5) <= Py_GE); res = PyObject_RichCompare(left, right, oparg >> 5); - #line 2991 "Python/generated_cases.c.h" + #line 2976 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2128 "Python/bytecodes.c" + #line 2113 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; if (oparg & 16) { int res_bool = PyObject_IsTrue(res); @@ -2998,7 +2983,7 @@ if (res_bool < 0) goto pop_2_error; res = res_bool ? Py_True : Py_False; } - #line 3002 "Python/generated_cases.c.h" + #line 2987 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3009,7 +2994,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2138 "Python/bytecodes.c" + #line 2123 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3021,7 +3006,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3025 "Python/generated_cases.c.h" + #line 3010 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3032,7 +3017,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2153 "Python/bytecodes.c" + #line 2138 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -3048,7 +3033,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3052 "Python/generated_cases.c.h" + #line 3037 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3059,7 +3044,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2172 "Python/bytecodes.c" + #line 2157 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3072,7 +3057,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3076 "Python/generated_cases.c.h" + #line 3061 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3083,14 +3068,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2187 "Python/bytecodes.c" + #line 2172 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3089 "Python/generated_cases.c.h" + #line 3074 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2189 "Python/bytecodes.c" + #line 2174 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3094 "Python/generated_cases.c.h" + #line 3079 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3100,15 +3085,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2193 "Python/bytecodes.c" + #line 2178 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3106 "Python/generated_cases.c.h" + #line 3091 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2195 "Python/bytecodes.c" + #line 2180 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3112 "Python/generated_cases.c.h" + #line 3097 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3119,12 +3104,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2200 "Python/bytecodes.c" + #line 2185 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3125 "Python/generated_cases.c.h" + #line 3110 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2202 "Python/bytecodes.c" + #line 2187 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3132,10 +3117,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3136 "Python/generated_cases.c.h" + #line 3121 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2210 "Python/bytecodes.c" + #line 2195 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3144,7 +3129,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3148 "Python/generated_cases.c.h" + #line 3133 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3154,21 +3139,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2221 "Python/bytecodes.c" + #line 2206 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3161 "Python/generated_cases.c.h" + #line 3146 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2224 "Python/bytecodes.c" + #line 2209 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3168 "Python/generated_cases.c.h" + #line 3153 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2229 "Python/bytecodes.c" + #line 2214 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3172 "Python/generated_cases.c.h" + #line 3157 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3177,15 +3162,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2233 "Python/bytecodes.c" + #line 2218 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3184 "Python/generated_cases.c.h" + #line 3169 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2236 "Python/bytecodes.c" + #line 2221 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3189 "Python/generated_cases.c.h" + #line 3174 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3194,25 +3179,25 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2240 "Python/bytecodes.c" + #line 2225 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3202 "Python/generated_cases.c.h" + #line 3187 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2246 "Python/bytecodes.c" + #line 2231 "Python/bytecodes.c" JUMPBY(oparg); - #line 3211 "Python/generated_cases.c.h" + #line 3196 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2250 "Python/bytecodes.c" + #line 2235 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3230,13 +3215,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3234 "Python/generated_cases.c.h" + #line 3219 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2281 "Python/bytecodes.c" + #line 2266 "Python/bytecodes.c" PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255]; Py_INCREF(executor); @@ -3246,81 +3231,81 @@ goto error; } goto resume_frame; - #line 3250 "Python/generated_cases.c.h" + #line 3235 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2293 "Python/bytecodes.c" + #line 2278 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsFalse(cond)); - #line 3258 "Python/generated_cases.c.h" + #line 3243 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2298 "Python/bytecodes.c" + #line 2283 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsTrue(cond)); - #line 3268 "Python/generated_cases.c.h" + #line 3253 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2303 "Python/bytecodes.c" + #line 2288 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3277 "Python/generated_cases.c.h" + #line 3262 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2305 "Python/bytecodes.c" + #line 2290 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3282 "Python/generated_cases.c.h" + #line 3267 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2310 "Python/bytecodes.c" + #line 2295 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3294 "Python/generated_cases.c.h" + #line 3279 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2315 "Python/bytecodes.c" + #line 2300 "Python/bytecodes.c" } - #line 3298 "Python/generated_cases.c.h" + #line 3283 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2319 "Python/bytecodes.c" + #line 2304 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3311 "Python/generated_cases.c.h" + #line 3296 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2328 "Python/bytecodes.c" + #line 2313 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3324 "Python/generated_cases.c.h" + #line 3309 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3331,16 +3316,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2336 "Python/bytecodes.c" + #line 2321 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3340 "Python/generated_cases.c.h" + #line 3325 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2341 "Python/bytecodes.c" + #line 2326 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3348,7 +3333,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3352 "Python/generated_cases.c.h" + #line 3337 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3357,10 +3342,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2351 "Python/bytecodes.c" + #line 2336 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3364 "Python/generated_cases.c.h" + #line 3349 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3369,10 +3354,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2356 "Python/bytecodes.c" + #line 2341 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3376 "Python/generated_cases.c.h" + #line 3361 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3382,11 +3367,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2361 "Python/bytecodes.c" + #line 2346 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3390 "Python/generated_cases.c.h" + #line 3375 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3395,14 +3380,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2367 "Python/bytecodes.c" + #line 2352 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3402 "Python/generated_cases.c.h" + #line 3387 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2370 "Python/bytecodes.c" + #line 2355 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3406 "Python/generated_cases.c.h" + #line 3391 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3410,7 +3395,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2374 "Python/bytecodes.c" + #line 2359 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3433,11 +3418,11 @@ if (iter == NULL) { goto error; } - #line 3437 "Python/generated_cases.c.h" + #line 3422 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2397 "Python/bytecodes.c" + #line 2382 "Python/bytecodes.c" } - #line 3441 "Python/generated_cases.c.h" + #line 3426 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3447,7 +3432,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2415 "Python/bytecodes.c" + #line 2400 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3479,7 +3464,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3483 "Python/generated_cases.c.h" + #line 3468 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3487,7 +3472,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2449 "Python/bytecodes.c" + #line 2434 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3513,14 +3498,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3517 "Python/generated_cases.c.h" + #line 3502 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2477 "Python/bytecodes.c" + #line 2462 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3541,7 +3526,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3545 "Python/generated_cases.c.h" + #line 3530 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3551,7 +3536,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2500 "Python/bytecodes.c" + #line 2485 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3572,7 +3557,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3576 "Python/generated_cases.c.h" + #line 3561 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3582,7 +3567,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2523 "Python/bytecodes.c" + #line 2508 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3601,7 +3586,7 @@ if (next == NULL) { goto error; } - #line 3605 "Python/generated_cases.c.h" + #line 3590 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3610,7 +3595,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2544 "Python/bytecodes.c" + #line 2529 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3626,14 +3611,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3630 "Python/generated_cases.c.h" + #line 3615 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2562 "Python/bytecodes.c" + #line 2547 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3656,16 +3641,16 @@ Py_DECREF(enter); goto error; } - #line 3660 "Python/generated_cases.c.h" + #line 3645 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2585 "Python/bytecodes.c" + #line 2570 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3669 "Python/generated_cases.c.h" + #line 3654 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3676,7 +3661,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2594 "Python/bytecodes.c" + #line 2579 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3702,16 +3687,16 @@ Py_DECREF(enter); goto error; } - #line 3706 "Python/generated_cases.c.h" + #line 3691 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2620 "Python/bytecodes.c" + #line 2605 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3715 "Python/generated_cases.c.h" + #line 3700 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3723,7 +3708,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2629 "Python/bytecodes.c" + #line 2614 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3744,7 +3729,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3748 "Python/generated_cases.c.h" + #line 3733 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3753,7 +3738,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2668 "Python/bytecodes.c" + #line 2653 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3763,7 +3748,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3767 "Python/generated_cases.c.h" + #line 3752 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3777,7 +3762,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2680 "Python/bytecodes.c" + #line 2665 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3794,7 +3779,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3798 "Python/generated_cases.c.h" + #line 3783 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3808,7 +3793,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2699 "Python/bytecodes.c" + #line 2684 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3818,7 +3803,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3822 "Python/generated_cases.c.h" + #line 3807 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3832,7 +3817,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2711 "Python/bytecodes.c" + #line 2696 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3846,7 +3831,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3850 "Python/generated_cases.c.h" + #line 3835 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3855,16 +3840,16 @@ } TARGET(KW_NAMES) { - #line 2727 "Python/bytecodes.c" + #line 2712 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - #line 3863 "Python/generated_cases.c.h" + #line 3848 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2733 "Python/bytecodes.c" + #line 2718 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3877,7 +3862,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3881 "Python/generated_cases.c.h" + #line 3866 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3887,7 +3872,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2779 "Python/bytecodes.c" + #line 2764 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3969,7 +3954,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3973 "Python/generated_cases.c.h" + #line 3958 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3981,7 +3966,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2867 "Python/bytecodes.c" + #line 2852 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3991,7 +3976,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3995 "Python/generated_cases.c.h" + #line 3980 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -4000,7 +3985,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2879 "Python/bytecodes.c" + #line 2864 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4026,7 +4011,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4030 "Python/generated_cases.c.h" + #line 4015 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4034,7 +4019,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2907 "Python/bytecodes.c" + #line 2892 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4070,7 +4055,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4074 "Python/generated_cases.c.h" + #line 4059 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4078,7 +4063,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2945 "Python/bytecodes.c" + #line 2930 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4088,7 +4073,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4092 "Python/generated_cases.c.h" + #line 4077 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4101,7 +4086,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2957 "Python/bytecodes.c" + #line 2942 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4112,7 +4097,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4116 "Python/generated_cases.c.h" + #line 4101 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4126,7 +4111,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2971 "Python/bytecodes.c" + #line 2956 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4137,7 +4122,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4141 "Python/generated_cases.c.h" + #line 4126 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4150,7 +4135,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; - #line 2985 "Python/bytecodes.c" + #line 2970 "Python/bytecodes.c" /* This instruction does the following: * 1. Creates the object (by calling ``object.__new__``) * 2. Pushes a shim frame to the frame stack (to cleanup after ``__init__``) @@ -4200,12 +4185,12 @@ frame = cframe.current_frame = init_frame; CALL_STAT_INC(inlined_py_calls); goto start_frame; - #line 4204 "Python/generated_cases.c.h" + #line 4189 "Python/generated_cases.c.h" } TARGET(EXIT_INIT_CHECK) { PyObject *should_be_none = stack_pointer[-1]; - #line 3037 "Python/bytecodes.c" + #line 3022 "Python/bytecodes.c" assert(STACK_LEVEL() == 2); if (should_be_none != Py_None) { PyErr_Format(PyExc_TypeError, @@ -4213,7 +4198,7 @@ Py_TYPE(should_be_none)->tp_name); goto error; } - #line 4217 "Python/generated_cases.c.h" + #line 4202 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -4223,7 +4208,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3047 "Python/bytecodes.c" + #line 3032 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4245,7 +4230,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4249 "Python/generated_cases.c.h" + #line 4234 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4259,7 +4244,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3072 "Python/bytecodes.c" + #line 3057 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4287,7 +4272,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4291 "Python/generated_cases.c.h" + #line 4276 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4301,7 +4286,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3103 "Python/bytecodes.c" + #line 3088 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4333,7 +4318,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4337 "Python/generated_cases.c.h" + #line 4322 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4347,7 +4332,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3138 "Python/bytecodes.c" + #line 3123 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4379,7 +4364,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4383 "Python/generated_cases.c.h" + #line 4368 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4393,7 +4378,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3173 "Python/bytecodes.c" + #line 3158 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4418,7 +4403,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4422 "Python/generated_cases.c.h" + #line 4407 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4431,7 +4416,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3200 "Python/bytecodes.c" + #line 3185 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4458,7 +4443,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4462 "Python/generated_cases.c.h" + #line 4447 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4470,7 +4455,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3230 "Python/bytecodes.c" + #line 3215 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4488,14 +4473,14 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4492 "Python/generated_cases.c.h" + #line 4477 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3250 "Python/bytecodes.c" + #line 3235 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4526,7 +4511,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4530 "Python/generated_cases.c.h" + #line 4515 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4539,7 +4524,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3284 "Python/bytecodes.c" + #line 3269 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4568,7 +4553,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4572 "Python/generated_cases.c.h" + #line 4557 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4581,7 +4566,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3316 "Python/bytecodes.c" + #line 3301 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4610,7 +4595,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4614 "Python/generated_cases.c.h" + #line 4599 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4623,7 +4608,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3348 "Python/bytecodes.c" + #line 3333 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4651,7 +4636,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4655 "Python/generated_cases.c.h" + #line 4640 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4661,9 +4646,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3379 "Python/bytecodes.c" + #line 3364 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4667 "Python/generated_cases.c.h" + #line 4652 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4672,7 +4657,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3383 "Python/bytecodes.c" + #line 3368 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4734,14 +4719,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4738 "Python/generated_cases.c.h" + #line 4723 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3445 "Python/bytecodes.c" + #line 3430 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4745 "Python/generated_cases.c.h" + #line 4730 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4752,7 +4737,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3451 "Python/bytecodes.c" + #line 3436 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4764,7 +4749,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4768 "Python/generated_cases.c.h" + #line 4753 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4772,7 +4757,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3465 "Python/bytecodes.c" + #line 3450 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4797,14 +4782,14 @@ default: Py_UNREACHABLE(); } - #line 4801 "Python/generated_cases.c.h" + #line 4786 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3492 "Python/bytecodes.c" + #line 3477 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4825,7 +4810,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4829 "Python/generated_cases.c.h" + #line 4814 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4833,15 +4818,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3515 "Python/bytecodes.c" + #line 3500 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4839 "Python/generated_cases.c.h" + #line 4824 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3517 "Python/bytecodes.c" + #line 3502 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4845 "Python/generated_cases.c.h" + #line 4830 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4851,14 +4836,14 @@ TARGET(CONVERT_VALUE) { PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3521 "Python/bytecodes.c" + #line 3506 "Python/bytecodes.c" convertion_func_ptr conv_fn; assert(oparg >= FVC_STR && oparg <= FVC_ASCII); conv_fn = CONVERSION_FUNCTIONS[oparg]; result = conv_fn(value); Py_DECREF(value); if (result == NULL) goto pop_1_error; - #line 4862 "Python/generated_cases.c.h" + #line 4847 "Python/generated_cases.c.h" stack_pointer[-1] = result; DISPATCH(); } @@ -4866,7 +4851,7 @@ TARGET(FORMAT_SIMPLE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 3530 "Python/bytecodes.c" + #line 3515 "Python/bytecodes.c" /* If value is a unicode object, then we know the result * of format(value) is value itself. */ if (!PyUnicode_CheckExact(value)) { @@ -4877,7 +4862,7 @@ else { res = value; } - #line 4881 "Python/generated_cases.c.h" + #line 4866 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -4886,12 +4871,12 @@ PyObject *fmt_spec = stack_pointer[-1]; PyObject *value = stack_pointer[-2]; PyObject *res; - #line 3543 "Python/bytecodes.c" + #line 3528 "Python/bytecodes.c" res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); if (res == NULL) goto pop_2_error; - #line 4895 "Python/generated_cases.c.h" + #line 4880 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -4900,10 +4885,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3550 "Python/bytecodes.c" + #line 3535 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4907 "Python/generated_cases.c.h" + #line 4892 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4915,7 +4900,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3555 "Python/bytecodes.c" + #line 3540 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4930,12 +4915,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4934 "Python/generated_cases.c.h" + #line 4919 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3570 "Python/bytecodes.c" + #line 3555 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4939 "Python/generated_cases.c.h" + #line 4924 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4945,16 +4930,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3575 "Python/bytecodes.c" + #line 3560 "Python/bytecodes.c" assert(oparg >= 2); - #line 4951 "Python/generated_cases.c.h" + #line 4936 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3579 "Python/bytecodes.c" + #line 3564 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4966,54 +4951,48 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4970 "Python/generated_cases.c.h" + #line 4955 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3593 "Python/bytecodes.c" + #line 3578 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4976 "Python/generated_cases.c.h" + #line 4961 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3597 "Python/bytecodes.c" + #line 3582 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4983 "Python/generated_cases.c.h" + #line 4968 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3602 "Python/bytecodes.c" + #line 3587 "Python/bytecodes.c" PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); // XXX - Py_DECREF(cond); - if (err < 0) goto error; - _Py_CODEUNIT *here = next_instr-1; - assert(err == 0 || err == 1); - int offset = err*oparg; + assert(PyBool_Check(cond)); + _Py_CODEUNIT *here = next_instr - 1; + int offset = Py_IsTrue(cond) * oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4998 "Python/generated_cases.c.h" + #line 4980 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3613 "Python/bytecodes.c" + #line 3595 "Python/bytecodes.c" PyObject *cond = POP(); - int err = PyObject_IsTrue(cond); // XXX - Py_DECREF(cond); - if (err < 0) goto error; - _Py_CODEUNIT *here = next_instr-1; - assert(err == 0 || err == 1); - int offset = (1-err)*oparg; + assert(PyBool_Check(cond)); + _Py_CODEUNIT *here = next_instr - 1; + int offset = Py_IsFalse(cond) * oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 5012 "Python/generated_cases.c.h" + #line 4991 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3624 "Python/bytecodes.c" + #line 3603 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -5025,12 +5004,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 5029 "Python/generated_cases.c.h" + #line 5008 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3638 "Python/bytecodes.c" + #line 3617 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -5039,33 +5018,33 @@ } else { Py_DECREF(value); - offset = oparg; + offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 5046 "Python/generated_cases.c.h" + #line 5025 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3652 "Python/bytecodes.c" + #line 3631 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 5057 "Python/generated_cases.c.h" + #line 5036 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3660 "Python/bytecodes.c" + #line 3639 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 5064 "Python/generated_cases.c.h" + #line 5043 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3665 "Python/bytecodes.c" + #line 3644 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 5071 "Python/generated_cases.c.h" + #line 5050 "Python/generated_cases.c.h" } diff --git a/Python/specialize.c b/Python/specialize.c index 310e7a35e0c760..63afb2c377a575 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -449,9 +449,9 @@ _PyCode_Quicken(PyCodeObject *code) #define SPEC_FAIL_TO_BOOL_DICT 11 #define SPEC_FAIL_TO_BOOL_FLOAT 12 #define SPEC_FAIL_TO_BOOL_MAPPING 13 -#define SPEC_FAIL_TO_BOOL_NUMBER 14 -#define SPEC_FAIL_TO_BOOL_SEQUENCE 15 -#define SPEC_FAIL_TO_BOOL_MEMORY_VIEW 16 +#define SPEC_FAIL_TO_BOOL_MEMORY_VIEW 14 +#define SPEC_FAIL_TO_BOOL_NUMBER 15 +#define SPEC_FAIL_TO_BOOL_SEQUENCE 16 #define SPEC_FAIL_TO_BOOL_SET 17 #define SPEC_FAIL_TO_BOOL_TUPLE 18 From 9aa83b5ef2259f12203218710a1b9085e980f3b4 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Jun 2023 17:37:50 -0700 Subject: [PATCH 12/15] blurb add --- .../2023-06-22-17-37-35.gh-issue-106003.2Vc_Tw.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-06-22-17-37-35.gh-issue-106003.2Vc_Tw.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-06-22-17-37-35.gh-issue-106003.2Vc_Tw.rst b/Misc/NEWS.d/next/Core and Builtins/2023-06-22-17-37-35.gh-issue-106003.2Vc_Tw.rst new file mode 100644 index 00000000000000..47143f7eb8f383 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-06-22-17-37-35.gh-issue-106003.2Vc_Tw.rst @@ -0,0 +1,5 @@ +Add a new :opcode:`TO_BOOL` instruction, which performs boolean conversions +for :opcode:`POP_JUMP_IF_TRUE`, :opcode:`POP_JUMP_IF_FALSE`, and +:opcode:`UNARY_NOT` (which all expect exact :class:`bool` values now). Also, +modify the oparg of :opcode:`COMPARE_OP` to include an optional "boolean +conversion" flag. From a76f11dcceb1ba9d28e72d21f2a8eccf0fc16507 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 22 Jun 2023 17:43:30 -0700 Subject: [PATCH 13/15] Docs --- Doc/library/dis.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index bf6ab0acedbecf..e1059acfb23a5b 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -529,6 +529,9 @@ result back on the stack. Implements ``STACK[-1] = not STACK[-1]``. + .. versionchanged:: 3.13 + This instruction now requires an exact :class:`bool` operand. + .. opcode:: UNARY_INVERT @@ -548,6 +551,13 @@ result back on the stack. .. versionadded:: 3.5 +.. opcode:: TO_BOOL + + Implements ``STACK[-1] = bool(STACK[-1])``. + + .. versionadded:: 3.13 + + **Binary and in-place operations** Binary operations remove the top two items from the stack (``STACK[-1]`` and @@ -1130,6 +1140,10 @@ iterations of the loop. ``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set (``opname & 16``), the result should be coerced to ``bool``. + .. versionchanged:: 3.13 + The fifth-lowest bit of the oparg now indicates a forced conversion to + :class:`bool`. + .. opcode:: IS_OP (invert) @@ -1192,6 +1206,9 @@ iterations of the loop. .. versionchanged:: 3.12 This is no longer a pseudo-instruction. + .. versionchanged:: 3.13 + This instruction now requires an exact :class:`bool` operand. + .. opcode:: POP_JUMP_IF_FALSE (delta) If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. @@ -1205,6 +1222,9 @@ iterations of the loop. .. versionchanged:: 3.12 This is no longer a pseudo-instruction. + .. versionchanged:: 3.13 + This instruction now requires an exact :class:`bool` operand. + .. opcode:: POP_JUMP_IF_NOT_NONE (delta) If ``STACK[-1]`` is not ``None``, increments the bytecode counter by *delta*. From c2d4a33f51c200f3c70c3b4f84fd808ecd122b3b Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 23 Jun 2023 15:06:30 -0700 Subject: [PATCH 14/15] Clean up some commnts --- Python/bytecodes.c | 9 +- Python/generated_cases.c.h | 979 ++++++++++++++++++------------------- 2 files changed, 491 insertions(+), 497 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index c0897ec23820eb..90efc9ffbdf876 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -316,7 +316,6 @@ dummy_func( } inst(TO_BOOL_BOOL, (unused/1, unused/2, value -- value)) { - // Coolest (and dumbest-named) specialization ever: DEOPT_IF(!PyBool_Check(value), TO_BOOL); STAT_INC(TO_BOOL, hit); } @@ -342,8 +341,7 @@ dummy_func( } inst(TO_BOOL_NONE, (unused/1, unused/2, value -- res)) { - // This one is a bit weird, because we expect *some* failures... - // it might be worth combining with TO_BOOL_ALWAYS_TRUE somehow: + // This one is a bit weird, because we expect *some* failures: DEOPT_IF(!Py_IsNone(value), TO_BOOL); STAT_INC(TO_BOOL, hit); res = Py_False; @@ -352,7 +350,7 @@ dummy_func( inst(TO_BOOL_STR, (unused/1, unused/2, value -- res)) { DEOPT_IF(!PyUnicode_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); - if (Py_Is(value, &_Py_STR(empty))) { + if (value == &_Py_STR(empty)) { assert(_Py_IsImmortal(value)); res = Py_False; } @@ -364,8 +362,7 @@ dummy_func( } inst(TO_BOOL_ALWAYS_TRUE, (unused/1, version/2, value -- res)) { - // This one is a bit weird, because we expect *some* failures... - // it might be worth combining with TO_BOOL_NONE somehow: + // This one is a bit weird, because we expect *some* failures: assert(version); DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); STAT_INC(TO_BOOL, hit); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index bf146ef56a15d4..cd828dcfbccf77 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -311,10 +311,9 @@ TARGET(TO_BOOL_BOOL) { PyObject *value = stack_pointer[-1]; #line 319 "Python/bytecodes.c" - // Coolest (and dumbest-named) specialization ever: DEOPT_IF(!PyBool_Check(value), TO_BOOL); STAT_INC(TO_BOOL, hit); - #line 318 "Python/generated_cases.c.h" + #line 317 "Python/generated_cases.c.h" next_instr += 3; DISPATCH(); } @@ -322,7 +321,7 @@ TARGET(TO_BOOL_INT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 325 "Python/bytecodes.c" + #line 324 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); if (_PyLong_IsZero((PyLongObject *)value)) { @@ -330,12 +329,12 @@ res = Py_False; } else { - #line 334 "Python/generated_cases.c.h" + #line 333 "Python/generated_cases.c.h" Py_DECREF(value); - #line 333 "Python/bytecodes.c" + #line 332 "Python/bytecodes.c" res = Py_True; } - #line 339 "Python/generated_cases.c.h" + #line 338 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -344,11 +343,11 @@ TARGET(TO_BOOL_LIST) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 338 "Python/bytecodes.c" + #line 337 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); res = Py_SIZE(value) ? Py_True : Py_False; - #line 352 "Python/generated_cases.c.h" + #line 351 "Python/generated_cases.c.h" Py_DECREF(value); stack_pointer[-1] = res; next_instr += 3; @@ -358,13 +357,12 @@ TARGET(TO_BOOL_NONE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 345 "Python/bytecodes.c" - // This one is a bit weird, because we expect *some* failures... - // it might be worth combining with TO_BOOL_ALWAYS_TRUE somehow: + #line 344 "Python/bytecodes.c" + // This one is a bit weird, because we expect *some* failures: DEOPT_IF(!Py_IsNone(value), TO_BOOL); STAT_INC(TO_BOOL, hit); res = Py_False; - #line 368 "Python/generated_cases.c.h" + #line 366 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -373,21 +371,21 @@ TARGET(TO_BOOL_STR) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 353 "Python/bytecodes.c" + #line 351 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(value), TO_BOOL); STAT_INC(TO_BOOL, hit); - if (Py_Is(value, &_Py_STR(empty))) { + if (value == &_Py_STR(empty)) { assert(_Py_IsImmortal(value)); res = Py_False; } else { assert(Py_SIZE(value)); - #line 386 "Python/generated_cases.c.h" + #line 384 "Python/generated_cases.c.h" Py_DECREF(value); - #line 362 "Python/bytecodes.c" + #line 360 "Python/bytecodes.c" res = Py_True; } - #line 391 "Python/generated_cases.c.h" + #line 389 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -397,17 +395,16 @@ PyObject *value = stack_pointer[-1]; PyObject *res; uint32_t version = read_u32(&next_instr[1].cache); - #line 367 "Python/bytecodes.c" - // This one is a bit weird, because we expect *some* failures... - // it might be worth combining with TO_BOOL_NONE somehow: + #line 365 "Python/bytecodes.c" + // This one is a bit weird, because we expect *some* failures: assert(version); DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); STAT_INC(TO_BOOL, hit); - #line 407 "Python/generated_cases.c.h" + #line 404 "Python/generated_cases.c.h" Py_DECREF(value); - #line 373 "Python/bytecodes.c" + #line 370 "Python/bytecodes.c" res = Py_True; - #line 411 "Python/generated_cases.c.h" + #line 408 "Python/generated_cases.c.h" stack_pointer[-1] = res; next_instr += 3; DISPATCH(); @@ -416,13 +413,13 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 377 "Python/bytecodes.c" + #line 374 "Python/bytecodes.c" res = PyNumber_Invert(value); - #line 422 "Python/generated_cases.c.h" + #line 419 "Python/generated_cases.c.h" Py_DECREF(value); - #line 379 "Python/bytecodes.c" + #line 376 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 426 "Python/generated_cases.c.h" + #line 423 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -433,10 +430,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 395 "Python/bytecodes.c" + #line 392 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 440 "Python/generated_cases.c.h" + #line 437 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -444,13 +441,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 400 "Python/bytecodes.c" + #line 397 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 454 "Python/generated_cases.c.h" + #line 451 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -465,10 +462,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 395 "Python/bytecodes.c" + #line 392 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 472 "Python/generated_cases.c.h" + #line 469 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -476,13 +473,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 408 "Python/bytecodes.c" + #line 405 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 486 "Python/generated_cases.c.h" + #line 483 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -497,10 +494,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 395 "Python/bytecodes.c" + #line 392 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); - #line 504 "Python/generated_cases.c.h" + #line 501 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -508,13 +505,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 416 "Python/bytecodes.c" + #line 413 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (res == NULL) goto pop_2_error; - #line 518 "Python/generated_cases.c.h" + #line 515 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -529,10 +526,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 431 "Python/bytecodes.c" + #line 428 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 536 "Python/generated_cases.c.h" + #line 533 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -540,13 +537,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 436 "Python/bytecodes.c" + #line 433 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 550 "Python/generated_cases.c.h" + #line 547 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -561,10 +558,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 431 "Python/bytecodes.c" + #line 428 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 568 "Python/generated_cases.c.h" + #line 565 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -572,13 +569,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 444 "Python/bytecodes.c" + #line 441 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 582 "Python/generated_cases.c.h" + #line 579 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -593,10 +590,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 431 "Python/bytecodes.c" + #line 428 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); - #line 600 "Python/generated_cases.c.h" + #line 597 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -604,13 +601,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 452 "Python/bytecodes.c" + #line 449 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dres, res); - #line 614 "Python/generated_cases.c.h" + #line 611 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -625,10 +622,10 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 467 "Python/bytecodes.c" + #line 464 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 632 "Python/generated_cases.c.h" + #line 629 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } @@ -636,13 +633,13 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 472 "Python/bytecodes.c" + #line 469 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; - #line 646 "Python/generated_cases.c.h" + #line 643 "Python/generated_cases.c.h" _tmp_2 = res; } next_instr += 1; @@ -657,17 +654,17 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 467 "Python/bytecodes.c" + #line 464 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); - #line 664 "Python/generated_cases.c.h" + #line 661 "Python/generated_cases.c.h" _tmp_2 = left; _tmp_1 = right; } { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 489 "Python/bytecodes.c" + #line 486 "Python/bytecodes.c" _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; assert(true_next.op.code == STORE_FAST); PyObject **target_local = &GETLOCAL(true_next.op.arg); @@ -691,7 +688,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_OP + 1); - #line 695 "Python/generated_cases.c.h" + #line 692 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -703,7 +700,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 526 "Python/bytecodes.c" + #line 523 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -715,12 +712,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); - #line 719 "Python/generated_cases.c.h" + #line 716 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 538 "Python/bytecodes.c" + #line 535 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 724 "Python/generated_cases.c.h" + #line 721 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -732,7 +729,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 542 "Python/bytecodes.c" + #line 539 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -745,7 +742,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; - #line 749 "Python/generated_cases.c.h" + #line 746 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -756,7 +753,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 557 "Python/bytecodes.c" + #line 554 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -769,7 +766,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; - #line 773 "Python/generated_cases.c.h" + #line 770 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -778,7 +775,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 572 "Python/bytecodes.c" + #line 569 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -792,7 +789,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 796 "Python/generated_cases.c.h" + #line 793 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -803,7 +800,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 588 "Python/bytecodes.c" + #line 585 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -817,7 +814,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); - #line 821 "Python/generated_cases.c.h" + #line 818 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -828,7 +825,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 604 "Python/bytecodes.c" + #line 601 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -836,14 +833,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } - #line 840 "Python/generated_cases.c.h" + #line 837 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 612 "Python/bytecodes.c" + #line 609 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub - #line 847 "Python/generated_cases.c.h" + #line 844 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -855,7 +852,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 619 "Python/bytecodes.c" + #line 616 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -878,15 +875,15 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 882 "Python/generated_cases.c.h" + #line 879 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 644 "Python/bytecodes.c" + #line 641 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; - #line 890 "Python/generated_cases.c.h" + #line 887 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -894,13 +891,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 648 "Python/bytecodes.c" + #line 645 "Python/bytecodes.c" int err = PySet_Add(set, v); - #line 900 "Python/generated_cases.c.h" + #line 897 "Python/generated_cases.c.h" Py_DECREF(v); - #line 650 "Python/bytecodes.c" + #line 647 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 904 "Python/generated_cases.c.h" + #line 901 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -912,7 +909,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 660 "Python/bytecodes.c" + #line 657 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -927,13 +924,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); - #line 931 "Python/generated_cases.c.h" + #line 928 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 675 "Python/bytecodes.c" + #line 672 "Python/bytecodes.c" if (err) goto pop_3_error; - #line 937 "Python/generated_cases.c.h" + #line 934 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -943,7 +940,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 679 "Python/bytecodes.c" + #line 676 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -960,7 +957,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); - #line 964 "Python/generated_cases.c.h" + #line 961 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -970,13 +967,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 698 "Python/bytecodes.c" + #line 695 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; - #line 980 "Python/generated_cases.c.h" + #line 977 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -985,15 +982,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 706 "Python/bytecodes.c" + #line 703 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); - #line 992 "Python/generated_cases.c.h" + #line 989 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 709 "Python/bytecodes.c" + #line 706 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 997 "Python/generated_cases.c.h" + #line 994 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1001,14 +998,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 713 "Python/bytecodes.c" + #line 710 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); - #line 1008 "Python/generated_cases.c.h" + #line 1005 "Python/generated_cases.c.h" Py_DECREF(value); - #line 716 "Python/bytecodes.c" + #line 713 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; - #line 1012 "Python/generated_cases.c.h" + #line 1009 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -1017,15 +1014,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 720 "Python/bytecodes.c" + #line 717 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); - #line 1024 "Python/generated_cases.c.h" + #line 1021 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 723 "Python/bytecodes.c" + #line 720 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 1029 "Python/generated_cases.c.h" + #line 1026 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -1033,7 +1030,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 727 "Python/bytecodes.c" + #line 724 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -1051,12 +1048,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } - #line 1055 "Python/generated_cases.c.h" + #line 1052 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 747 "Python/bytecodes.c" + #line 744 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); /* Restore previous cframe and return. */ @@ -1065,12 +1062,12 @@ assert(!_PyErr_Occurred(tstate)); _Py_LeaveRecursiveCallTstate(tstate); return retval; - #line 1069 "Python/generated_cases.c.h" + #line 1066 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 758 "Python/bytecodes.c" + #line 755 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1083,12 +1080,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1087 "Python/generated_cases.c.h" + #line 1084 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 773 "Python/bytecodes.c" + #line 770 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1105,11 +1102,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1109 "Python/generated_cases.c.h" + #line 1106 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { - #line 792 "Python/bytecodes.c" + #line 789 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1123,11 +1120,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1127 "Python/generated_cases.c.h" + #line 1124 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 808 "Python/bytecodes.c" + #line 805 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1145,13 +1142,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1149 "Python/generated_cases.c.h" + #line 1146 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 828 "Python/bytecodes.c" + #line 825 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1164,16 +1161,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); - #line 1168 "Python/generated_cases.c.h" + #line 1165 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 841 "Python/bytecodes.c" + #line 838 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); - #line 1175 "Python/generated_cases.c.h" + #line 1172 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 846 "Python/bytecodes.c" + #line 843 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1186,7 +1183,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } - #line 1190 "Python/generated_cases.c.h" + #line 1187 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1194,7 +1191,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 861 "Python/bytecodes.c" + #line 858 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1237,7 +1234,7 @@ Py_DECREF(next_iter); } } - #line 1241 "Python/generated_cases.c.h" + #line 1238 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; DISPATCH(); @@ -1246,16 +1243,16 @@ TARGET(GET_AWAITABLE) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 906 "Python/bytecodes.c" + #line 903 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } - #line 1257 "Python/generated_cases.c.h" + #line 1254 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 913 "Python/bytecodes.c" + #line 910 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1272,7 +1269,7 @@ } if (iter == NULL) goto pop_1_error; - #line 1276 "Python/generated_cases.c.h" + #line 1273 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -1283,7 +1280,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 937 "Python/bytecodes.c" + #line 934 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1330,7 +1327,7 @@ } } Py_DECREF(v); - #line 1334 "Python/generated_cases.c.h" + #line 1331 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1339,7 +1336,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 986 "Python/bytecodes.c" + #line 983 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1355,12 +1352,12 @@ tstate->exc_info = &gen->gi_exc_state; SKIP_OVER(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); - #line 1359 "Python/generated_cases.c.h" + #line 1356 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1004 "Python/bytecodes.c" + #line 1001 "Python/bytecodes.c" assert(frame != &entry_frame); assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ PyGenObject *gen = _PyFrame_GetGenerator(frame); @@ -1378,12 +1375,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1382 "Python/generated_cases.c.h" + #line 1379 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 1024 "Python/bytecodes.c" + #line 1021 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1400,15 +1397,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1404 "Python/generated_cases.c.h" + #line 1401 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 1043 "Python/bytecodes.c" + #line 1040 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1412 "Python/generated_cases.c.h" + #line 1409 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1416,7 +1413,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 1048 "Python/bytecodes.c" + #line 1045 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1434,26 +1431,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1438 "Python/generated_cases.c.h" + #line 1435 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 1068 "Python/bytecodes.c" + #line 1065 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1447 "Python/generated_cases.c.h" + #line 1444 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 1071 "Python/bytecodes.c" + #line 1068 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1457 "Python/generated_cases.c.h" + #line 1454 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1464,23 +1461,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1080 "Python/bytecodes.c" + #line 1077 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1473 "Python/generated_cases.c.h" + #line 1470 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1085 "Python/bytecodes.c" + #line 1082 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1484 "Python/generated_cases.c.h" + #line 1481 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1489,9 +1486,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1094 "Python/bytecodes.c" + #line 1091 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1495 "Python/generated_cases.c.h" + #line 1492 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1499,7 +1496,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1098 "Python/bytecodes.c" + #line 1095 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1521,7 +1518,7 @@ if (true) goto error; } } - #line 1525 "Python/generated_cases.c.h" + #line 1522 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1529,33 +1526,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1123 "Python/bytecodes.c" + #line 1120 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1540 "Python/generated_cases.c.h" + #line 1537 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1130 "Python/bytecodes.c" + #line 1127 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1549 "Python/generated_cases.c.h" + #line 1546 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1137 "Python/bytecodes.c" + #line 1134 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1553 "Python/generated_cases.c.h" + #line 1550 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1141 "Python/bytecodes.c" + #line 1138 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; @@ -1572,7 +1569,7 @@ name); goto error; } - #line 1576 "Python/generated_cases.c.h" + #line 1573 "Python/generated_cases.c.h" DISPATCH(); } @@ -1580,7 +1577,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1167 "Python/bytecodes.c" + #line 1164 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1593,11 +1590,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1597 "Python/generated_cases.c.h" + #line 1594 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1180 "Python/bytecodes.c" + #line 1177 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1601 "Python/generated_cases.c.h" + #line 1598 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1607,14 +1604,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1184 "Python/bytecodes.c" + #line 1181 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1618 "Python/generated_cases.c.h" + #line 1615 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1625,7 +1622,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1194 "Python/bytecodes.c" + #line 1191 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1633,7 +1630,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1637 "Python/generated_cases.c.h" + #line 1634 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1644,7 +1641,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1205 "Python/bytecodes.c" + #line 1202 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1652,7 +1649,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1656 "Python/generated_cases.c.h" + #line 1653 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1662,15 +1659,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1216 "Python/bytecodes.c" + #line 1213 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); - #line 1670 "Python/generated_cases.c.h" + #line 1667 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1220 "Python/bytecodes.c" + #line 1217 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1674 "Python/generated_cases.c.h" + #line 1671 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1681,7 +1678,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1231 "Python/bytecodes.c" + #line 1228 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); @@ -1697,12 +1694,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1701 "Python/generated_cases.c.h" + #line 1698 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1247 "Python/bytecodes.c" + #line 1244 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1706 "Python/generated_cases.c.h" + #line 1703 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1710,34 +1707,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1251 "Python/bytecodes.c" + #line 1248 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1717 "Python/generated_cases.c.h" + #line 1714 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1254 "Python/bytecodes.c" + #line 1251 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1721 "Python/generated_cases.c.h" + #line 1718 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1258 "Python/bytecodes.c" + #line 1255 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1731 "Python/generated_cases.c.h" + #line 1728 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1261 "Python/bytecodes.c" + #line 1258 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1735 "Python/generated_cases.c.h" + #line 1732 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1265 "Python/bytecodes.c" + #line 1262 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1749,7 +1746,7 @@ } goto error; } - #line 1753 "Python/generated_cases.c.h" + #line 1750 "Python/generated_cases.c.h" DISPATCH(); } @@ -1757,7 +1754,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1279 "Python/bytecodes.c" + #line 1276 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1765,7 +1762,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1769 "Python/generated_cases.c.h" + #line 1766 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1777,7 +1774,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1279 "Python/bytecodes.c" + #line 1276 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1785,13 +1782,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1789 "Python/generated_cases.c.h" + #line 1786 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1291 "Python/bytecodes.c" + #line 1288 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1848,7 +1845,7 @@ } } } - #line 1852 "Python/generated_cases.c.h" + #line 1849 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1861,7 +1858,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1291 "Python/bytecodes.c" + #line 1288 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1918,7 +1915,7 @@ } } } - #line 1922 "Python/generated_cases.c.h" + #line 1919 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1930,7 +1927,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1360 "Python/bytecodes.c" + #line 1357 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1982,7 +1979,7 @@ } } null = NULL; - #line 1986 "Python/generated_cases.c.h" + #line 1983 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1996,7 +1993,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1414 "Python/bytecodes.c" + #line 1411 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -2007,7 +2004,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2011 "Python/generated_cases.c.h" + #line 2008 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2022,7 +2019,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1427 "Python/bytecodes.c" + #line 1424 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -2037,7 +2034,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 2041 "Python/generated_cases.c.h" + #line 2038 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2047,16 +2044,16 @@ } TARGET(DELETE_FAST) { - #line 1444 "Python/bytecodes.c" + #line 1441 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 2055 "Python/generated_cases.c.h" + #line 2052 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1450 "Python/bytecodes.c" + #line 1447 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -2065,12 +2062,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2069 "Python/generated_cases.c.h" + #line 2066 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1461 "Python/bytecodes.c" + #line 1458 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2081,14 +2078,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2085 "Python/generated_cases.c.h" + #line 2082 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1474 "Python/bytecodes.c" + #line 1471 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus); @@ -2123,14 +2120,14 @@ } Py_INCREF(value); } - #line 2127 "Python/generated_cases.c.h" + #line 2124 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1511 "Python/bytecodes.c" + #line 1508 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2138,7 +2135,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2142 "Python/generated_cases.c.h" + #line 2139 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2146,18 +2143,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1521 "Python/bytecodes.c" + #line 1518 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2155 "Python/generated_cases.c.h" + #line 2152 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1528 "Python/bytecodes.c" + #line 1525 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = _PyFrame_GetCode(frame); assert(PyFunction_Check(frame->f_funcobj)); @@ -2168,22 +2165,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2172 "Python/generated_cases.c.h" + #line 2169 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1541 "Python/bytecodes.c" + #line 1538 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2181 "Python/generated_cases.c.h" + #line 2178 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1543 "Python/bytecodes.c" + #line 1540 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2187 "Python/generated_cases.c.h" + #line 2184 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2193,10 +2190,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1547 "Python/bytecodes.c" + #line 1544 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2200 "Python/generated_cases.c.h" + #line 2197 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2206,10 +2203,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1552 "Python/bytecodes.c" + #line 1549 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2213 "Python/generated_cases.c.h" + #line 2210 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2219,7 +2216,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1557 "Python/bytecodes.c" + #line 1554 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2230,13 +2227,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2234 "Python/generated_cases.c.h" + #line 2231 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1568 "Python/bytecodes.c" + #line 1565 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2240 "Python/generated_cases.c.h" + #line 2237 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2245,13 +2242,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1575 "Python/bytecodes.c" + #line 1572 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2251 "Python/generated_cases.c.h" + #line 2248 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1577 "Python/bytecodes.c" + #line 1574 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2255 "Python/generated_cases.c.h" + #line 2252 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2259,7 +2256,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1581 "Python/bytecodes.c" + #line 1578 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2274,7 +2271,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2278 "Python/generated_cases.c.h" + #line 2275 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2284,7 +2281,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1598 "Python/bytecodes.c" + #line 1595 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2292,13 +2289,13 @@ if (map == NULL) goto error; - #line 2296 "Python/generated_cases.c.h" + #line 2293 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1606 "Python/bytecodes.c" + #line 1603 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2302 "Python/generated_cases.c.h" + #line 2299 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2306,7 +2303,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1610 "Python/bytecodes.c" + #line 1607 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2346,7 +2343,7 @@ Py_DECREF(ann_dict); } } - #line 2350 "Python/generated_cases.c.h" + #line 2347 "Python/generated_cases.c.h" DISPATCH(); } @@ -2354,7 +2351,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1652 "Python/bytecodes.c" + #line 1649 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2364,14 +2361,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2368 "Python/generated_cases.c.h" + #line 2365 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1662 "Python/bytecodes.c" + #line 1659 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2375 "Python/generated_cases.c.h" + #line 2372 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2379,7 +2376,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1666 "Python/bytecodes.c" + #line 1663 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -2387,12 +2384,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2391 "Python/generated_cases.c.h" + #line 2388 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1674 "Python/bytecodes.c" + #line 1671 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2396 "Python/generated_cases.c.h" + #line 2393 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2400,17 +2397,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1680 "Python/bytecodes.c" + #line 1677 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (_PyDict_MergeEx(dict, update, 2) < 0) { format_kwargs_error(tstate, PEEK(3 + oparg), update); - #line 2409 "Python/generated_cases.c.h" + #line 2406 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1685 "Python/bytecodes.c" + #line 1682 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2414 "Python/generated_cases.c.h" + #line 2411 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2419,25 +2416,25 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1691 "Python/bytecodes.c" + #line 1688 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2429 "Python/generated_cases.c.h" + #line 2426 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1699 "Python/bytecodes.c" + #line 1696 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); - #line 2441 "Python/generated_cases.c.h" + #line 2438 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2448,7 +2445,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1713 "Python/bytecodes.c" + #line 1710 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2490,16 +2487,16 @@ } } } - #line 2494 "Python/generated_cases.c.h" + #line 2491 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1755 "Python/bytecodes.c" + #line 1752 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; - #line 2503 "Python/generated_cases.c.h" + #line 2500 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2514,20 +2511,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1774 "Python/bytecodes.c" + #line 1771 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2525 "Python/generated_cases.c.h" + #line 2522 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1781 "Python/bytecodes.c" + #line 1778 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2531 "Python/generated_cases.c.h" + #line 2528 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2542,7 +2539,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1785 "Python/bytecodes.c" + #line 1782 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2565,7 +2562,7 @@ res = res2; res2 = NULL; } - #line 2569 "Python/generated_cases.c.h" + #line 2566 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2579,7 +2576,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1824 "Python/bytecodes.c" + #line 1821 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2613,9 +2610,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2617 "Python/generated_cases.c.h" + #line 2614 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1858 "Python/bytecodes.c" + #line 1855 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2624,12 +2621,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2628 "Python/generated_cases.c.h" + #line 2625 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1867 "Python/bytecodes.c" + #line 1864 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2633 "Python/generated_cases.c.h" + #line 2630 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2643,7 +2640,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1876 "Python/bytecodes.c" + #line 1873 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2656,7 +2653,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2660 "Python/generated_cases.c.h" + #line 2657 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2671,7 +2668,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1892 "Python/bytecodes.c" + #line 1889 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2684,7 +2681,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2688 "Python/generated_cases.c.h" + #line 2685 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2699,7 +2696,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1908 "Python/bytecodes.c" + #line 1905 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2726,7 +2723,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2730 "Python/generated_cases.c.h" + #line 2727 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2741,7 +2738,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1938 "Python/bytecodes.c" + #line 1935 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2751,7 +2748,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2755 "Python/generated_cases.c.h" + #line 2752 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2766,7 +2763,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1951 "Python/bytecodes.c" + #line 1948 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2778,7 +2775,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2782 "Python/generated_cases.c.h" + #line 2779 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2792,7 +2789,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1966 "Python/bytecodes.c" + #line 1963 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2816,7 +2813,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2820 "Python/generated_cases.c.h" + #line 2817 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2824,7 +2821,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 1992 "Python/bytecodes.c" + #line 1989 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2850,7 +2847,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2854 "Python/generated_cases.c.h" + #line 2851 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2858,7 +2855,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2020 "Python/bytecodes.c" + #line 2017 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2876,7 +2873,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2880 "Python/generated_cases.c.h" + #line 2877 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2887,7 +2884,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 2040 "Python/bytecodes.c" + #line 2037 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2926,7 +2923,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2930 "Python/generated_cases.c.h" + #line 2927 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2937,7 +2934,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 2081 "Python/bytecodes.c" + #line 2078 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2947,7 +2944,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2951 "Python/generated_cases.c.h" + #line 2948 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2959,7 +2956,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2100 "Python/bytecodes.c" + #line 2097 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2972,10 +2969,10 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 5) <= Py_GE); res = PyObject_RichCompare(left, right, oparg >> 5); - #line 2976 "Python/generated_cases.c.h" + #line 2973 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2113 "Python/bytecodes.c" + #line 2110 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; if (oparg & 16) { int res_bool = PyObject_IsTrue(res); @@ -2983,7 +2980,7 @@ if (res_bool < 0) goto pop_2_error; res = res_bool ? Py_True : Py_False; } - #line 2987 "Python/generated_cases.c.h" + #line 2984 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2994,7 +2991,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2123 "Python/bytecodes.c" + #line 2120 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3006,7 +3003,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3010 "Python/generated_cases.c.h" + #line 3007 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3017,7 +3014,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2138 "Python/bytecodes.c" + #line 2135 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -3033,7 +3030,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3037 "Python/generated_cases.c.h" + #line 3034 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3044,7 +3041,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2157 "Python/bytecodes.c" + #line 2154 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -3057,7 +3054,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; // It's always a bool, so we don't care about oparg & 16. - #line 3061 "Python/generated_cases.c.h" + #line 3058 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3068,14 +3065,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2172 "Python/bytecodes.c" + #line 2169 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3074 "Python/generated_cases.c.h" + #line 3071 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2174 "Python/bytecodes.c" + #line 2171 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3079 "Python/generated_cases.c.h" + #line 3076 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3085,15 +3082,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2178 "Python/bytecodes.c" + #line 2175 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3091 "Python/generated_cases.c.h" + #line 3088 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2180 "Python/bytecodes.c" + #line 2177 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3097 "Python/generated_cases.c.h" + #line 3094 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3104,12 +3101,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2185 "Python/bytecodes.c" + #line 2182 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3110 "Python/generated_cases.c.h" + #line 3107 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2187 "Python/bytecodes.c" + #line 2184 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3117,10 +3114,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3121 "Python/generated_cases.c.h" + #line 3118 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2195 "Python/bytecodes.c" + #line 2192 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3129,7 +3126,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3133 "Python/generated_cases.c.h" + #line 3130 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3139,21 +3136,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2206 "Python/bytecodes.c" + #line 2203 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3146 "Python/generated_cases.c.h" + #line 3143 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2209 "Python/bytecodes.c" + #line 2206 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3153 "Python/generated_cases.c.h" + #line 3150 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2214 "Python/bytecodes.c" + #line 2211 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3157 "Python/generated_cases.c.h" + #line 3154 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3162,15 +3159,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2218 "Python/bytecodes.c" + #line 2215 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3169 "Python/generated_cases.c.h" + #line 3166 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2221 "Python/bytecodes.c" + #line 2218 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3174 "Python/generated_cases.c.h" + #line 3171 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3179,25 +3176,25 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2225 "Python/bytecodes.c" + #line 2222 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3187 "Python/generated_cases.c.h" + #line 3184 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2231 "Python/bytecodes.c" + #line 2228 "Python/bytecodes.c" JUMPBY(oparg); - #line 3196 "Python/generated_cases.c.h" + #line 3193 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2235 "Python/bytecodes.c" + #line 2232 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3215,13 +3212,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3219 "Python/generated_cases.c.h" + #line 3216 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2266 "Python/bytecodes.c" + #line 2263 "Python/bytecodes.c" PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255]; Py_INCREF(executor); @@ -3231,81 +3228,81 @@ goto error; } goto resume_frame; - #line 3235 "Python/generated_cases.c.h" + #line 3232 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2278 "Python/bytecodes.c" + #line 2275 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsFalse(cond)); - #line 3243 "Python/generated_cases.c.h" + #line 3240 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2283 "Python/bytecodes.c" + #line 2280 "Python/bytecodes.c" assert(PyBool_Check(cond)); JUMPBY(oparg * Py_IsTrue(cond)); - #line 3253 "Python/generated_cases.c.h" + #line 3250 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2288 "Python/bytecodes.c" + #line 2285 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3262 "Python/generated_cases.c.h" + #line 3259 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2290 "Python/bytecodes.c" + #line 2287 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3267 "Python/generated_cases.c.h" + #line 3264 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2295 "Python/bytecodes.c" + #line 2292 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3279 "Python/generated_cases.c.h" + #line 3276 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2300 "Python/bytecodes.c" + #line 2297 "Python/bytecodes.c" } - #line 3283 "Python/generated_cases.c.h" + #line 3280 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2304 "Python/bytecodes.c" + #line 2301 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3296 "Python/generated_cases.c.h" + #line 3293 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2313 "Python/bytecodes.c" + #line 2310 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3309 "Python/generated_cases.c.h" + #line 3306 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3316,16 +3313,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2321 "Python/bytecodes.c" + #line 2318 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3325 "Python/generated_cases.c.h" + #line 3322 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2326 "Python/bytecodes.c" + #line 2323 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3333,7 +3330,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3337 "Python/generated_cases.c.h" + #line 3334 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3342,10 +3339,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2336 "Python/bytecodes.c" + #line 2333 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3349 "Python/generated_cases.c.h" + #line 3346 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3354,10 +3351,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2341 "Python/bytecodes.c" + #line 2338 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3361 "Python/generated_cases.c.h" + #line 3358 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3367,11 +3364,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2346 "Python/bytecodes.c" + #line 2343 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; - #line 3375 "Python/generated_cases.c.h" + #line 3372 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3380,14 +3377,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2352 "Python/bytecodes.c" + #line 2349 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3387 "Python/generated_cases.c.h" + #line 3384 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2355 "Python/bytecodes.c" + #line 2352 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3391 "Python/generated_cases.c.h" + #line 3388 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3395,7 +3392,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2359 "Python/bytecodes.c" + #line 2356 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3418,11 +3415,11 @@ if (iter == NULL) { goto error; } - #line 3422 "Python/generated_cases.c.h" + #line 3419 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2382 "Python/bytecodes.c" + #line 2379 "Python/bytecodes.c" } - #line 3426 "Python/generated_cases.c.h" + #line 3423 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3432,7 +3429,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2400 "Python/bytecodes.c" + #line 2397 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3464,7 +3461,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3468 "Python/generated_cases.c.h" + #line 3465 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3472,7 +3469,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2434 "Python/bytecodes.c" + #line 2431 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3498,14 +3495,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3502 "Python/generated_cases.c.h" + #line 3499 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2462 "Python/bytecodes.c" + #line 2459 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3526,7 +3523,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3530 "Python/generated_cases.c.h" + #line 3527 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3536,7 +3533,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2485 "Python/bytecodes.c" + #line 2482 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3557,7 +3554,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3561 "Python/generated_cases.c.h" + #line 3558 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3567,7 +3564,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2508 "Python/bytecodes.c" + #line 2505 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3586,7 +3583,7 @@ if (next == NULL) { goto error; } - #line 3590 "Python/generated_cases.c.h" + #line 3587 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3595,7 +3592,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2529 "Python/bytecodes.c" + #line 2526 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3611,14 +3608,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3615 "Python/generated_cases.c.h" + #line 3612 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2547 "Python/bytecodes.c" + #line 2544 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3641,16 +3638,16 @@ Py_DECREF(enter); goto error; } - #line 3645 "Python/generated_cases.c.h" + #line 3642 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2570 "Python/bytecodes.c" + #line 2567 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3654 "Python/generated_cases.c.h" + #line 3651 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3661,7 +3658,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2579 "Python/bytecodes.c" + #line 2576 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3687,16 +3684,16 @@ Py_DECREF(enter); goto error; } - #line 3691 "Python/generated_cases.c.h" + #line 3688 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2605 "Python/bytecodes.c" + #line 2602 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3700 "Python/generated_cases.c.h" + #line 3697 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3708,7 +3705,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2614 "Python/bytecodes.c" + #line 2611 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3729,7 +3726,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3733 "Python/generated_cases.c.h" + #line 3730 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3738,7 +3735,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2653 "Python/bytecodes.c" + #line 2650 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3748,7 +3745,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3752 "Python/generated_cases.c.h" + #line 3749 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3762,7 +3759,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2665 "Python/bytecodes.c" + #line 2662 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3779,7 +3776,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3783 "Python/generated_cases.c.h" + #line 3780 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3793,7 +3790,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2684 "Python/bytecodes.c" + #line 2681 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3803,7 +3800,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3807 "Python/generated_cases.c.h" + #line 3804 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3817,7 +3814,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2696 "Python/bytecodes.c" + #line 2693 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3831,7 +3828,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3835 "Python/generated_cases.c.h" + #line 3832 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3840,16 +3837,16 @@ } TARGET(KW_NAMES) { - #line 2712 "Python/bytecodes.c" + #line 2709 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - #line 3848 "Python/generated_cases.c.h" + #line 3845 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2718 "Python/bytecodes.c" + #line 2715 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3862,7 +3859,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3866 "Python/generated_cases.c.h" + #line 3863 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3872,7 +3869,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2764 "Python/bytecodes.c" + #line 2761 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3954,7 +3951,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3958 "Python/generated_cases.c.h" + #line 3955 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3966,7 +3963,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2852 "Python/bytecodes.c" + #line 2849 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3976,7 +3973,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3980 "Python/generated_cases.c.h" + #line 3977 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3985,7 +3982,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2864 "Python/bytecodes.c" + #line 2861 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4011,7 +4008,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4015 "Python/generated_cases.c.h" + #line 4012 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -4019,7 +4016,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2892 "Python/bytecodes.c" + #line 2889 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4055,7 +4052,7 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4059 "Python/generated_cases.c.h" + #line 4056 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4063,7 +4060,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2930 "Python/bytecodes.c" + #line 2927 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4073,7 +4070,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4077 "Python/generated_cases.c.h" + #line 4074 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4086,7 +4083,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2942 "Python/bytecodes.c" + #line 2939 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4097,7 +4094,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4101 "Python/generated_cases.c.h" + #line 4098 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4111,7 +4108,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2956 "Python/bytecodes.c" + #line 2953 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4122,7 +4119,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4126 "Python/generated_cases.c.h" + #line 4123 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4135,7 +4132,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; - #line 2970 "Python/bytecodes.c" + #line 2967 "Python/bytecodes.c" /* This instruction does the following: * 1. Creates the object (by calling ``object.__new__``) * 2. Pushes a shim frame to the frame stack (to cleanup after ``__init__``) @@ -4185,12 +4182,12 @@ frame = cframe.current_frame = init_frame; CALL_STAT_INC(inlined_py_calls); goto start_frame; - #line 4189 "Python/generated_cases.c.h" + #line 4186 "Python/generated_cases.c.h" } TARGET(EXIT_INIT_CHECK) { PyObject *should_be_none = stack_pointer[-1]; - #line 3022 "Python/bytecodes.c" + #line 3019 "Python/bytecodes.c" assert(STACK_LEVEL() == 2); if (should_be_none != Py_None) { PyErr_Format(PyExc_TypeError, @@ -4198,7 +4195,7 @@ Py_TYPE(should_be_none)->tp_name); goto error; } - #line 4202 "Python/generated_cases.c.h" + #line 4199 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -4208,7 +4205,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3032 "Python/bytecodes.c" + #line 3029 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4230,7 +4227,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4234 "Python/generated_cases.c.h" + #line 4231 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4244,7 +4241,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3057 "Python/bytecodes.c" + #line 3054 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4272,7 +4269,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4276 "Python/generated_cases.c.h" + #line 4273 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4286,7 +4283,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3088 "Python/bytecodes.c" + #line 3085 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4318,7 +4315,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4322 "Python/generated_cases.c.h" + #line 4319 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4332,7 +4329,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3123 "Python/bytecodes.c" + #line 3120 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4364,7 +4361,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4368 "Python/generated_cases.c.h" + #line 4365 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4378,7 +4375,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3158 "Python/bytecodes.c" + #line 3155 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4403,7 +4400,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4407 "Python/generated_cases.c.h" + #line 4404 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4416,7 +4413,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3185 "Python/bytecodes.c" + #line 3182 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4443,7 +4440,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4447 "Python/generated_cases.c.h" + #line 4444 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4455,7 +4452,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3215 "Python/bytecodes.c" + #line 3212 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4473,14 +4470,14 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4477 "Python/generated_cases.c.h" + #line 4474 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3235 "Python/bytecodes.c" + #line 3232 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4511,7 +4508,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4515 "Python/generated_cases.c.h" + #line 4512 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4524,7 +4521,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3269 "Python/bytecodes.c" + #line 3266 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4553,7 +4550,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4557 "Python/generated_cases.c.h" + #line 4554 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4566,7 +4563,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3301 "Python/bytecodes.c" + #line 3298 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4595,7 +4592,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4599 "Python/generated_cases.c.h" + #line 4596 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4608,7 +4605,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3333 "Python/bytecodes.c" + #line 3330 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4636,7 +4633,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4640 "Python/generated_cases.c.h" + #line 4637 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4646,9 +4643,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3364 "Python/bytecodes.c" + #line 3361 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4652 "Python/generated_cases.c.h" + #line 4649 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4657,7 +4654,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3368 "Python/bytecodes.c" + #line 3365 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4719,14 +4716,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4723 "Python/generated_cases.c.h" + #line 4720 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3430 "Python/bytecodes.c" + #line 3427 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4730 "Python/generated_cases.c.h" + #line 4727 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4737,7 +4734,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3436 "Python/bytecodes.c" + #line 3433 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4749,7 +4746,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4753 "Python/generated_cases.c.h" + #line 4750 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4757,7 +4754,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3450 "Python/bytecodes.c" + #line 3447 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4782,14 +4779,14 @@ default: Py_UNREACHABLE(); } - #line 4786 "Python/generated_cases.c.h" + #line 4783 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3477 "Python/bytecodes.c" + #line 3474 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4810,7 +4807,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4814 "Python/generated_cases.c.h" + #line 4811 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4818,15 +4815,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3500 "Python/bytecodes.c" + #line 3497 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4824 "Python/generated_cases.c.h" + #line 4821 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3502 "Python/bytecodes.c" + #line 3499 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4830 "Python/generated_cases.c.h" + #line 4827 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4836,14 +4833,14 @@ TARGET(CONVERT_VALUE) { PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3506 "Python/bytecodes.c" + #line 3503 "Python/bytecodes.c" convertion_func_ptr conv_fn; assert(oparg >= FVC_STR && oparg <= FVC_ASCII); conv_fn = CONVERSION_FUNCTIONS[oparg]; result = conv_fn(value); Py_DECREF(value); if (result == NULL) goto pop_1_error; - #line 4847 "Python/generated_cases.c.h" + #line 4844 "Python/generated_cases.c.h" stack_pointer[-1] = result; DISPATCH(); } @@ -4851,7 +4848,7 @@ TARGET(FORMAT_SIMPLE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 3515 "Python/bytecodes.c" + #line 3512 "Python/bytecodes.c" /* If value is a unicode object, then we know the result * of format(value) is value itself. */ if (!PyUnicode_CheckExact(value)) { @@ -4862,7 +4859,7 @@ else { res = value; } - #line 4866 "Python/generated_cases.c.h" + #line 4863 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -4871,12 +4868,12 @@ PyObject *fmt_spec = stack_pointer[-1]; PyObject *value = stack_pointer[-2]; PyObject *res; - #line 3528 "Python/bytecodes.c" + #line 3525 "Python/bytecodes.c" res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); if (res == NULL) goto pop_2_error; - #line 4880 "Python/generated_cases.c.h" + #line 4877 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -4885,10 +4882,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3535 "Python/bytecodes.c" + #line 3532 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4892 "Python/generated_cases.c.h" + #line 4889 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4900,7 +4897,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3540 "Python/bytecodes.c" + #line 3537 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4915,12 +4912,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4919 "Python/generated_cases.c.h" + #line 4916 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3555 "Python/bytecodes.c" + #line 3552 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4924 "Python/generated_cases.c.h" + #line 4921 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4930,16 +4927,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3560 "Python/bytecodes.c" + #line 3557 "Python/bytecodes.c" assert(oparg >= 2); - #line 4936 "Python/generated_cases.c.h" + #line 4933 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3564 "Python/bytecodes.c" + #line 3561 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4951,48 +4948,48 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4955 "Python/generated_cases.c.h" + #line 4952 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3578 "Python/bytecodes.c" + #line 3575 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4961 "Python/generated_cases.c.h" + #line 4958 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3582 "Python/bytecodes.c" + #line 3579 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4968 "Python/generated_cases.c.h" + #line 4965 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3587 "Python/bytecodes.c" + #line 3584 "Python/bytecodes.c" PyObject *cond = POP(); assert(PyBool_Check(cond)); _Py_CODEUNIT *here = next_instr - 1; int offset = Py_IsTrue(cond) * oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4980 "Python/generated_cases.c.h" + #line 4977 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3595 "Python/bytecodes.c" + #line 3592 "Python/bytecodes.c" PyObject *cond = POP(); assert(PyBool_Check(cond)); _Py_CODEUNIT *here = next_instr - 1; int offset = Py_IsFalse(cond) * oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4991 "Python/generated_cases.c.h" + #line 4988 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3603 "Python/bytecodes.c" + #line 3600 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -5004,12 +5001,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 5008 "Python/generated_cases.c.h" + #line 5005 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3617 "Python/bytecodes.c" + #line 3614 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -5021,30 +5018,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 5025 "Python/generated_cases.c.h" + #line 5022 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3631 "Python/bytecodes.c" + #line 3628 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 5036 "Python/generated_cases.c.h" + #line 5033 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3639 "Python/bytecodes.c" + #line 3636 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 5043 "Python/generated_cases.c.h" + #line 5040 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3644 "Python/bytecodes.c" + #line 3641 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 5050 "Python/generated_cases.c.h" + #line 5047 "Python/generated_cases.c.h" } From 7638b76e18d78fab6c5d91a997ad8e4f2d97d40d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 29 Jun 2023 09:08:19 -0700 Subject: [PATCH 15/15] Add cast --- Python/flowgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/flowgraph.c b/Python/flowgraph.c index a817374472bde6..a9055a82ea2b0a 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1147,7 +1147,7 @@ add_const(PyObject *newconst, PyObject *consts, PyObject *const_cache) } } Py_DECREF(newconst); - return index; + return (int)index; } /* Replace LOAD_CONST c1, LOAD_CONST c2 ... LOAD_CONST cn, BUILD_TUPLE n