diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 1caf3c097e1dce..8cca8ab43b8028 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -58,7 +58,7 @@ the following command can be used to display the disassembly of 3 2 LOAD_GLOBAL 1 (NULL + len) 12 LOAD_FAST 0 (alist) - 14 CALL 1 + 14 CALL 2 (1) 22 RETURN_VALUE (The "2" is a line number). @@ -1361,22 +1361,23 @@ iterations of the loop. .. opcode:: CALL (argc) - Calls a callable object with the number of arguments specified by ``argc``, - including the named arguments specified by the preceding - :opcode:`KW_NAMES`, if any. + Calls a callable object with the number of arguments specified by ``argc >> 1``, + including the named arguments, if ``argc & 1``. On the stack are (in ascending order), either: * NULL * The callable * The positional arguments - * The named arguments + * The named arguments (if ``argc & 1``) + * A tuple of keyword names (if ``argc & 1``) or: * The callable * ``self`` * The remaining positional arguments - * The named arguments + * The named arguments (if ``argc & 1``) + * A tuple of keyword names (if ``argc & 1``) ``argc`` is the total of the positional and named arguments, excluding ``self`` when a ``NULL`` is not present. @@ -1387,6 +1388,11 @@ iterations of the loop. .. versionadded:: 3.11 + .. versionchanged:: 3.13 + Keyword names are now found to the stack, and the presence of keyword + arguments is indicated by the low bit of the oparg (rather than a separate + ``KW_NAMES`` instruction). + .. opcode:: CALL_FUNCTION_EX (flags) @@ -1412,15 +1418,6 @@ iterations of the loop. .. versionadded:: 3.11 -.. opcode:: KW_NAMES (consti) - - Prefixes :opcode:`CALL`. - Stores a reference to ``co_consts[consti]`` into an internal variable - for use by :opcode:`CALL`. ``co_consts[consti]`` must be a tuple of strings. - - .. versionadded:: 3.11 - - .. opcode:: MAKE_FUNCTION Pushes a new function object on the stack built from the code object at ``STACK[1]``. diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h index d680039e5eed96..5fc53a563f7cc6 100644 --- a/Include/internal/pycore_opcode.h +++ b/Include/internal/pycore_opcode.h @@ -156,7 +156,6 @@ const uint8_t _PyOpcode_Deopt[256] = { [JUMP_BACKWARD] = JUMP_BACKWARD, [JUMP_BACKWARD_NO_INTERRUPT] = JUMP_BACKWARD_NO_INTERRUPT, [JUMP_FORWARD] = JUMP_FORWARD, - [KW_NAMES] = KW_NAMES, [LIST_APPEND] = LIST_APPEND, [LIST_EXTEND] = LIST_EXTEND, [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR, @@ -420,7 +419,7 @@ static const char *const _PyOpcode_OpName[267] = { [STORE_FAST_LOAD_FAST] = "STORE_FAST_LOAD_FAST", [STORE_FAST_STORE_FAST] = "STORE_FAST_STORE_FAST", [CALL] = "CALL", - [KW_NAMES] = "KW_NAMES", + [172] = "<172>", [CALL_INTRINSIC_1] = "CALL_INTRINSIC_1", [CALL_INTRINSIC_2] = "CALL_INTRINSIC_2", [LOAD_FROM_DICT_OR_GLOBALS] = "LOAD_FROM_DICT_OR_GLOBALS", @@ -521,6 +520,7 @@ static const char *const _PyOpcode_OpName[267] = { #define EXTRA_CASES \ case 166: \ case 167: \ + case 172: \ case 178: \ case 179: \ case 180: \ diff --git a/Include/opcode.h b/Include/opcode.h index c6ffaee3522142..62c11a8eb6b2e0 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -120,7 +120,6 @@ extern "C" { #define STORE_FAST_LOAD_FAST 169 #define STORE_FAST_STORE_FAST 170 #define CALL 171 -#define KW_NAMES 172 #define CALL_INTRINSIC_1 173 #define CALL_INTRINSIC_2 174 #define LOAD_FROM_DICT_OR_GLOBALS 175 @@ -232,7 +231,6 @@ extern "C" { #define HAS_CONST(op) (false\ || ((op) == LOAD_CONST) \ || ((op) == RETURN_CONST) \ - || ((op) == KW_NAMES) \ ) #define NB_ADD 0 diff --git a/Lib/dis.py b/Lib/dis.py index f135a0bc9b4d98..2cff3559381f7a 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -44,6 +44,7 @@ LOAD_FAST_LOAD_FAST = opmap['LOAD_FAST_LOAD_FAST'] STORE_FAST_LOAD_FAST = opmap['STORE_FAST_LOAD_FAST'] STORE_FAST_STORE_FAST = opmap['STORE_FAST_STORE_FAST'] +CALL = opmap['CALL'] CACHE = opmap["CACHE"] @@ -586,6 +587,12 @@ def _get_instructions_bytes(code, varname_from_oparg=None, argrepr = _intrinsic_1_descs[arg] elif deop == CALL_INTRINSIC_2: argrepr = _intrinsic_2_descs[arg] + elif deop == CALL: + argval = arg >> 1 + if arg & 1: + argrepr = f"{argval} + keywords" + else: + argrepr = repr(argval) yield Instruction(_all_opname[op], op, arg, argval, argrepr, offset, start_offset, starts_line, is_jump_target, positions) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index cf68c448a6e4ec..74d6bd9a2d0797 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -450,6 +450,7 @@ def _write_atomic(path, data, mode=0o666): # Python 3.13a1 3552 (Remove LOAD_FAST__LOAD_CONST and LOAD_CONST__LOAD_FAST) # Python 3.13a1 3553 (Add SET_FUNCTION_ATTRIBUTE) # Python 3.13a1 3554 (more efficient bytecodes for f-strings) +# Python 3.13a1 3555 (Remove KW_NAMES) # Python 3.14 will start with 3600 @@ -466,7 +467,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 = (3554).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3555).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c diff --git a/Lib/opcode.py b/Lib/opcode.py index 71a8afad43fc6f..2a1ea6889b956b 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -229,8 +229,7 @@ def pseudo_op(name, op, real_ops): def_op('STORE_FAST_LOAD_FAST', 169) def_op('STORE_FAST_STORE_FAST', 170) def_op('CALL', 171) -def_op('KW_NAMES', 172) -hasconst.append(172) + def_op('CALL_INTRINSIC_1', 173) def_op('CALL_INTRINSIC_2', 174) diff --git a/Lib/test/test_compiler_codegen.py b/Lib/test/test_compiler_codegen.py index ea57df9cd2400b..e606d68582aba3 100644 --- a/Lib/test/test_compiler_codegen.py +++ b/Lib/test/test_compiler_codegen.py @@ -43,7 +43,7 @@ def test_for_loop(self): ('PUSH_NULL', None, 2), ('LOAD_NAME', 2, 2), ('LOAD_NAME', 1, 2), - ('CALL', 1, 2), + ('CALL', (1 << 1) | 0, 2), ('POP_TOP', None), ('JUMP', loop_lbl), exit_lbl, diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 7dd6e3f0d62439..47b79a0dc2b381 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -104,7 +104,7 @@ def _f(a): %3d LOAD_GLOBAL 1 (NULL + print) LOAD_FAST 0 (a) - CALL 1 + CALL 2 (1) POP_TOP %3d RETURN_CONST 1 (1) @@ -117,7 +117,7 @@ def _f(a): RESUME 0 LOAD_GLOBAL 1 LOAD_FAST 0 - CALL 1 + CALL 2 (1) POP_TOP RETURN_CONST 1 """ @@ -136,7 +136,7 @@ def bug708901(): %3d LOAD_CONST 2 (10) -%3d CALL 2 +%3d CALL 4 (2) GET_ITER >> FOR_ITER 3 (to 36) STORE_FAST 0 (res) @@ -166,12 +166,12 @@ def bug1333982(x=[]): MAKE_FUNCTION LOAD_FAST 0 (x) GET_ITER - CALL 0 + CALL 0 (0) %3d LOAD_CONST 2 (1) %3d BINARY_OP 0 (+) - CALL 0 + CALL 0 (0) RAISE_VARARGS 1 """ % (bug1333982.__code__.co_firstlineno, bug1333982.__code__.co_firstlineno + 1, @@ -240,8 +240,8 @@ def wrap_func_w_kwargs(): LOAD_CONST 1 (1) LOAD_CONST 2 (2) LOAD_CONST 3 (5) - KW_NAMES 4 (('c',)) - CALL 3 + LOAD_CONST 4 (('c',)) + CALL 7 (3 + keywords) POP_TOP RETURN_CONST 0 (None) """ % (wrap_func_w_kwargs.__code__.co_firstlineno, @@ -348,7 +348,7 @@ def wrap_func_w_kwargs(): 3 PUSH_NULL LOAD_NAME 3 (fun) LOAD_CONST 0 (1) - CALL 1 + CALL 2 (1) LOAD_NAME 2 (__annotations__) LOAD_CONST 2 ('y') STORE_SUBSCR @@ -358,7 +358,7 @@ def wrap_func_w_kwargs(): PUSH_NULL LOAD_NAME 3 (fun) LOAD_CONST 3 (0) - CALL 1 + CALL 2 (1) STORE_SUBSCR LOAD_NAME 1 (int) POP_TOP @@ -479,7 +479,7 @@ def _with(c): %3d LOAD_CONST 0 (None) LOAD_CONST 0 (None) LOAD_CONST 0 (None) - CALL 2 + CALL 4 (2) POP_TOP %3d LOAD_CONST 2 (2) @@ -539,7 +539,7 @@ async def _asyncwith(c): %3d LOAD_CONST 0 (None) LOAD_CONST 0 (None) LOAD_CONST 0 (None) - CALL 2 + CALL 4 (2) GET_AWAITABLE 2 LOAD_CONST 0 (None) >> SEND 3 (to 60) @@ -615,13 +615,13 @@ def _tryfinallyconst(b): %3d PUSH_NULL LOAD_FAST 1 (b) - CALL 0 + CALL 0 (0) POP_TOP RETURN_VALUE >> PUSH_EXC_INFO PUSH_NULL LOAD_FAST 1 (b) - CALL 0 + CALL 0 (0) POP_TOP RERAISE 0 >> COPY 3 @@ -644,13 +644,13 @@ def _tryfinallyconst(b): %3d PUSH_NULL LOAD_FAST 0 (b) - CALL 0 + CALL 0 (0) POP_TOP RETURN_CONST 1 (1) PUSH_EXC_INFO PUSH_NULL LOAD_FAST 0 (b) - CALL 0 + CALL 0 (0) POP_TOP RERAISE 0 >> COPY 3 @@ -716,8 +716,8 @@ def foo(x): SET_FUNCTION_ATTRIBUTE 8 (closure) LOAD_DEREF 1 (y) GET_ITER - CALL 0 - CALL 1 + CALL 0 (0) + CALL 2 (1) RETURN_VALUE """ % (dis_nested_0, __file__, @@ -792,7 +792,7 @@ def loop_test(): %3d LOAD_GLOBAL_MODULE 1 (NULL + load_test) LOAD_FAST 0 (i) - CALL_PY_WITH_DEFAULTS 1 + CALL_PY_WITH_DEFAULTS 2 (1) POP_TOP JUMP_BACKWARD 16 (to 16) @@ -1231,7 +1231,7 @@ def test_call_specialize(self): 1 PUSH_NULL LOAD_NAME 0 (str) LOAD_CONST 0 (1) - CALL_NO_KW_STR_1 1 + CALL_NO_KW_STR_1 2 (1) RETURN_VALUE """ co = compile("str(1)", "", "eval") @@ -1570,24 +1570,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 @@ -1612,7 +1631,7 @@ def _prepare_test_cases(): Instruction(opname='BUILD_LIST', opcode=103, arg=0, argval=0, argrepr='', offset=42, start_offset=42, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='BUILD_MAP', opcode=105, arg=0, argval=0, argrepr='', offset=44, start_offset=44, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='Hello world!', argrepr="'Hello world!'", offset=46, start_offset=46, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=7, argval=7, argrepr='', offset=48, start_offset=48, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=14, argval=7, argrepr='7', offset=48, start_offset=48, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=56, start_offset=56, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='f', argrepr='f', offset=58, start_offset=58, starts_line=8, is_jump_target=False, positions=None), Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=60, start_offset=60, starts_line=None, is_jump_target=False, positions=None), @@ -1639,7 +1658,7 @@ def _prepare_test_cases(): Instruction(opname='LOAD_DEREF', opcode=137, arg=4, argval='b', argrepr='b', offset=42, start_offset=42, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=137, arg=0, argval='c', argrepr='c', offset=44, start_offset=44, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=137, arg=1, argval='d', argrepr='d', offset=46, start_offset=46, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=4, argval=4, argrepr='', offset=48, start_offset=48, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=8, argval=4, argrepr='4', offset=48, start_offset=48, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=56, start_offset=56, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='inner', argrepr='inner', offset=58, start_offset=58, starts_line=6, is_jump_target=False, positions=None), Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=60, start_offset=60, starts_line=None, is_jump_target=False, positions=None), @@ -1654,23 +1673,22 @@ def _prepare_test_cases(): Instruction(opname='LOAD_DEREF', opcode=137, arg=4, argval='c', argrepr='c', offset=18, start_offset=18, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=137, arg=5, argval='d', argrepr='d', offset=20, start_offset=20, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST_LOAD_FAST', opcode=168, arg=1, argval=('e', 'f'), argrepr='e, f', offset=22, start_offset=22, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=6, argval=6, argrepr='', offset=24, start_offset=24, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=12, argval=6, argrepr='6', offset=24, start_offset=24, starts_line=None, is_jump_target=False, positions=None), 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='CALL', opcode=171, arg=2, argval=1, argrepr='1', 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=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), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=42, start_offset=42, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=1, argrepr='1', offset=42, start_offset=42, starts_line=None, is_jump_target=False, positions=None), 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), @@ -1687,13 +1705,13 @@ def _prepare_test_cases(): 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='CALL', opcode=171, arg=2, argval=1, argrepr='1', 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='POP_JUMP_IF_FALSE', opcode=114, arg=33, argval=178, argrepr='to 178', offset=110, start_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, start_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, start_offset=122, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=124, start_offset=124, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=1, argrepr='1', offset=124, start_offset=124, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=132, start_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, start_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, start_offset=136, starts_line=None, is_jump_target=False, positions=None), @@ -1714,7 +1732,7 @@ def _prepare_test_cases(): Instruction(opname='JUMP_BACKWARD', opcode=140, arg=33, argval=112, argrepr='to 112', offset=174, start_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, start_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, start_offset=188, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=190, start_offset=190, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=1, argrepr='1', offset=190, start_offset=190, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=198, start_offset=198, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=200, start_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, start_offset=202, starts_line=21, is_jump_target=False, positions=None), @@ -1726,16 +1744,16 @@ def _prepare_test_cases(): Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=216, start_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, start_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, start_offset=228, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=230, start_offset=230, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=1, argrepr='1', 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=238, start_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, start_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, start_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, start_offset=244, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=246, start_offset=246, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=4, argval=2, argrepr='2', 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_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=256, start_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, start_offset=266, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=268, start_offset=268, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=1, argrepr='1', offset=268, start_offset=268, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=276, start_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, start_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, start_offset=280, starts_line=25, is_jump_target=False, positions=None), @@ -1757,7 +1775,7 @@ def _prepare_test_cases(): 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='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=324, start_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, start_offset=334, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=336, start_offset=336, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=1, argrepr='1', offset=336, start_offset=336, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=344, start_offset=344, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=346, start_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, start_offset=348, starts_line=None, is_jump_target=False, positions=None), @@ -1768,7 +1786,7 @@ def _prepare_test_cases(): Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=360, start_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, start_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, start_offset=372, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=374, start_offset=374, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL', opcode=171, arg=2, argval=1, argrepr='1', offset=374, start_offset=374, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=382, start_offset=382, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=384, start_offset=384, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=386, start_offset=386, starts_line=None, is_jump_target=False, positions=None), diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-06-16-03-03-39.gh-issue-105848.g0uVaB.rst b/Misc/NEWS.d/next/Core and Builtins/2023-06-16-03-03-39.gh-issue-105848.g0uVaB.rst new file mode 100644 index 00000000000000..41f443d98036b6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-06-16-03-03-39.gh-issue-105848.g0uVaB.rst @@ -0,0 +1,2 @@ +Replace the ``KW_NAMES`` opcode with a flag on the low bit of :opcode:`CALL` +instructions indicating the presence of keyword names on the stack. diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 98f4a0378bf76d..939bb14fa1c1fa 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -425,7 +425,7 @@ mark_stacks(PyCodeObject *code_obj, int len) } case CALL: { - int args = oparg; + int args = (oparg >> 1) + (oparg & 1); for (int j = 0; j < args+2; j++) { next_stack = pop_value(next_stack); } diff --git a/Programs/test_frozenmain.h b/Programs/test_frozenmain.h index 9058327e846dc3..5f5ba7663e83b1 100644 --- a/Programs/test_frozenmain.h +++ b/Programs/test_frozenmain.h @@ -3,14 +3,14 @@ unsigned char M_test_frozenmain[] = { 227,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0, 0,0,0,0,0,243,164,0,0,0,151,0,100,0,100,1, 108,0,90,0,100,0,100,1,108,1,90,1,2,0,101,2, - 100,2,171,1,0,0,0,0,0,0,1,0,2,0,101,2, + 100,2,171,2,0,0,0,0,0,0,1,0,2,0,101,2, 100,3,101,0,106,6,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,171,2,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,171,4,0,0,0,0,0,0, 1,0,2,0,101,1,106,8,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,171,0,0,0,0,0, 0,0,100,4,25,0,0,0,90,5,100,5,68,0,93,20, 0,0,90,6,2,0,101,2,100,6,101,6,40,0,100,7, - 101,5,101,6,25,0,0,0,40,0,157,4,171,1,0,0, + 101,5,101,6,25,0,0,0,40,0,157,4,171,2,0,0, 0,0,0,0,1,0,140,22,0,0,4,0,121,1,41,8, 233,0,0,0,0,78,122,18,70,114,111,122,101,110,32,72, 101,108,108,111,32,87,111,114,108,100,122,8,115,121,115,46, diff --git a/Python/bytecodes.c b/Python/bytecodes.c index a2cb834df29822..e6758dc21b2a05 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -76,7 +76,6 @@ dummy_func( _PyCFrame cframe, _Py_CODEUNIT *next_instr, PyObject **stack_pointer, - PyObject *kwnames, int throwflag, binaryfunc binary_ops[], PyObject *args[] @@ -2642,18 +2641,12 @@ dummy_func( assert(oparg & 1); } - inst(KW_NAMES, (--)) { - assert(kwnames == NULL); - assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); - kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - } - inst(INSTRUMENTED_CALL, ( -- )) { - int is_meth = PEEK(oparg+2) != NULL; - int total_args = oparg + is_meth; - PyObject *function = PEEK(total_args + 1); + int is_meth = PEEK((oparg >> 1) + 2 + (oparg & 1)) != NULL; + int total_args = (oparg >> 1) + is_meth; + PyObject *function = PEEK(total_args + 1 + (oparg & 1)); PyObject *arg = total_args == 0 ? - &_PyInstrumentation_MISSING : PEEK(total_args); + &_PyInstrumentation_MISSING : PEEK(total_args + (oparg & 1)); int err = _Py_call_instrumentation_2args( tstate, PY_MONITORING_EVENT_CALL, frame, next_instr-1, function, arg); @@ -2687,15 +2680,14 @@ dummy_func( }; // On entry, the stack is either - // [NULL, callable, arg1, arg2, ...] + // [NULL, callable, arg1, arg2, ..., (kwnames)] // or - // [method, self, arg1, arg2, ...] - // (Some args may be keywords, see KW_NAMES, which sets 'kwnames'.) + // [method, self, arg1, arg2, ..., (kwnames)] // On exit, the stack is [result]. // When calling Python, inline the call using DISPATCH_INLINED(). - inst(CALL, (unused/1, unused/2, method, callable, args[oparg] -- res)) { + inst(CALL, (unused/1, unused/2, method, callable, args[oparg >> 1], kwnames if (oparg & 1) -- res)) { int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -2712,7 +2704,7 @@ dummy_func( DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ if (!is_meth && Py_TYPE(callable) == &PyMethod_Type) { - is_meth = 1; // For consistenct; it's dead, though + is_meth = 1; // For consistency; it's dead, though args--; total_args++; PyObject *self = ((PyMethodObject *)callable)->im_self; @@ -2734,9 +2726,9 @@ dummy_func( tstate, (PyFunctionObject *)callable, locals, args, positional_args, kwnames ); - kwnames = NULL; + Py_XDECREF(kwnames); // Manipulate stack directly since we leave using DISPATCH_INLINED(). - STACK_SHRINK(oparg + 2); + STACK_SHRINK((oparg >> 1) + 2 + (oparg & 1)); // The frame has stolen all the arguments from the stack, // so there is no need to clean them up. if (new_frame == NULL) { @@ -2753,7 +2745,7 @@ dummy_func( kwnames); if (opcode == INSTRUMENTED_CALL) { PyObject *arg = total_args == 0 ? - &_PyInstrumentation_MISSING : PEEK(total_args); + &_PyInstrumentation_MISSING : PEEK(total_args + (oparg & 1)); if (res == NULL) { _Py_call_instrumentation_exc2( tstate, PY_MONITORING_EVENT_C_RAISE, @@ -2768,7 +2760,7 @@ dummy_func( } } } - kwnames = NULL; + Py_XDECREF(kwnames); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); Py_DECREF(callable); for (int i = 0; i < total_args; i++) { @@ -2781,23 +2773,24 @@ dummy_func( // Start out with [NULL, bound_method, arg1, arg2, ...] // Transform to [callable, self, arg1, arg2, ...] // Then fall through to CALL_PY_EXACT_ARGS - inst(CALL_BOUND_METHOD_EXACT_ARGS, (unused/1, unused/2, method, callable, unused[oparg] -- unused)) { + inst(CALL_BOUND_METHOD_EXACT_ARGS, (unused/1, unused/2, method, callable, unused[oparg >> 1], unused if (oparg & 1) -- unused)) { + assert((oparg & 1) == 0); DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); PyObject *self = ((PyMethodObject *)callable)->im_self; - PEEK(oparg + 1) = Py_NewRef(self); // callable + PEEK((oparg >> 1) + 1) = Py_NewRef(self); // callable PyObject *meth = ((PyMethodObject *)callable)->im_func; - PEEK(oparg + 2) = Py_NewRef(meth); // method + PEEK((oparg >> 1) + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); } - inst(CALL_PY_EXACT_ARGS, (unused/1, func_version/2, method, callable, args[oparg] -- unused)) { - assert(kwnames == NULL); + inst(CALL_PY_EXACT_ARGS, (unused/1, func_version/2, method, callable, args[oparg >> 1], unused if (oparg & 1) -- unused)) { + assert((oparg & 1) == 0); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; - int argcount = oparg; + int argcount = oparg >> 1; if (is_meth) { callable = method; args--; @@ -2815,17 +2808,17 @@ dummy_func( new_frame->localsplus[i] = args[i]; } // Manipulate stack directly since we leave using DISPATCH_INLINED(). - STACK_SHRINK(oparg + 2); + STACK_SHRINK((oparg >> 1) + 2); SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); } - inst(CALL_PY_WITH_DEFAULTS, (unused/1, func_version/2, method, callable, args[oparg] -- unused)) { - assert(kwnames == NULL); + inst(CALL_PY_WITH_DEFAULTS, (unused/1, func_version/2, method, callable, args[oparg >> 1], unused if (oparg & 1) -- unused)) { + assert((oparg & 1) == 0); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; - int argcount = oparg; + int argcount = oparg >> 1; if (is_meth) { callable = method; args--; @@ -2853,15 +2846,15 @@ dummy_func( new_frame->localsplus[i] = Py_NewRef(def); } // Manipulate stack and cache directly since we leave using DISPATCH_INLINED(). - STACK_SHRINK(oparg + 2); + STACK_SHRINK((oparg >> 1) + 2); SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); } - inst(CALL_NO_KW_TYPE_1, (unused/1, unused/2, null, callable, args[oparg] -- res)) { - assert(kwnames == NULL); - assert(oparg == 1); + inst(CALL_NO_KW_TYPE_1, (unused/1, unused/2, null, callable, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); DEOPT_IF(null != NULL, CALL); PyObject *obj = args[0]; DEOPT_IF(callable != (PyObject *)&PyType_Type, CALL); @@ -2871,9 +2864,9 @@ dummy_func( Py_DECREF(&PyType_Type); // I.e., callable } - inst(CALL_NO_KW_STR_1, (unused/1, unused/2, null, callable, args[oparg] -- res)) { - assert(kwnames == NULL); - assert(oparg == 1); + inst(CALL_NO_KW_STR_1, (unused/1, unused/2, null, callable, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); DEOPT_IF(null != NULL, CALL); DEOPT_IF(callable != (PyObject *)&PyUnicode_Type, CALL); STAT_INC(CALL, hit); @@ -2885,9 +2878,9 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_NO_KW_TUPLE_1, (unused/1, unused/2, null, callable, args[oparg] -- res)) { - assert(kwnames == NULL); - assert(oparg == 1); + inst(CALL_NO_KW_TUPLE_1, (unused/1, unused/2, null, callable, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); DEOPT_IF(null != NULL, CALL); DEOPT_IF(callable != (PyObject *)&PyTuple_Type, CALL); STAT_INC(CALL, hit); @@ -2899,9 +2892,9 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_BUILTIN_CLASS, (unused/1, unused/2, method, callable, args[oparg] -- res)) { + inst(CALL_BUILTIN_CLASS, (unused/1, unused/2, method, callable, args[oparg >> 1], kwnames if (oparg & 1) -- res)) { int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -2914,7 +2907,7 @@ dummy_func( STAT_INC(CALL, hit); res = tp->tp_vectorcall((PyObject *)tp, args, total_args - kwnames_len, kwnames); - kwnames = NULL; + Py_XDECREF(kwnames); /* Free the arguments. */ for (int i = 0; i < total_args; i++) { Py_DECREF(args[i]); @@ -2924,11 +2917,11 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_NO_KW_BUILTIN_O, (unused/1, unused/2, method, callable, args[oparg] -- res)) { + inst(CALL_NO_KW_BUILTIN_O, (unused/1, unused/2, method, callable, args[oparg >> 1], unused if (oparg & 1) -- res)) { /* Builtin METH_O functions */ - assert(kwnames == NULL); + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -2955,11 +2948,11 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_NO_KW_BUILTIN_FAST, (unused/1, unused/2, method, callable, args[oparg] -- res)) { + inst(CALL_NO_KW_BUILTIN_FAST, (unused/1, unused/2, method, callable, args[oparg >> 1], unused if (oparg & 1) -- res)) { /* Builtin METH_FASTCALL functions, without keywords */ - assert(kwnames == NULL); + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -2990,10 +2983,10 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_BUILTIN_FAST_WITH_KEYWORDS, (unused/1, unused/2, method, callable, args[oparg] -- res)) { + inst(CALL_BUILTIN_FAST_WITH_KEYWORDS, (unused/1, unused/2, method, callable, args[oparg >> 1], kwnames if (oparg & 1) -- res)) { /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -3014,7 +3007,7 @@ dummy_func( kwnames ); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); - kwnames = NULL; + Py_XDECREF(kwnames); /* Free the arguments. */ for (int i = 0; i < total_args; i++) { @@ -3025,11 +3018,11 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_NO_KW_LEN, (unused/1, unused/2, method, callable, args[oparg] -- res)) { - assert(kwnames == NULL); + inst(CALL_NO_KW_LEN, (unused/1, unused/2, method, callable, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); /* len(o) */ int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -3052,11 +3045,11 @@ dummy_func( ERROR_IF(res == NULL, error); } - inst(CALL_NO_KW_ISINSTANCE, (unused/1, unused/2, method, callable, args[oparg] -- res)) { - assert(kwnames == NULL); + inst(CALL_NO_KW_ISINSTANCE, (unused/1, unused/2, method, callable, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); /* isinstance(o, o2) */ int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -3082,9 +3075,9 @@ dummy_func( } // This is secretly a super-instruction - inst(CALL_NO_KW_LIST_APPEND, (unused/1, unused/2, method, self, args[oparg] -- unused)) { - assert(kwnames == NULL); - assert(oparg == 1); + inst(CALL_NO_KW_LIST_APPEND, (unused/1, unused/2, method, self, args[oparg >> 1], unused if (oparg & 1) -- unused)) { + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); assert(method != NULL); PyInterpreterState *interp = _PyInterpreterState_GET(); DEOPT_IF(method != interp->callable_cache.list_append, CALL); @@ -3102,10 +3095,10 @@ dummy_func( DISPATCH(); } - inst(CALL_NO_KW_METHOD_DESCRIPTOR_O, (unused/1, unused/2, method, unused, args[oparg] -- res)) { - assert(kwnames == NULL); + inst(CALL_NO_KW_METHOD_DESCRIPTOR_O, (unused/1, unused/2, method, unused, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; @@ -3136,15 +3129,15 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (unused/1, unused/2, method, unused, args[oparg] -- res)) { + inst(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (unused/1, unused/2, method, unused, args[oparg >> 1], kwnames if (oparg & 1) -- res)) { int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; } PyMethodDescrObject *callable = - (PyMethodDescrObject *)PEEK(total_args + 1); + (PyMethodDescrObject *)PEEK(total_args + 1 + (oparg & 1)); DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), CALL); PyMethodDef *meth = callable->d_method; DEOPT_IF(meth->ml_flags != (METH_FASTCALL|METH_KEYWORDS), CALL); @@ -3157,7 +3150,7 @@ dummy_func( (_PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth; res = cfunc(self, args + 1, nargs - KWNAMES_LEN(), kwnames); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); - kwnames = NULL; + Py_XDECREF(kwnames); /* Free the arguments. */ for (int i = 0; i < total_args; i++) { @@ -3168,11 +3161,11 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS, (unused/1, unused/2, method, unused, args[oparg] -- res)) { - assert(kwnames == NULL); - assert(oparg == 0 || oparg == 1); + inst(CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS, (unused/1, unused/2, method, unused, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); + assert(oparg >> 1 == 0 || oparg >> 1 == 1); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; @@ -3200,10 +3193,10 @@ dummy_func( CHECK_EVAL_BREAKER(); } - inst(CALL_NO_KW_METHOD_DESCRIPTOR_FAST, (unused/1, unused/2, method, unused, args[oparg] -- res)) { - assert(kwnames == NULL); + inst(CALL_NO_KW_METHOD_DESCRIPTOR_FAST, (unused/1, unused/2, method, unused, args[oparg >> 1], unused if (oparg & 1) -- res)) { + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; diff --git a/Python/ceval.c b/Python/ceval.c index b628190fcd57ac..9452c7218abf94 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -676,7 +676,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int _PyCFrame cframe; _PyInterpreterFrame entry_frame; - PyObject *kwnames = NULL; // Borrowed reference. Reset by CALL instructions. /* WARNING: Because the _PyCFrame lives on the C stack, * but can be accessed from a heap allocated object (tstate) @@ -918,7 +917,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int pop_1_error: STACK_SHRINK(1); error: - kwnames = NULL; /* Double-check exception status. */ #ifdef NDEBUG if (!_PyErr_Occurred(tstate)) { diff --git a/Python/compile.c b/Python/compile.c index afb7b7dd3932eb..363c17bd860066 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1474,7 +1474,7 @@ compiler_call_exit_with_nones(struct compiler *c, location loc) ADDOP_LOAD_CONST(c, loc, Py_None); ADDOP_LOAD_CONST(c, loc, Py_None); ADDOP_LOAD_CONST(c, loc, Py_None); - ADDOP_I(c, loc, CALL, 2); + ADDOP_I(c, loc, CALL, (2 << 1) | 0); return SUCCESS; } @@ -1868,7 +1868,7 @@ compiler_apply_decorators(struct compiler *c, asdl_expr_seq* decos) for (Py_ssize_t i = asdl_seq_LEN(decos) - 1; i > -1; i--) { location loc = LOC((expr_ty)asdl_seq_GET(decos, i)); - ADDOP_I(c, loc, CALL, 0); + ADDOP_I(c, loc, CALL, (0 << 1) | 0); } return SUCCESS; } @@ -2378,7 +2378,7 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async) if (num_typeparam_args > 0) { ADDOP_I(c, loc, SWAP, num_typeparam_args + 1); } - ADDOP_I(c, loc, CALL, num_typeparam_args); + ADDOP_I(c, loc, CALL, (num_typeparam_args << 1) | 0); } RETURN_IF_ERROR(compiler_apply_decorators(c, decos)); @@ -2607,7 +2607,7 @@ compiler_class(struct compiler *c, stmt_ty s) return ERROR; } Py_DECREF(co); - ADDOP_I(c, loc, CALL, 0); + ADDOP_I(c, loc, CALL, (0 << 1) | 0); } else { RETURN_IF_ERROR(compiler_call_helper(c, loc, 2, s->v.ClassDef.bases, @@ -2697,7 +2697,7 @@ compiler_typealias(struct compiler *c, stmt_ty s) return ERROR; } Py_DECREF(co); - ADDOP_I(c, loc, CALL, 0); + ADDOP_I(c, loc, CALL, (0 << 1) | 0); } RETURN_IF_ERROR(compiler_nameop(c, loc, name, Store)); return SUCCESS; @@ -3891,7 +3891,7 @@ compiler_assert(struct compiler *c, stmt_ty s) ADDOP(c, LOC(s), LOAD_ASSERTION_ERROR); if (s->v.Assert.msg) { VISIT(c, expr, s->v.Assert.msg); - ADDOP_I(c, LOC(s), CALL, 0); + ADDOP_I(c, LOC(s), CALL, (0 << 1) | 0); } ADDOP_I(c, LOC(s), RAISE_VARARGS, 1); @@ -4890,7 +4890,7 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e) compiler_call_simple_kw_helper(c, loc, kwds, kwdsl)); } loc = update_start_location_to_match_attr(c, LOC(e), meth); - ADDOP_I(c, loc, CALL, argsl + kwdsl); + ADDOP_I(c, loc, CALL, ((argsl + kwdsl) << 1) | !!kwdsl); return 1; } @@ -4953,7 +4953,7 @@ compiler_joined_str(struct compiler *c, expr_ty e) VISIT(c, expr, asdl_seq_GET(e->v.JoinedStr.values, i)); ADDOP_I(c, loc, LIST_APPEND, 1); } - ADDOP_I(c, loc, CALL, 1); + ADDOP_I(c, loc, CALL, (1 << 1) | 0); } else { VISIT_SEQ(c, expr, e->v.JoinedStr.values); @@ -5056,7 +5056,7 @@ compiler_subkwargs(struct compiler *c, location loc, } /* Used by compiler_call_helper and maybe_optimize_method_call to emit - * KW_NAMES before CALL. + * kwnames before CALL. */ static int compiler_call_simple_kw_helper(struct compiler *c, location loc, @@ -5071,12 +5071,7 @@ compiler_call_simple_kw_helper(struct compiler *c, location loc, keyword_ty kw = asdl_seq_GET(keywords, i); PyTuple_SET_ITEM(names, i, Py_NewRef(kw->arg)); } - Py_ssize_t arg = compiler_add_const(c->c_const_cache, c->u, names); - if (arg < 0) { - return ERROR; - } - Py_DECREF(names); - ADDOP_I(c, loc, KW_NAMES, arg); + ADDOP_LOAD_CONST_NEW(c, loc, names); return SUCCESS; } @@ -5122,7 +5117,7 @@ compiler_call_helper(struct compiler *c, location loc, RETURN_IF_ERROR( compiler_call_simple_kw_helper(c, loc, keywords, nkwelts)); } - ADDOP_I(c, loc, CALL, n + nelts + nkwelts); + ADDOP_I(c, loc, CALL, ((n + nelts + nkwelts) << 1) | !!nkwelts); return SUCCESS; ex_call: @@ -5722,7 +5717,7 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type, goto error; } - ADDOP_I(c, loc, CALL, 0); + ADDOP_I(c, loc, CALL, (0 << 1) | 0); if (is_async_generator && type != COMP_GENEXP) { ADDOP_I(c, loc, GET_AWAITABLE, 0); diff --git a/Python/flowgraph.c b/Python/flowgraph.c index de5c5e7ecc38d6..3640bce1009c21 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1533,8 +1533,6 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts) INSTR_SET_OP0(inst, NOP); } break; - case KW_NAMES: - break; case PUSH_NULL: if (nextop == LOAD_GLOBAL && (inst[1].i_opcode & 1) == 0) { INSTR_SET_OP0(inst, NOP); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 13c3e286e2ddbf..7da14988101e15 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -8,7 +8,7 @@ } TARGET(RESUME) { - #line 139 "Python/bytecodes.c" + #line 138 "Python/bytecodes.c" assert(tstate->cframe == &cframe); assert(frame == cframe.current_frame); /* Possibly combine this with eval breaker */ @@ -25,7 +25,7 @@ } TARGET(INSTRUMENTED_RESUME) { - #line 153 "Python/bytecodes.c" + #line 152 "Python/bytecodes.c" /* Possible performance enhancement: * We need to check the eval breaker anyway, can we * combine the instrument verison check and the eval breaker test? @@ -57,7 +57,7 @@ TARGET(LOAD_CLOSURE) { PyObject *value; - #line 181 "Python/bytecodes.c" + #line 180 "Python/bytecodes.c" /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */ value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; @@ -70,7 +70,7 @@ TARGET(LOAD_FAST_CHECK) { PyObject *value; - #line 188 "Python/bytecodes.c" + #line 187 "Python/bytecodes.c" value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; Py_INCREF(value); @@ -82,7 +82,7 @@ TARGET(LOAD_FAST) { PyObject *value; - #line 194 "Python/bytecodes.c" + #line 193 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -94,7 +94,7 @@ TARGET(LOAD_FAST_AND_CLEAR) { PyObject *value; - #line 200 "Python/bytecodes.c" + #line 199 "Python/bytecodes.c" value = GETLOCAL(oparg); // do not use SETLOCAL here, it decrefs the old value GETLOCAL(oparg) = NULL; @@ -107,7 +107,7 @@ TARGET(LOAD_FAST_LOAD_FAST) { PyObject *value1; PyObject *value2; - #line 206 "Python/bytecodes.c" + #line 205 "Python/bytecodes.c" uint32_t oparg1 = oparg >> 4; uint32_t oparg2 = oparg & 15; value1 = GETLOCAL(oparg1); @@ -123,7 +123,7 @@ TARGET(LOAD_CONST) { PyObject *value; - #line 215 "Python/bytecodes.c" + #line 214 "Python/bytecodes.c" value = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(value); #line 130 "Python/generated_cases.c.h" @@ -134,7 +134,7 @@ TARGET(STORE_FAST) { PyObject *value = stack_pointer[-1]; - #line 220 "Python/bytecodes.c" + #line 219 "Python/bytecodes.c" SETLOCAL(oparg, value); #line 140 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -144,7 +144,7 @@ TARGET(STORE_FAST_LOAD_FAST) { PyObject *value1 = stack_pointer[-1]; PyObject *value2; - #line 228 "Python/bytecodes.c" + #line 227 "Python/bytecodes.c" uint32_t oparg1 = oparg >> 4; uint32_t oparg2 = oparg & 15; SETLOCAL(oparg1, value1); @@ -158,7 +158,7 @@ TARGET(STORE_FAST_STORE_FAST) { PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; - #line 236 "Python/bytecodes.c" + #line 235 "Python/bytecodes.c" uint32_t oparg1 = oparg >> 4; uint32_t oparg2 = oparg & 15; SETLOCAL(oparg1, value1); @@ -170,7 +170,7 @@ TARGET(POP_TOP) { PyObject *value = stack_pointer[-1]; - #line 243 "Python/bytecodes.c" + #line 242 "Python/bytecodes.c" #line 175 "Python/generated_cases.c.h" Py_DECREF(value); STACK_SHRINK(1); @@ -179,7 +179,7 @@ TARGET(PUSH_NULL) { PyObject *res; - #line 247 "Python/bytecodes.c" + #line 246 "Python/bytecodes.c" res = NULL; #line 185 "Python/generated_cases.c.h" STACK_GROW(1); @@ -192,13 +192,13 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; - #line 243 "Python/bytecodes.c" + #line 242 "Python/bytecodes.c" #line 197 "Python/generated_cases.c.h" Py_DECREF(value); } { PyObject *value = _tmp_2; - #line 243 "Python/bytecodes.c" + #line 242 "Python/bytecodes.c" #line 203 "Python/generated_cases.c.h" Py_DECREF(value); } @@ -209,7 +209,7 @@ TARGET(INSTRUMENTED_END_FOR) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 253 "Python/bytecodes.c" + #line 252 "Python/bytecodes.c" /* Need to create a fake StopIteration error here, * to conform to PEP 380 */ if (PyGen_Check(receiver)) { @@ -229,7 +229,7 @@ TARGET(END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 266 "Python/bytecodes.c" + #line 265 "Python/bytecodes.c" Py_DECREF(receiver); #line 235 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -240,7 +240,7 @@ TARGET(INSTRUMENTED_END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 270 "Python/bytecodes.c" + #line 269 "Python/bytecodes.c" if (PyGen_Check(receiver) || PyCoro_CheckExact(receiver)) { PyErr_SetObject(PyExc_StopIteration, value); if (monitor_stop_iteration(tstate, frame, next_instr-1)) { @@ -258,11 +258,11 @@ TARGET(UNARY_NEGATIVE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 281 "Python/bytecodes.c" + #line 280 "Python/bytecodes.c" res = PyNumber_Negative(value); #line 264 "Python/generated_cases.c.h" Py_DECREF(value); - #line 283 "Python/bytecodes.c" + #line 282 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 268 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -272,11 +272,11 @@ TARGET(UNARY_NOT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 287 "Python/bytecodes.c" + #line 286 "Python/bytecodes.c" int err = PyObject_IsTrue(value); #line 278 "Python/generated_cases.c.h" Py_DECREF(value); - #line 289 "Python/bytecodes.c" + #line 288 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { res = Py_True; @@ -292,11 +292,11 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 299 "Python/bytecodes.c" + #line 298 "Python/bytecodes.c" res = PyNumber_Invert(value); #line 298 "Python/generated_cases.c.h" Py_DECREF(value); - #line 301 "Python/bytecodes.c" + #line 300 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 302 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -309,7 +309,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 317 "Python/bytecodes.c" + #line 316 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); #line 316 "Python/generated_cases.c.h" @@ -320,7 +320,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 322 "Python/bytecodes.c" + #line 321 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); @@ -341,7 +341,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 317 "Python/bytecodes.c" + #line 316 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); #line 348 "Python/generated_cases.c.h" @@ -352,7 +352,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 330 "Python/bytecodes.c" + #line 329 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); @@ -373,7 +373,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 317 "Python/bytecodes.c" + #line 316 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); #line 380 "Python/generated_cases.c.h" @@ -384,7 +384,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 338 "Python/bytecodes.c" + #line 337 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); @@ -405,7 +405,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 353 "Python/bytecodes.c" + #line 352 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); #line 412 "Python/generated_cases.c.h" @@ -416,7 +416,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 358 "Python/bytecodes.c" + #line 357 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * @@ -437,7 +437,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 353 "Python/bytecodes.c" + #line 352 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); #line 444 "Python/generated_cases.c.h" @@ -448,7 +448,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 366 "Python/bytecodes.c" + #line 365 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + @@ -469,7 +469,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 353 "Python/bytecodes.c" + #line 352 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); #line 476 "Python/generated_cases.c.h" @@ -480,7 +480,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 374 "Python/bytecodes.c" + #line 373 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - @@ -501,7 +501,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 389 "Python/bytecodes.c" + #line 388 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); #line 508 "Python/generated_cases.c.h" @@ -512,7 +512,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 394 "Python/bytecodes.c" + #line 393 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); @@ -533,7 +533,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 389 "Python/bytecodes.c" + #line 388 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); #line 540 "Python/generated_cases.c.h" @@ -543,7 +543,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 411 "Python/bytecodes.c" + #line 410 "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); @@ -579,7 +579,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 448 "Python/bytecodes.c" + #line 447 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -594,7 +594,7 @@ #line 595 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 460 "Python/bytecodes.c" + #line 459 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 600 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -608,7 +608,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 464 "Python/bytecodes.c" + #line 463 "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. @@ -632,7 +632,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 479 "Python/bytecodes.c" + #line 478 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -654,7 +654,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 494 "Python/bytecodes.c" + #line 493 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -679,7 +679,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 510 "Python/bytecodes.c" + #line 509 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -704,7 +704,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 526 "Python/bytecodes.c" + #line 525 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -715,7 +715,7 @@ #line 716 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 534 "Python/bytecodes.c" + #line 533 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub @@ -731,7 +731,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 541 "Python/bytecodes.c" + #line 540 "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); @@ -760,7 +760,7 @@ TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 566 "Python/bytecodes.c" + #line 565 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; #line 766 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -770,11 +770,11 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 570 "Python/bytecodes.c" + #line 569 "Python/bytecodes.c" int err = PySet_Add(set, v); #line 776 "Python/generated_cases.c.h" Py_DECREF(v); - #line 572 "Python/bytecodes.c" + #line 571 "Python/bytecodes.c" if (err) goto pop_1_error; #line 780 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -788,7 +788,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 582 "Python/bytecodes.c" + #line 581 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -807,7 +807,7 @@ Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 597 "Python/bytecodes.c" + #line 596 "Python/bytecodes.c" if (err) goto pop_3_error; #line 813 "Python/generated_cases.c.h" STACK_SHRINK(3); @@ -819,7 +819,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 601 "Python/bytecodes.c" + #line 600 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -846,7 +846,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 620 "Python/bytecodes.c" + #line 619 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); @@ -861,13 +861,13 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 628 "Python/bytecodes.c" + #line 627 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); #line 868 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 631 "Python/bytecodes.c" + #line 630 "Python/bytecodes.c" if (err) goto pop_2_error; #line 873 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -877,12 +877,12 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 635 "Python/bytecodes.c" + #line 634 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); #line 884 "Python/generated_cases.c.h" Py_DECREF(value); - #line 638 "Python/bytecodes.c" + #line 637 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 888 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -893,13 +893,13 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 642 "Python/bytecodes.c" + #line 641 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); #line 900 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 645 "Python/bytecodes.c" + #line 644 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 905 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -909,7 +909,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 649 "Python/bytecodes.c" + #line 648 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -932,7 +932,7 @@ TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 669 "Python/bytecodes.c" + #line 668 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); /* Restore previous cframe and return. */ @@ -946,7 +946,7 @@ TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 680 "Python/bytecodes.c" + #line 679 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -964,7 +964,7 @@ TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 695 "Python/bytecodes.c" + #line 694 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -985,7 +985,7 @@ } TARGET(RETURN_CONST) { - #line 714 "Python/bytecodes.c" + #line 713 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1003,7 +1003,7 @@ } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 730 "Python/bytecodes.c" + #line 729 "Python/bytecodes.c" PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1027,7 +1027,7 @@ TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 750 "Python/bytecodes.c" + #line 749 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1042,14 +1042,14 @@ type->tp_name); #line 1044 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 763 "Python/bytecodes.c" + #line 762 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); #line 1051 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 768 "Python/bytecodes.c" + #line 767 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1070,7 +1070,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 783 "Python/bytecodes.c" + #line 782 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1122,7 +1122,7 @@ TARGET(GET_AWAITABLE) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 828 "Python/bytecodes.c" + #line 827 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { @@ -1131,7 +1131,7 @@ #line 1133 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 835 "Python/bytecodes.c" + #line 834 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1159,7 +1159,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 859 "Python/bytecodes.c" + #line 858 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1215,7 +1215,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 908 "Python/bytecodes.c" + #line 907 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1236,7 +1236,7 @@ TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 926 "Python/bytecodes.c" + #line 925 "Python/bytecodes.c" assert(frame != &entry_frame); assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ PyGenObject *gen = _PyFrame_GetGenerator(frame); @@ -1259,7 +1259,7 @@ TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 946 "Python/bytecodes.c" + #line 945 "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. @@ -1281,7 +1281,7 @@ TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 965 "Python/bytecodes.c" + #line 964 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); #line 1288 "Python/generated_cases.c.h" @@ -1292,7 +1292,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 970 "Python/bytecodes.c" + #line 969 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1316,13 +1316,13 @@ TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 990 "Python/bytecodes.c" + #line 989 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { #line 1323 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 993 "Python/bytecodes.c" + #line 992 "Python/bytecodes.c" } else { Py_INCREF(exc); @@ -1340,7 +1340,7 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1002 "Python/bytecodes.c" + #line 1001 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { @@ -1349,7 +1349,7 @@ Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1007 "Python/bytecodes.c" + #line 1006 "Python/bytecodes.c" none = Py_None; } else { @@ -1365,7 +1365,7 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1016 "Python/bytecodes.c" + #line 1015 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); #line 1371 "Python/generated_cases.c.h" STACK_GROW(1); @@ -1375,7 +1375,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1020 "Python/bytecodes.c" + #line 1019 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1405,7 +1405,7 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1045 "Python/bytecodes.c" + #line 1044 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; @@ -1414,7 +1414,7 @@ "no locals found when storing %R", name); #line 1416 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1052 "Python/bytecodes.c" + #line 1051 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) @@ -1423,7 +1423,7 @@ err = PyObject_SetItem(ns, name, v); #line 1425 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1059 "Python/bytecodes.c" + #line 1058 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1429 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1431,7 +1431,7 @@ } TARGET(DELETE_NAME) { - #line 1063 "Python/bytecodes.c" + #line 1062 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; @@ -1456,7 +1456,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1089 "Python/bytecodes.c" + #line 1088 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1471,7 +1471,7 @@ int res = unpack_iterable(tstate, seq, oparg, -1, top); #line 1473 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1102 "Python/bytecodes.c" + #line 1101 "Python/bytecodes.c" if (res == 0) goto pop_1_error; #line 1477 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1483,7 +1483,7 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1106 "Python/bytecodes.c" + #line 1105 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); @@ -1501,7 +1501,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1116 "Python/bytecodes.c" + #line 1115 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1520,7 +1520,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1127 "Python/bytecodes.c" + #line 1126 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1538,13 +1538,13 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1138 "Python/bytecodes.c" + #line 1137 "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 1546 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1142 "Python/bytecodes.c" + #line 1141 "Python/bytecodes.c" if (res == 0) goto pop_1_error; #line 1550 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); @@ -1557,7 +1557,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1153 "Python/bytecodes.c" + #line 1152 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); @@ -1576,7 +1576,7 @@ #line 1577 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1169 "Python/bytecodes.c" + #line 1168 "Python/bytecodes.c" if (err) goto pop_2_error; #line 1582 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -1586,12 +1586,12 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1173 "Python/bytecodes.c" + #line 1172 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); #line 1593 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1176 "Python/bytecodes.c" + #line 1175 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1597 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1600,12 +1600,12 @@ TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1180 "Python/bytecodes.c" + #line 1179 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); #line 1607 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1183 "Python/bytecodes.c" + #line 1182 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1611 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1613,7 +1613,7 @@ } TARGET(DELETE_GLOBAL) { - #line 1187 "Python/bytecodes.c" + #line 1186 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1633,7 +1633,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1201 "Python/bytecodes.c" + #line 1200 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1653,7 +1653,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1201 "Python/bytecodes.c" + #line 1200 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1667,7 +1667,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1213 "Python/bytecodes.c" + #line 1212 "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); @@ -1737,7 +1737,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1213 "Python/bytecodes.c" + #line 1212 "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); @@ -1806,7 +1806,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1282 "Python/bytecodes.c" + #line 1281 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1872,7 +1872,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1336 "Python/bytecodes.c" + #line 1335 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1898,7 +1898,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 1349 "Python/bytecodes.c" + #line 1348 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1923,7 +1923,7 @@ } TARGET(DELETE_FAST) { - #line 1366 "Python/bytecodes.c" + #line 1365 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); @@ -1932,7 +1932,7 @@ } TARGET(MAKE_CELL) { - #line 1372 "Python/bytecodes.c" + #line 1371 "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); @@ -1946,7 +1946,7 @@ } TARGET(DELETE_DEREF) { - #line 1383 "Python/bytecodes.c" + #line 1382 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1964,7 +1964,7 @@ TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1396 "Python/bytecodes.c" + #line 1395 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus); @@ -2006,7 +2006,7 @@ TARGET(LOAD_DEREF) { PyObject *value; - #line 1433 "Python/bytecodes.c" + #line 1432 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2022,7 +2022,7 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1443 "Python/bytecodes.c" + #line 1442 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); @@ -2033,7 +2033,7 @@ } TARGET(COPY_FREE_VARS) { - #line 1450 "Python/bytecodes.c" + #line 1449 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = _PyFrame_GetCode(frame); assert(PyFunction_Check(frame->f_funcobj)); @@ -2051,13 +2051,13 @@ TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1463 "Python/bytecodes.c" + #line 1462 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); #line 2057 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1465 "Python/bytecodes.c" + #line 1464 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } #line 2063 "Python/generated_cases.c.h" STACK_SHRINK(oparg); @@ -2069,7 +2069,7 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1469 "Python/bytecodes.c" + #line 1468 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } #line 2076 "Python/generated_cases.c.h" @@ -2082,7 +2082,7 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1474 "Python/bytecodes.c" + #line 1473 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } #line 2089 "Python/generated_cases.c.h" @@ -2095,7 +2095,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1479 "Python/bytecodes.c" + #line 1478 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2108,7 +2108,7 @@ } #line 2110 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1490 "Python/bytecodes.c" + #line 1489 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); @@ -2121,11 +2121,11 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1497 "Python/bytecodes.c" + #line 1496 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); #line 2127 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1499 "Python/bytecodes.c" + #line 1498 "Python/bytecodes.c" if (err < 0) goto pop_1_error; #line 2131 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -2135,7 +2135,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1503 "Python/bytecodes.c" + #line 1502 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2160,7 +2160,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1520 "Python/bytecodes.c" + #line 1519 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2172,7 +2172,7 @@ for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1528 "Python/bytecodes.c" + #line 1527 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } #line 2178 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); @@ -2182,7 +2182,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1532 "Python/bytecodes.c" + #line 1531 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2230,7 +2230,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1574 "Python/bytecodes.c" + #line 1573 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2245,7 +2245,7 @@ Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1584 "Python/bytecodes.c" + #line 1583 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } #line 2251 "Python/generated_cases.c.h" STACK_SHRINK(oparg); @@ -2255,7 +2255,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1588 "Python/bytecodes.c" + #line 1587 "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)) { @@ -2265,7 +2265,7 @@ } #line 2267 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1596 "Python/bytecodes.c" + #line 1595 "Python/bytecodes.c" if (true) goto pop_1_error; } #line 2272 "Python/generated_cases.c.h" @@ -2276,14 +2276,14 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1602 "Python/bytecodes.c" + #line 1601 "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 2285 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1607 "Python/bytecodes.c" + #line 1606 "Python/bytecodes.c" if (true) goto pop_1_error; } #line 2290 "Python/generated_cases.c.h" @@ -2295,7 +2295,7 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1613 "Python/bytecodes.c" + #line 1612 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ @@ -2307,7 +2307,7 @@ } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1621 "Python/bytecodes.c" + #line 1620 "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 @@ -2324,7 +2324,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1635 "Python/bytecodes.c" + #line 1634 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2370,7 +2370,7 @@ Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1677 "Python/bytecodes.c" + #line 1676 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); @@ -2390,7 +2390,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1696 "Python/bytecodes.c" + #line 1695 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2401,7 +2401,7 @@ Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1703 "Python/bytecodes.c" + #line 1702 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; #line 2407 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -2418,7 +2418,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1707 "Python/bytecodes.c" + #line 1706 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2455,7 +2455,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1746 "Python/bytecodes.c" + #line 1745 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2491,7 +2491,7 @@ */ #line 2493 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1780 "Python/bytecodes.c" + #line 1779 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2502,7 +2502,7 @@ res = PyObject_GetAttr(owner, name); #line 2504 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1789 "Python/bytecodes.c" + #line 1788 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } #line 2509 "Python/generated_cases.c.h" @@ -2519,7 +2519,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1798 "Python/bytecodes.c" + #line 1797 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2547,7 +2547,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1814 "Python/bytecodes.c" + #line 1813 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2575,7 +2575,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 1829 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2617,7 +2617,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 1859 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2642,7 +2642,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1873 "Python/bytecodes.c" + #line 1872 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2668,7 +2668,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 1888 "Python/bytecodes.c" + #line 1887 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2700,7 +2700,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 1914 "Python/bytecodes.c" + #line 1913 "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); @@ -2734,7 +2734,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 1942 "Python/bytecodes.c" + #line 1941 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2763,7 +2763,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 1962 "Python/bytecodes.c" + #line 1961 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2813,7 +2813,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 2003 "Python/bytecodes.c" + #line 2002 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2835,7 +2835,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2022 "Python/bytecodes.c" + #line 2021 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2851,7 +2851,7 @@ #line 2852 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2035 "Python/bytecodes.c" + #line 2034 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 2857 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -2864,7 +2864,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2039 "Python/bytecodes.c" + #line 2038 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2886,7 +2886,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2053 "Python/bytecodes.c" + #line 2052 "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); @@ -2912,7 +2912,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2071 "Python/bytecodes.c" + #line 2070 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2935,12 +2935,12 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2085 "Python/bytecodes.c" + #line 2084 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; #line 2941 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2087 "Python/bytecodes.c" + #line 2086 "Python/bytecodes.c" b = res ? Py_True : Py_False; #line 2946 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -2952,12 +2952,12 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2091 "Python/bytecodes.c" + #line 2090 "Python/bytecodes.c" int res = PySequence_Contains(right, left); #line 2958 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2093 "Python/bytecodes.c" + #line 2092 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; #line 2964 "Python/generated_cases.c.h" @@ -2971,12 +2971,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2098 "Python/bytecodes.c" + #line 2097 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { #line 2977 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2100 "Python/bytecodes.c" + #line 2099 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2987,7 +2987,7 @@ #line 2988 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2108 "Python/bytecodes.c" + #line 2107 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3006,19 +3006,19 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2119 "Python/bytecodes.c" + #line 2118 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { #line 3013 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2122 "Python/bytecodes.c" + #line 2121 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); #line 3020 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2127 "Python/bytecodes.c" + #line 2126 "Python/bytecodes.c" b = res ? Py_True : Py_False; #line 3024 "Python/generated_cases.c.h" stack_pointer[-1] = b; @@ -3029,13 +3029,13 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2131 "Python/bytecodes.c" + #line 2130 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); #line 3036 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2134 "Python/bytecodes.c" + #line 2133 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 3041 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -3046,7 +3046,7 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2138 "Python/bytecodes.c" + #line 2137 "Python/bytecodes.c" PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; @@ -3057,14 +3057,14 @@ } TARGET(JUMP_FORWARD) { - #line 2144 "Python/bytecodes.c" + #line 2143 "Python/bytecodes.c" JUMPBY(oparg); #line 3063 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2148 "Python/bytecodes.c" + #line 2147 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3087,7 +3087,7 @@ } TARGET(ENTER_EXECUTOR) { - #line 2178 "Python/bytecodes.c" + #line 2177 "Python/bytecodes.c" PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg]; Py_INCREF(executor); @@ -3102,7 +3102,7 @@ TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2190 "Python/bytecodes.c" + #line 2189 "Python/bytecodes.c" if (Py_IsFalse(cond)) { JUMPBY(oparg); } @@ -3110,7 +3110,7 @@ int err = PyObject_IsTrue(cond); #line 3112 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2196 "Python/bytecodes.c" + #line 2195 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -3125,7 +3125,7 @@ TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2206 "Python/bytecodes.c" + #line 2205 "Python/bytecodes.c" if (Py_IsTrue(cond)) { JUMPBY(oparg); } @@ -3133,7 +3133,7 @@ int err = PyObject_IsTrue(cond); #line 3135 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2212 "Python/bytecodes.c" + #line 2211 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -3148,11 +3148,11 @@ TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2222 "Python/bytecodes.c" + #line 2221 "Python/bytecodes.c" if (!Py_IsNone(value)) { #line 3154 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2224 "Python/bytecodes.c" + #line 2223 "Python/bytecodes.c" JUMPBY(oparg); } #line 3159 "Python/generated_cases.c.h" @@ -3162,14 +3162,14 @@ TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2229 "Python/bytecodes.c" + #line 2228 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { #line 3171 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2234 "Python/bytecodes.c" + #line 2233 "Python/bytecodes.c" } #line 3175 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -3177,7 +3177,7 @@ } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2238 "Python/bytecodes.c" + #line 2237 "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. @@ -3191,7 +3191,7 @@ TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2247 "Python/bytecodes.c" + #line 2246 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; @@ -3208,7 +3208,7 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2255 "Python/bytecodes.c" + #line 2254 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); @@ -3217,7 +3217,7 @@ Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2260 "Python/bytecodes.c" + #line 2259 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3234,7 +3234,7 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2270 "Python/bytecodes.c" + #line 2269 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; #line 3241 "Python/generated_cases.c.h" @@ -3246,7 +3246,7 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2275 "Python/bytecodes.c" + #line 2274 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; #line 3253 "Python/generated_cases.c.h" @@ -3259,7 +3259,7 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2280 "Python/bytecodes.c" + #line 2279 "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; @@ -3272,12 +3272,12 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2286 "Python/bytecodes.c" + #line 2285 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); #line 3279 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2289 "Python/bytecodes.c" + #line 2288 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; #line 3283 "Python/generated_cases.c.h" stack_pointer[-1] = iter; @@ -3287,7 +3287,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2293 "Python/bytecodes.c" + #line 2292 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3312,7 +3312,7 @@ } #line 3314 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2316 "Python/bytecodes.c" + #line 2315 "Python/bytecodes.c" } #line 3318 "Python/generated_cases.c.h" stack_pointer[-1] = iter; @@ -3324,7 +3324,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2334 "Python/bytecodes.c" + #line 2333 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3364,7 +3364,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2368 "Python/bytecodes.c" + #line 2367 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3397,7 +3397,7 @@ TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2396 "Python/bytecodes.c" + #line 2395 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3428,7 +3428,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2419 "Python/bytecodes.c" + #line 2418 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3459,7 +3459,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2442 "Python/bytecodes.c" + #line 2441 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3487,7 +3487,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2463 "Python/bytecodes.c" + #line 2462 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3510,7 +3510,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2481 "Python/bytecodes.c" + #line 2480 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3535,7 +3535,7 @@ } #line 3537 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2504 "Python/bytecodes.c" + #line 2503 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { @@ -3553,7 +3553,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2513 "Python/bytecodes.c" + #line 2512 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3581,7 +3581,7 @@ } #line 3583 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2539 "Python/bytecodes.c" + #line 2538 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { @@ -3600,7 +3600,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2548 "Python/bytecodes.c" + #line 2547 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3630,7 +3630,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2587 "Python/bytecodes.c" + #line 2586 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3654,7 +3654,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 2599 "Python/bytecodes.c" + #line 2598 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3685,7 +3685,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2618 "Python/bytecodes.c" + #line 2617 "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); @@ -3709,7 +3709,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2630 "Python/bytecodes.c" + #line 2629 "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; @@ -3731,22 +3731,13 @@ DISPATCH(); } - TARGET(KW_NAMES) { - #line 2646 "Python/bytecodes.c" - assert(kwnames == NULL); - assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); - kwnames = GETITEM(FRAME_CO_CONSTS, oparg); - #line 3740 "Python/generated_cases.c.h" - DISPATCH(); - } - TARGET(INSTRUMENTED_CALL) { - #line 2652 "Python/bytecodes.c" - int is_meth = PEEK(oparg+2) != NULL; - int total_args = oparg + is_meth; - PyObject *function = PEEK(total_args + 1); + #line 2645 "Python/bytecodes.c" + int is_meth = PEEK((oparg >> 1) + 2 + (oparg & 1)) != NULL; + int total_args = (oparg >> 1) + is_meth; + PyObject *function = PEEK(total_args + 1 + (oparg & 1)); PyObject *arg = total_args == 0 ? - &_PyInstrumentation_MISSING : PEEK(total_args); + &_PyInstrumentation_MISSING : PEEK(total_args + (oparg & 1)); int err = _Py_call_instrumentation_2args( tstate, PY_MONITORING_EVENT_CALL, frame, next_instr-1, function, arg); @@ -3754,19 +3745,20 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3758 "Python/generated_cases.c.h" + #line 3749 "Python/generated_cases.c.h" } TARGET(CALL) { PREDICTED(CALL); static_assert(INLINE_CACHE_ENTRIES_CALL == 3, "incorrect cache size"); - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject *kwnames = (oparg & 1) ? stack_pointer[-(((oparg & 1) ? 1 : 0))] : NULL; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2697 "Python/bytecodes.c" + #line 2689 "Python/bytecodes.c" int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -3783,7 +3775,7 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ if (!is_meth && Py_TYPE(callable) == &PyMethod_Type) { - is_meth = 1; // For consistenct; it's dead, though + is_meth = 1; // For consistency; it's dead, though args--; total_args++; PyObject *self = ((PyMethodObject *)callable)->im_self; @@ -3805,9 +3797,9 @@ tstate, (PyFunctionObject *)callable, locals, args, positional_args, kwnames ); - kwnames = NULL; + Py_XDECREF(kwnames); // Manipulate stack directly since we leave using DISPATCH_INLINED(). - STACK_SHRINK(oparg + 2); + STACK_SHRINK((oparg >> 1) + 2 + (oparg & 1)); // The frame has stolen all the arguments from the stack, // so there is no need to clean them up. if (new_frame == NULL) { @@ -3824,7 +3816,7 @@ kwnames); if (opcode == INSTRUMENTED_CALL) { PyObject *arg = total_args == 0 ? - &_PyInstrumentation_MISSING : PEEK(total_args); + &_PyInstrumentation_MISSING : PEEK(total_args + (oparg & 1)); if (res == NULL) { _Py_call_instrumentation_exc2( tstate, PY_MONITORING_EVENT_C_RAISE, @@ -3839,15 +3831,15 @@ } } } - kwnames = NULL; + Py_XDECREF(kwnames); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); Py_DECREF(callable); for (int i = 0; i < total_args; i++) { Py_DECREF(args[i]); } - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3850 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 3842 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -3856,32 +3848,33 @@ } TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2785 "Python/bytecodes.c" + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + #line 2777 "Python/bytecodes.c" + assert((oparg & 1) == 0); DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); PyObject *self = ((PyMethodObject *)callable)->im_self; - PEEK(oparg + 1) = Py_NewRef(self); // callable + PEEK((oparg >> 1) + 1) = Py_NewRef(self); // callable PyObject *meth = ((PyMethodObject *)callable)->im_func; - PEEK(oparg + 2) = Py_NewRef(meth); // method + PEEK((oparg >> 1) + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3872 "Python/generated_cases.c.h" + #line 3865 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { PREDICTED(CALL_PY_EXACT_ARGS); - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2797 "Python/bytecodes.c" - assert(kwnames == NULL); + #line 2790 "Python/bytecodes.c" + assert((oparg & 1) == 0); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; - int argcount = oparg; + int argcount = oparg >> 1; if (is_meth) { callable = method; args--; @@ -3899,23 +3892,23 @@ new_frame->localsplus[i] = args[i]; } // Manipulate stack directly since we leave using DISPATCH_INLINED(). - STACK_SHRINK(oparg + 2); + STACK_SHRINK((oparg >> 1) + 2); SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3907 "Python/generated_cases.c.h" + #line 3900 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2825 "Python/bytecodes.c" - assert(kwnames == NULL); + #line 2818 "Python/bytecodes.c" + assert((oparg & 1) == 0); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; - int argcount = oparg; + int argcount = oparg >> 1; if (is_meth) { callable = method; args--; @@ -3943,21 +3936,21 @@ new_frame->localsplus[i] = Py_NewRef(def); } // Manipulate stack and cache directly since we leave using DISPATCH_INLINED(). - STACK_SHRINK(oparg + 2); + STACK_SHRINK((oparg >> 1) + 2); SKIP_OVER(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3951 "Python/generated_cases.c.h" + #line 3944 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *null = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *null = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2863 "Python/bytecodes.c" - assert(kwnames == NULL); - assert(oparg == 1); + #line 2856 "Python/bytecodes.c" + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); DEOPT_IF(null != NULL, CALL); PyObject *obj = args[0]; DEOPT_IF(callable != (PyObject *)&PyType_Type, CALL); @@ -3965,8 +3958,8 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3969 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + #line 3962 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -3974,13 +3967,13 @@ } TARGET(CALL_NO_KW_STR_1) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *null = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *null = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2875 "Python/bytecodes.c" - assert(kwnames == NULL); - assert(oparg == 1); + #line 2868 "Python/bytecodes.c" + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); DEOPT_IF(null != NULL, CALL); DEOPT_IF(callable != (PyObject *)&PyUnicode_Type, CALL); STAT_INC(CALL, hit); @@ -3988,9 +3981,9 @@ res = PyObject_Str(arg); Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3993 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 3986 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -3999,13 +3992,13 @@ } TARGET(CALL_NO_KW_TUPLE_1) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *null = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *null = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2889 "Python/bytecodes.c" - assert(kwnames == NULL); - assert(oparg == 1); + #line 2882 "Python/bytecodes.c" + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); DEOPT_IF(null != NULL, CALL); DEOPT_IF(callable != (PyObject *)&PyTuple_Type, CALL); STAT_INC(CALL, hit); @@ -4013,9 +4006,9 @@ res = PySequence_Tuple(arg); Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4018 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4011 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4024,13 +4017,14 @@ } TARGET(CALL_BUILTIN_CLASS) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject *kwnames = (oparg & 1) ? stack_pointer[-(((oparg & 1) ? 1 : 0))] : NULL; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2903 "Python/bytecodes.c" + #line 2896 "Python/bytecodes.c" int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -4043,15 +4037,15 @@ STAT_INC(CALL, hit); res = tp->tp_vectorcall((PyObject *)tp, args, total_args - kwnames_len, kwnames); - kwnames = NULL; + Py_XDECREF(kwnames); /* Free the arguments. */ for (int i = 0; i < total_args; i++) { Py_DECREF(args[i]); } Py_DECREF(tp); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4054 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4048 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4060,15 +4054,15 @@ } TARGET(CALL_NO_KW_BUILTIN_O) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2928 "Python/bytecodes.c" + #line 2921 "Python/bytecodes.c" /* Builtin METH_O functions */ - assert(kwnames == NULL); + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -4091,9 +4085,9 @@ Py_DECREF(arg); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4096 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4090 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4102,15 +4096,15 @@ } TARGET(CALL_NO_KW_BUILTIN_FAST) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2959 "Python/bytecodes.c" + #line 2952 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ - assert(kwnames == NULL); + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -4132,14 +4126,14 @@ Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } /* Not deopting because this doesn't mean our optimization was wrong. `res` can be NULL for valid reasons. Eg. getattr(x, 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4142 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + #line 4136 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4148,14 +4142,15 @@ } TARGET(CALL_BUILTIN_FAST_WITH_KEYWORDS) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject *kwnames = (oparg & 1) ? stack_pointer[-(((oparg & 1) ? 1 : 0))] : NULL; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 2994 "Python/bytecodes.c" + #line 2987 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -4176,16 +4171,16 @@ kwnames ); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); - kwnames = NULL; + Py_XDECREF(kwnames); /* Free the arguments. */ for (int i = 0; i < total_args; i++) { Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4188 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4183 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4194,15 +4189,15 @@ } TARGET(CALL_NO_KW_LEN) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 3029 "Python/bytecodes.c" - assert(kwnames == NULL); + #line 3022 "Python/bytecodes.c" + assert((oparg & 1) == 0); /* len(o) */ int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -4222,9 +4217,9 @@ Py_DECREF(callable); Py_DECREF(arg); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4227 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4222 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4232,15 +4227,15 @@ } TARGET(CALL_NO_KW_ISINSTANCE) { - PyObject **args = (stack_pointer - oparg); - PyObject *callable = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *callable = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 3056 "Python/bytecodes.c" - assert(kwnames == NULL); + #line 3049 "Python/bytecodes.c" + assert((oparg & 1) == 0); /* isinstance(o, o2) */ int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { callable = method; args--; @@ -4262,9 +4257,9 @@ Py_DECREF(inst); Py_DECREF(cls); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4267 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4262 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4272,12 +4267,12 @@ } TARGET(CALL_NO_KW_LIST_APPEND) { - PyObject **args = (stack_pointer - oparg); - PyObject *self = stack_pointer[-(1 + oparg)]; - PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3086 "Python/bytecodes.c" - assert(kwnames == NULL); - assert(oparg == 1); + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *self = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; + #line 3079 "Python/bytecodes.c" + assert((oparg & 1) == 0); + assert(oparg >> 1 == 1); assert(method != NULL); PyInterpreterState *interp = _PyInterpreterState_GET(); DEOPT_IF(method != interp->callable_cache.list_append, CALL); @@ -4293,17 +4288,17 @@ SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4297 "Python/generated_cases.c.h" + #line 4292 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { - PyObject **args = (stack_pointer - oparg); - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 3106 "Python/bytecodes.c" - assert(kwnames == NULL); + #line 3099 "Python/bytecodes.c" + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; @@ -4330,9 +4325,9 @@ Py_DECREF(self); Py_DECREF(arg); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4335 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4330 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4341,18 +4336,19 @@ } TARGET(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) { - PyObject **args = (stack_pointer - oparg); - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject *kwnames = (oparg & 1) ? stack_pointer[-(((oparg & 1) ? 1 : 0))] : NULL; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 3140 "Python/bytecodes.c" + #line 3133 "Python/bytecodes.c" int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; } PyMethodDescrObject *callable = - (PyMethodDescrObject *)PEEK(total_args + 1); + (PyMethodDescrObject *)PEEK(total_args + 1 + (oparg & 1)); DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), CALL); PyMethodDef *meth = callable->d_method; DEOPT_IF(meth->ml_flags != (METH_FASTCALL|METH_KEYWORDS), CALL); @@ -4365,16 +4361,16 @@ (_PyCFunctionFastWithKeywords)(void(*)(void))meth->ml_meth; res = cfunc(self, args + 1, nargs - KWNAMES_LEN(), kwnames); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); - kwnames = NULL; + Py_XDECREF(kwnames); /* Free the arguments. */ for (int i = 0; i < total_args; i++) { Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4377 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4373 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4383,14 +4379,14 @@ } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS) { - PyObject **args = (stack_pointer - oparg); - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 3172 "Python/bytecodes.c" - assert(kwnames == NULL); - assert(oparg == 0 || oparg == 1); + #line 3165 "Python/bytecodes.c" + assert((oparg & 1) == 0); + assert(oparg >> 1 == 0 || oparg >> 1 == 1); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; @@ -4414,9 +4410,9 @@ assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); Py_DECREF(self); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4419 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4415 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4425,13 +4421,13 @@ } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_FAST) { - PyObject **args = (stack_pointer - oparg); - PyObject *method = stack_pointer[-(2 + oparg)]; + PyObject **args = (stack_pointer - (((oparg & 1) ? 1 : 0) + (oparg >> 1))); + PyObject *method = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0) + (oparg >> 1))]; PyObject *res; - #line 3204 "Python/bytecodes.c" - assert(kwnames == NULL); + #line 3197 "Python/bytecodes.c" + assert((oparg & 1) == 0); int is_meth = method != NULL; - int total_args = oparg; + int total_args = oparg >> 1; if (is_meth) { args--; total_args++; @@ -4455,9 +4451,9 @@ Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4460 "Python/generated_cases.c.h" - STACK_SHRINK(oparg); + if (res == NULL) { STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); goto pop_2_error; } + #line 4456 "Python/generated_cases.c.h" + STACK_SHRINK((oparg >> 1) + ((oparg & 1) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 3; @@ -4466,9 +4462,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3235 "Python/bytecodes.c" + #line 3228 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4472 "Python/generated_cases.c.h" + #line 4468 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4477,7 +4473,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3239 "Python/bytecodes.c" + #line 3232 "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)); @@ -4539,14 +4535,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4543 "Python/generated_cases.c.h" + #line 4539 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3301 "Python/bytecodes.c" + #line 3294 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4550 "Python/generated_cases.c.h" + #line 4546 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4557,7 +4553,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3307 "Python/bytecodes.c" + #line 3300 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4569,7 +4565,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4573 "Python/generated_cases.c.h" + #line 4569 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4577,7 +4573,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3321 "Python/bytecodes.c" + #line 3314 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4602,14 +4598,14 @@ default: Py_UNREACHABLE(); } - #line 4606 "Python/generated_cases.c.h" + #line 4602 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3348 "Python/bytecodes.c" + #line 3341 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4630,7 +4626,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4634 "Python/generated_cases.c.h" + #line 4630 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4638,15 +4634,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3371 "Python/bytecodes.c" + #line 3364 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4644 "Python/generated_cases.c.h" + #line 4640 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3373 "Python/bytecodes.c" + #line 3366 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4650 "Python/generated_cases.c.h" + #line 4646 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4656,14 +4652,14 @@ TARGET(CONVERT_VALUE) { PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3377 "Python/bytecodes.c" + #line 3370 "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 4667 "Python/generated_cases.c.h" + #line 4663 "Python/generated_cases.c.h" stack_pointer[-1] = result; DISPATCH(); } @@ -4671,7 +4667,7 @@ TARGET(FORMAT_SIMPLE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 3386 "Python/bytecodes.c" + #line 3379 "Python/bytecodes.c" /* If value is a unicode object, then we know the result * of format(value) is value itself. */ if (!PyUnicode_CheckExact(value)) { @@ -4682,7 +4678,7 @@ else { res = value; } - #line 4686 "Python/generated_cases.c.h" + #line 4682 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -4691,12 +4687,12 @@ PyObject *fmt_spec = stack_pointer[-1]; PyObject *value = stack_pointer[-2]; PyObject *res; - #line 3399 "Python/bytecodes.c" + #line 3392 "Python/bytecodes.c" res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); if (res == NULL) goto pop_2_error; - #line 4700 "Python/generated_cases.c.h" + #line 4696 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -4705,10 +4701,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3406 "Python/bytecodes.c" + #line 3399 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4712 "Python/generated_cases.c.h" + #line 4708 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4720,7 +4716,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3411 "Python/bytecodes.c" + #line 3404 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4735,12 +4731,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4739 "Python/generated_cases.c.h" + #line 4735 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3426 "Python/bytecodes.c" + #line 3419 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4744 "Python/generated_cases.c.h" + #line 4740 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4750,16 +4746,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3431 "Python/bytecodes.c" + #line 3424 "Python/bytecodes.c" assert(oparg >= 2); - #line 4756 "Python/generated_cases.c.h" + #line 4752 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3435 "Python/bytecodes.c" + #line 3428 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4771,26 +4767,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4775 "Python/generated_cases.c.h" + #line 4771 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3449 "Python/bytecodes.c" + #line 3442 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4781 "Python/generated_cases.c.h" + #line 4777 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3453 "Python/bytecodes.c" + #line 3446 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4788 "Python/generated_cases.c.h" + #line 4784 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3458 "Python/bytecodes.c" + #line 3451 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4799,12 +4795,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4803 "Python/generated_cases.c.h" + #line 4799 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3469 "Python/bytecodes.c" + #line 3462 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4813,12 +4809,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4817 "Python/generated_cases.c.h" + #line 4813 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3480 "Python/bytecodes.c" + #line 3473 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4830,12 +4826,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4834 "Python/generated_cases.c.h" + #line 4830 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3494 "Python/bytecodes.c" + #line 3487 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4847,30 +4843,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4851 "Python/generated_cases.c.h" + #line 4847 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3508 "Python/bytecodes.c" + #line 3501 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4862 "Python/generated_cases.c.h" + #line 4858 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3516 "Python/bytecodes.c" + #line 3509 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4869 "Python/generated_cases.c.h" + #line 4865 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3521 "Python/bytecodes.c" + #line 3514 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4876 "Python/generated_cases.c.h" + #line 4872 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index aa1db721d1ae71..f297e3b19ed043 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -350,46 +350,44 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case LOAD_ATTR_METHOD_LAZY_DICT: return 1; - case KW_NAMES: - return 0; case INSTRUMENTED_CALL: return 0; case CALL: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_BOUND_METHOD_EXACT_ARGS: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_PY_EXACT_ARGS: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_PY_WITH_DEFAULTS: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_TYPE_1: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_STR_1: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_TUPLE_1: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_BUILTIN_CLASS: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_BUILTIN_O: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_BUILTIN_FAST: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_BUILTIN_FAST_WITH_KEYWORDS: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_LEN: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_ISINSTANCE: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_LIST_APPEND: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_METHOD_DESCRIPTOR_O: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case CALL_NO_KW_METHOD_DESCRIPTOR_FAST: - return oparg + 2; + return (oparg >> 1) + ((oparg & 1) ? 1 : 0) + 2; case INSTRUMENTED_CALL_FUNCTION_EX: return 0; case CALL_FUNCTION_EX: @@ -772,8 +770,6 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return ((oparg & 1) ? 1 : 0) + 1; case LOAD_ATTR_METHOD_LAZY_DICT: return ((oparg & 1) ? 1 : 0) + 1; - case KW_NAMES: - return 0; case INSTRUMENTED_CALL: return 0; case CALL: @@ -1048,7 +1044,6 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[512] = { [LOAD_ATTR_METHOD_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, [LOAD_ATTR_METHOD_NO_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, [LOAD_ATTR_METHOD_LAZY_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, - [KW_NAMES] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG }, [INSTRUMENTED_CALL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, [CALL] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, [CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 451d8bbd17fa63..6f24aa4e194b8a 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -171,7 +171,7 @@ static void *opcode_targets[256] = { &&TARGET_STORE_FAST_LOAD_FAST, &&TARGET_STORE_FAST_STORE_FAST, &&TARGET_CALL, - &&TARGET_KW_NAMES, + &&_unknown_opcode, &&TARGET_CALL_INTRINSIC_1, &&TARGET_CALL_INTRINSIC_2, &&TARGET_LOAD_FROM_DICT_OR_GLOBALS, diff --git a/Python/specialize.c b/Python/specialize.c index 44b14c5952315f..4eb08c63adb1a7 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -1502,7 +1502,7 @@ specialize_class_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs, } if (tp->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) { int oparg = instr->op.arg; - if (nargs == 1 && kwnames == NULL && oparg == 1) { + if (nargs == 1 && kwnames == NULL && (oparg >> 1) == 1) { if (tp == &PyUnicode_Type) { instr->op.code = CALL_NO_KW_STR_1; return 0; @@ -1605,7 +1605,7 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr, _Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_CALL + 1]; bool pop = (next.op.code == POP_TOP); int oparg = instr->op.arg; - if ((PyObject *)descr == list_append && oparg == 1 && pop) { + if ((PyObject *)descr == list_append && (oparg >> 1) == 1 && pop) { instr->op.code = CALL_NO_KW_LIST_APPEND; return 0; }