diff --git a/Python/bytecodes.c b/Python/bytecodes.c index cd8b674370b..2d9671f27ed 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -210,7 +210,7 @@ dummy_func( } inst(LOAD_CONST, (-- value)) { - value = GETITEM(frame->f_code->co_consts, oparg); + value = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(value); } @@ -711,7 +711,7 @@ dummy_func( } inst(RETURN_CONST, (--)) { - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -727,7 +727,7 @@ dummy_func( } inst(INSTRUMENTED_RETURN_CONST, (--)) { - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -924,6 +924,7 @@ dummy_func( inst(INSTRUMENTED_YIELD_VALUE, (retval -- unused)) { assert(frame != &entry_frame); + assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; _PyFrame_SetStackPointer(frame, stack_pointer - 1); @@ -945,6 +946,7 @@ dummy_func( // 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. + assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1040,7 +1042,7 @@ dummy_func( inst(STORE_NAME, (v -- )) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1058,7 +1060,7 @@ dummy_func( } inst(DELETE_NAME, (--)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1150,7 +1152,7 @@ dummy_func( inst(STORE_ATTR, (counter/1, unused/3, v, owner --)) { #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); next_instr--; _Py_Specialize_StoreAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1161,28 +1163,28 @@ dummy_func( #else (void)counter; // Unused. #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); DECREF_INPUTS(); ERROR_IF(err, error); } inst(DELETE_ATTR, (owner --)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); DECREF_INPUTS(); ERROR_IF(err, error); } inst(STORE_GLOBAL, (v --)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); DECREF_INPUTS(); ERROR_IF(err, error); } inst(DELETE_GLOBAL, (--)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); // Can't use ERROR_IF here. @@ -1208,7 +1210,7 @@ dummy_func( macro(LOAD_LOCALS) = _LOAD_LOCALS; op(_LOAD_FROM_DICT_OR_GLOBALS, (mod_or_class_dict -- v)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); if (v != NULL) { @@ -1280,7 +1282,7 @@ dummy_func( #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadGlobal(GLOBALS(), BUILTINS(), next_instr, name); DISPATCH_SAME_OPARG(); @@ -1288,7 +1290,7 @@ dummy_func( STAT_INC(LOAD_GLOBAL, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); if (PyDict_CheckExact(GLOBALS()) && PyDict_CheckExact(BUILTINS())) { @@ -1630,7 +1632,7 @@ dummy_func( }; inst(LOAD_SUPER_ATTR, (unused/1, global_super, class, self -- res2 if (oparg & 1), res)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; @@ -1695,7 +1697,7 @@ dummy_func( DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); DECREF_INPUTS(); ERROR_IF(res == NULL, error); @@ -1706,7 +1708,7 @@ dummy_func( DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); PyTypeObject *cls = (PyTypeObject *)class; int method_found = 0; res2 = _PySuper_Lookup(cls, self, name, @@ -1744,7 +1746,7 @@ dummy_func( #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1752,7 +1754,7 @@ dummy_func( STAT_INC(LOAD_ATTR, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 1); if (oparg & 1) { /* Designed to work in tandem with CALL, pushes two values. */ PyObject* meth = NULL; @@ -1834,7 +1836,7 @@ dummy_func( PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, LOAD_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); uint16_t hint = index; DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, LOAD_ATTR); if (DK_IS_UNICODE(dict->ma_keys)) { @@ -1922,7 +1924,7 @@ dummy_func( DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), LOAD_ATTR); STAT_INC(LOAD_ATTR, hit); - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 1); Py_INCREF(f); _PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, f, 2); // Manipulate stack directly because we exit with DISPATCH_INLINED(). @@ -1966,7 +1968,7 @@ dummy_func( PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, STORE_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, STORE_ATTR); PyObject *old_value; uint64_t new_version; @@ -2126,14 +2128,14 @@ dummy_func( } inst(IMPORT_NAME, (level, fromlist -- res)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); DECREF_INPUTS(); ERROR_IF(res == NULL, error); } inst(IMPORT_FROM, (from -- from, res)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); ERROR_IF(res == NULL, error); } @@ -2637,8 +2639,8 @@ dummy_func( inst(KW_NAMES, (--)) { assert(kwnames == NULL); - assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); - kwnames = GETITEM(frame->f_code->co_consts, oparg); + assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); + kwnames = GETITEM(FRAME_CO_CONSTS, oparg); } inst(INSTRUMENTED_CALL, ( -- )) { diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 44d6ee86569..6f6fabc37ef 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -219,6 +219,11 @@ GETITEM(PyObject *v, Py_ssize_t i) { #define STACK_SHRINK(n) BASIC_STACKADJ(-(n)) #endif + +/* Data access macros */ +#define FRAME_CO_CONSTS (frame->f_code->co_consts) +#define FRAME_CO_NAMES (frame->f_code->co_names) + /* Local variable macros */ #define GETLOCAL(i) (frame->localsplus[i]) diff --git a/Python/compile.c b/Python/compile.c index 589d92f5a7e..399a702ac1d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -248,6 +248,8 @@ instr_sequence_use_label(instr_sequence *seq, int lbl) { static int instr_sequence_addop(instr_sequence *seq, int opcode, int oparg, location loc) { + assert(!HAS_ARG(opcode) == !OPCODE_HAS_ARG(opcode)); + assert(!HAS_CONST(opcode) == !OPCODE_HAS_CONST(opcode)); assert(0 <= opcode && opcode <= MAX_OPCODE); assert(IS_PSEUDO_OPCODE(opcode) == IS_PSEUDO_INSTR(opcode)); assert(IS_WITHIN_OPCODE_RANGE(opcode)); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index ec0ba23090a..ef4c921f19a 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -124,7 +124,7 @@ TARGET(LOAD_CONST) { PyObject *value; #line 213 "Python/bytecodes.c" - value = GETITEM(frame->f_code->co_consts, oparg); + value = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(value); #line 130 "Python/generated_cases.c.h" STACK_GROW(1); @@ -988,7 +988,7 @@ TARGET(RETURN_CONST) { #line 714 "Python/bytecodes.c" - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1006,7 +1006,7 @@ TARGET(INSTRUMENTED_RETURN_CONST) { #line 730 "Python/bytecodes.c" - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1240,6 +1240,7 @@ PyObject *retval = stack_pointer[-1]; #line 926 "Python/bytecodes.c" assert(frame != &entry_frame); + assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; _PyFrame_SetStackPointer(frame, stack_pointer - 1); @@ -1255,15 +1256,16 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1259 "Python/generated_cases.c.h" + #line 1260 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 945 "Python/bytecodes.c" + #line 946 "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. + assert(oparg >= 0); /* make the generator identify this as HAS_ARG */ assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1276,15 +1278,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1280 "Python/generated_cases.c.h" + #line 1282 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 963 "Python/bytecodes.c" + #line 965 "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" + #line 1290 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1292,7 +1294,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 968 "Python/bytecodes.c" + #line 970 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1310,26 +1312,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1314 "Python/generated_cases.c.h" + #line 1316 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 988 "Python/bytecodes.c" + #line 990 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1323 "Python/generated_cases.c.h" + #line 1325 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 991 "Python/bytecodes.c" + #line 993 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1333 "Python/generated_cases.c.h" + #line 1335 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1340,23 +1342,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1000 "Python/bytecodes.c" + #line 1002 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { value = Py_NewRef(((PyStopIterationObject *)exc_value)->value); - #line 1349 "Python/generated_cases.c.h" + #line 1351 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1005 "Python/bytecodes.c" + #line 1007 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1360 "Python/generated_cases.c.h" + #line 1362 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1365,9 +1367,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1014 "Python/bytecodes.c" + #line 1016 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1371 "Python/generated_cases.c.h" + #line 1373 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1375,7 +1377,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1018 "Python/bytecodes.c" + #line 1020 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1397,7 +1399,7 @@ if (true) goto error; } } - #line 1401 "Python/generated_cases.c.h" + #line 1403 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1405,34 +1407,34 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1043 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 1045 "Python/bytecodes.c" + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1416 "Python/generated_cases.c.h" + #line 1418 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1050 "Python/bytecodes.c" + #line 1052 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); - #line 1425 "Python/generated_cases.c.h" + #line 1427 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1057 "Python/bytecodes.c" + #line 1059 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1429 "Python/generated_cases.c.h" + #line 1431 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1061 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 1063 "Python/bytecodes.c" + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1448,7 +1450,7 @@ name); goto error; } - #line 1452 "Python/generated_cases.c.h" + #line 1454 "Python/generated_cases.c.h" DISPATCH(); } @@ -1456,7 +1458,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1087 "Python/bytecodes.c" + #line 1089 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1469,11 +1471,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1473 "Python/generated_cases.c.h" + #line 1475 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1100 "Python/bytecodes.c" + #line 1102 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1477 "Python/generated_cases.c.h" + #line 1479 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1483,14 +1485,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1104 "Python/bytecodes.c" + #line 1106 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); STAT_INC(UNPACK_SEQUENCE, hit); values[0] = Py_NewRef(PyTuple_GET_ITEM(seq, 1)); values[1] = Py_NewRef(PyTuple_GET_ITEM(seq, 0)); - #line 1494 "Python/generated_cases.c.h" + #line 1496 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1501,7 +1503,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1114 "Python/bytecodes.c" + #line 1116 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1509,7 +1511,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1513 "Python/generated_cases.c.h" + #line 1515 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1520,7 +1522,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1125 "Python/bytecodes.c" + #line 1127 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1528,7 +1530,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1532 "Python/generated_cases.c.h" + #line 1534 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1538,15 +1540,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1136 "Python/bytecodes.c" + #line 1138 "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" + #line 1548 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1140 "Python/bytecodes.c" + #line 1142 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1550 "Python/generated_cases.c.h" + #line 1552 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1557,10 +1559,10 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1151 "Python/bytecodes.c" + #line 1153 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); next_instr--; _Py_Specialize_StoreAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1571,14 +1573,14 @@ #else (void)counter; // Unused. #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1577 "Python/generated_cases.c.h" + #line 1579 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1167 "Python/bytecodes.c" + #line 1169 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1582 "Python/generated_cases.c.h" + #line 1584 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1586,35 +1588,35 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1171 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 1173 "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" + #line 1595 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1174 "Python/bytecodes.c" + #line 1176 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1597 "Python/generated_cases.c.h" + #line 1599 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1178 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 1180 "Python/bytecodes.c" + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1607 "Python/generated_cases.c.h" + #line 1609 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1181 "Python/bytecodes.c" + #line 1183 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1611 "Python/generated_cases.c.h" + #line 1613 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1185 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 1187 "Python/bytecodes.c" + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); // Can't use ERROR_IF here. @@ -1625,7 +1627,7 @@ } goto error; } - #line 1629 "Python/generated_cases.c.h" + #line 1631 "Python/generated_cases.c.h" DISPATCH(); } @@ -1633,7 +1635,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1199 "Python/bytecodes.c" + #line 1201 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1641,7 +1643,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1645 "Python/generated_cases.c.h" + #line 1647 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1653,7 +1655,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1199 "Python/bytecodes.c" + #line 1201 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1661,14 +1663,14 @@ if (true) goto error; } Py_INCREF(locals); - #line 1665 "Python/generated_cases.c.h" + #line 1667 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1211 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 1213 "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); if (v != NULL) { @@ -1724,7 +1726,7 @@ } } } - #line 1728 "Python/generated_cases.c.h" + #line 1730 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1737,8 +1739,8 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1211 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 1213 "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); if (v != NULL) { @@ -1794,7 +1796,7 @@ } } } - #line 1798 "Python/generated_cases.c.h" + #line 1800 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1806,11 +1808,11 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1280 "Python/bytecodes.c" + #line 1282 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadGlobal(GLOBALS(), BUILTINS(), next_instr, name); DISPATCH_SAME_OPARG(); @@ -1818,7 +1820,7 @@ STAT_INC(LOAD_GLOBAL, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); if (PyDict_CheckExact(GLOBALS()) && PyDict_CheckExact(BUILTINS())) { @@ -1858,7 +1860,7 @@ } } null = NULL; - #line 1862 "Python/generated_cases.c.h" + #line 1864 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1872,7 +1874,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1334 "Python/bytecodes.c" + #line 1336 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1883,7 +1885,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1887 "Python/generated_cases.c.h" + #line 1889 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1898,7 +1900,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 1347 "Python/bytecodes.c" + #line 1349 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1913,7 +1915,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1917 "Python/generated_cases.c.h" + #line 1919 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1923,16 +1925,16 @@ } TARGET(DELETE_FAST) { - #line 1364 "Python/bytecodes.c" + #line 1366 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 1931 "Python/generated_cases.c.h" + #line 1933 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1370 "Python/bytecodes.c" + #line 1372 "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); @@ -1941,12 +1943,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 1945 "Python/generated_cases.c.h" + #line 1947 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1381 "Python/bytecodes.c" + #line 1383 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1957,14 +1959,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 1961 "Python/generated_cases.c.h" + #line 1963 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1394 "Python/bytecodes.c" + #line 1396 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -1999,14 +2001,14 @@ } Py_INCREF(value); } - #line 2003 "Python/generated_cases.c.h" + #line 2005 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1431 "Python/bytecodes.c" + #line 1433 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2014,7 +2016,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2018 "Python/generated_cases.c.h" + #line 2020 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2022,18 +2024,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1441 "Python/bytecodes.c" + #line 1443 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2031 "Python/generated_cases.c.h" + #line 2033 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1448 "Python/bytecodes.c" + #line 1450 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -2044,22 +2046,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2048 "Python/generated_cases.c.h" + #line 2050 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1461 "Python/bytecodes.c" + #line 1463 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2057 "Python/generated_cases.c.h" + #line 2059 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1463 "Python/bytecodes.c" + #line 1465 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2063 "Python/generated_cases.c.h" + #line 2065 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2069,10 +2071,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1467 "Python/bytecodes.c" + #line 1469 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2076 "Python/generated_cases.c.h" + #line 2078 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2082,10 +2084,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1472 "Python/bytecodes.c" + #line 1474 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2089 "Python/generated_cases.c.h" + #line 2091 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2095,7 +2097,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1477 "Python/bytecodes.c" + #line 1479 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2106,13 +2108,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2110 "Python/generated_cases.c.h" + #line 2112 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1488 "Python/bytecodes.c" + #line 1490 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2116 "Python/generated_cases.c.h" + #line 2118 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2121,13 +2123,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1495 "Python/bytecodes.c" - int err = _PySet_Update(set, iterable); - #line 2127 "Python/generated_cases.c.h" - Py_DECREF(iterable); #line 1497 "Python/bytecodes.c" + int err = _PySet_Update(set, iterable); + #line 2129 "Python/generated_cases.c.h" + Py_DECREF(iterable); + #line 1499 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2131 "Python/generated_cases.c.h" + #line 2133 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2135,7 +2137,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1501 "Python/bytecodes.c" + #line 1503 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2150,7 +2152,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2154 "Python/generated_cases.c.h" + #line 2156 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2160,7 +2162,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1518 "Python/bytecodes.c" + #line 1520 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2168,13 +2170,13 @@ if (map == NULL) goto error; - #line 2172 "Python/generated_cases.c.h" + #line 2174 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1526 "Python/bytecodes.c" + #line 1528 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2178 "Python/generated_cases.c.h" + #line 2180 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2182,7 +2184,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1530 "Python/bytecodes.c" + #line 1532 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2222,7 +2224,7 @@ Py_DECREF(ann_dict); } } - #line 2226 "Python/generated_cases.c.h" + #line 2228 "Python/generated_cases.c.h" DISPATCH(); } @@ -2230,7 +2232,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1572 "Python/bytecodes.c" + #line 1574 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2240,14 +2242,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2244 "Python/generated_cases.c.h" + #line 2246 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1582 "Python/bytecodes.c" + #line 1584 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2251 "Python/generated_cases.c.h" + #line 2253 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2255,7 +2257,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1586 "Python/bytecodes.c" + #line 1588 "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)) { @@ -2263,12 +2265,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2267 "Python/generated_cases.c.h" + #line 2269 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1594 "Python/bytecodes.c" + #line 1596 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2272 "Python/generated_cases.c.h" + #line 2274 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2276,17 +2278,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1600 "Python/bytecodes.c" + #line 1602 "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" + #line 2287 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1605 "Python/bytecodes.c" + #line 1607 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2290 "Python/generated_cases.c.h" + #line 2292 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2295,25 +2297,25 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1611 "Python/bytecodes.c" + #line 1613 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ // Do not DECREF INPUTS because the function steals the references if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error; - #line 2305 "Python/generated_cases.c.h" + #line 2307 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1619 "Python/bytecodes.c" + #line 1621 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(LOAD_SUPER_ATTR); - #line 2317 "Python/generated_cases.c.h" + #line 2319 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2324,8 +2326,8 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1633 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); + #line 1635 "Python/bytecodes.c" + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; @@ -2366,16 +2368,16 @@ } } } - #line 2370 "Python/generated_cases.c.h" + #line 2372 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1675 "Python/bytecodes.c" + #line 1677 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; - #line 2379 "Python/generated_cases.c.h" + #line 2381 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2390,20 +2392,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1694 "Python/bytecodes.c" + #line 1696 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2401 "Python/generated_cases.c.h" + #line 2403 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1701 "Python/bytecodes.c" + #line 1703 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2407 "Python/generated_cases.c.h" + #line 2409 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2418,12 +2420,12 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1705 "Python/bytecodes.c" + #line 1707 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); PyTypeObject *cls = (PyTypeObject *)class; int method_found = 0; res2 = _PySuper_Lookup(cls, self, name, @@ -2441,7 +2443,7 @@ res = res2; res2 = NULL; } - #line 2445 "Python/generated_cases.c.h" + #line 2447 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2455,11 +2457,11 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1744 "Python/bytecodes.c" + #line 1746 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -2467,7 +2469,7 @@ STAT_INC(LOAD_ATTR, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 1); if (oparg & 1) { /* Designed to work in tandem with CALL, pushes two values. */ PyObject* meth = NULL; @@ -2489,9 +2491,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2493 "Python/generated_cases.c.h" + #line 2495 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1778 "Python/bytecodes.c" + #line 1780 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2500,12 +2502,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2504 "Python/generated_cases.c.h" + #line 2506 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1787 "Python/bytecodes.c" + #line 1789 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2509 "Python/generated_cases.c.h" + #line 2511 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2519,7 +2521,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1796 "Python/bytecodes.c" + #line 1798 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2532,7 +2534,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2536 "Python/generated_cases.c.h" + #line 2538 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2547,7 +2549,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1812 "Python/bytecodes.c" + #line 1814 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2560,7 +2562,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2564 "Python/generated_cases.c.h" + #line 2566 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2575,7 +2577,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1828 "Python/bytecodes.c" + #line 1830 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2585,7 +2587,7 @@ PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, LOAD_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(frame->f_code->co_names, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); uint16_t hint = index; DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, LOAD_ATTR); if (DK_IS_UNICODE(dict->ma_keys)) { @@ -2602,7 +2604,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2606 "Python/generated_cases.c.h" + #line 2608 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2617,7 +2619,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1858 "Python/bytecodes.c" + #line 1860 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2627,7 +2629,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2631 "Python/generated_cases.c.h" + #line 2633 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2642,7 +2644,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1871 "Python/bytecodes.c" + #line 1873 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2654,7 +2656,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2658 "Python/generated_cases.c.h" + #line 2660 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2668,7 +2670,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 1886 "Python/bytecodes.c" + #line 1888 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2692,7 +2694,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2696 "Python/generated_cases.c.h" + #line 2698 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2700,7 +2702,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 1912 "Python/bytecodes.c" + #line 1914 "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); @@ -2714,7 +2716,7 @@ DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), LOAD_ATTR); STAT_INC(LOAD_ATTR, hit); - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 1); Py_INCREF(f); _PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, f, 2); // Manipulate stack directly because we exit with DISPATCH_INLINED(). @@ -2726,7 +2728,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2730 "Python/generated_cases.c.h" + #line 2732 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2734,7 +2736,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 1940 "Python/bytecodes.c" + #line 1942 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2752,7 +2754,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2756 "Python/generated_cases.c.h" + #line 2758 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2763,7 +2765,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 1960 "Python/bytecodes.c" + #line 1962 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2773,7 +2775,7 @@ PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, STORE_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, STORE_ATTR); PyObject *old_value; uint64_t new_version; @@ -2802,7 +2804,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2806 "Python/generated_cases.c.h" + #line 2808 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2813,7 +2815,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 2001 "Python/bytecodes.c" + #line 2003 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2823,7 +2825,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2827 "Python/generated_cases.c.h" + #line 2829 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2835,7 +2837,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2020 "Python/bytecodes.c" + #line 2022 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2848,12 +2850,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2852 "Python/generated_cases.c.h" + #line 2854 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2033 "Python/bytecodes.c" + #line 2035 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2857 "Python/generated_cases.c.h" + #line 2859 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2864,7 +2866,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2037 "Python/bytecodes.c" + #line 2039 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2875,7 +2877,7 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2879 "Python/generated_cases.c.h" + #line 2881 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2886,7 +2888,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2051 "Python/bytecodes.c" + #line 2053 "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); @@ -2901,7 +2903,7 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2905 "Python/generated_cases.c.h" + #line 2907 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2912,7 +2914,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2069 "Python/bytecodes.c" + #line 2071 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2924,7 +2926,7 @@ assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS); assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; - #line 2928 "Python/generated_cases.c.h" + #line 2930 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2935,14 +2937,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2083 "Python/bytecodes.c" + #line 2085 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2941 "Python/generated_cases.c.h" + #line 2943 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2085 "Python/bytecodes.c" + #line 2087 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 2946 "Python/generated_cases.c.h" + #line 2948 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2952,15 +2954,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2089 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2958 "Python/generated_cases.c.h" + #line 2960 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2091 "Python/bytecodes.c" + #line 2093 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 2964 "Python/generated_cases.c.h" + #line 2966 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2971,12 +2973,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2096 "Python/bytecodes.c" + #line 2098 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2977 "Python/generated_cases.c.h" + #line 2979 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2098 "Python/bytecodes.c" + #line 2100 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2984,10 +2986,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2988 "Python/generated_cases.c.h" + #line 2990 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2106 "Python/bytecodes.c" + #line 2108 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2996,7 +2998,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3000 "Python/generated_cases.c.h" + #line 3002 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3006,21 +3008,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2117 "Python/bytecodes.c" + #line 2119 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3013 "Python/generated_cases.c.h" + #line 3015 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2120 "Python/bytecodes.c" + #line 2122 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3020 "Python/generated_cases.c.h" + #line 3022 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2125 "Python/bytecodes.c" + #line 2127 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3024 "Python/generated_cases.c.h" + #line 3026 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3029,15 +3031,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2129 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 2131 "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" + #line 3038 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2132 "Python/bytecodes.c" + #line 2134 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3041 "Python/generated_cases.c.h" + #line 3043 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3046,25 +3048,25 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2136 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + #line 2138 "Python/bytecodes.c" + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3054 "Python/generated_cases.c.h" + #line 3056 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2142 "Python/bytecodes.c" + #line 2144 "Python/bytecodes.c" JUMPBY(oparg); - #line 3063 "Python/generated_cases.c.h" + #line 3065 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2146 "Python/bytecodes.c" + #line 2148 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3081,13 +3083,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3085 "Python/generated_cases.c.h" + #line 3087 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2176 "Python/bytecodes.c" + #line 2178 "Python/bytecodes.c" _PyExecutorObject *executor = (_PyExecutorObject *)frame->f_code->co_executors->executors[oparg]; Py_INCREF(executor); frame = executor->execute(executor, frame, stack_pointer); @@ -3096,20 +3098,20 @@ goto error; } goto resume_frame; - #line 3100 "Python/generated_cases.c.h" + #line 3102 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2187 "Python/bytecodes.c" + #line 2189 "Python/bytecodes.c" if (Py_IsFalse(cond)) { JUMPBY(oparg); } else if (!Py_IsTrue(cond)) { int err = PyObject_IsTrue(cond); - #line 3111 "Python/generated_cases.c.h" + #line 3113 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2193 "Python/bytecodes.c" + #line 2195 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -3117,22 +3119,22 @@ if (err < 0) goto pop_1_error; } } - #line 3121 "Python/generated_cases.c.h" + #line 3123 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2203 "Python/bytecodes.c" + #line 2205 "Python/bytecodes.c" if (Py_IsTrue(cond)) { JUMPBY(oparg); } else if (!Py_IsFalse(cond)) { int err = PyObject_IsTrue(cond); - #line 3134 "Python/generated_cases.c.h" + #line 3136 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2209 "Python/bytecodes.c" + #line 2211 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -3140,63 +3142,63 @@ if (err < 0) goto pop_1_error; } } - #line 3144 "Python/generated_cases.c.h" + #line 3146 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2219 "Python/bytecodes.c" - if (!Py_IsNone(value)) { - #line 3153 "Python/generated_cases.c.h" - Py_DECREF(value); #line 2221 "Python/bytecodes.c" + if (!Py_IsNone(value)) { + #line 3155 "Python/generated_cases.c.h" + Py_DECREF(value); + #line 2223 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3158 "Python/generated_cases.c.h" + #line 3160 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2226 "Python/bytecodes.c" + #line 2228 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3170 "Python/generated_cases.c.h" + #line 3172 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2231 "Python/bytecodes.c" + #line 2233 "Python/bytecodes.c" } - #line 3174 "Python/generated_cases.c.h" + #line 3176 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2235 "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. * (see bpo-30039). */ JUMPBY(-oparg); - #line 3187 "Python/generated_cases.c.h" + #line 3189 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2244 "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; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 3200 "Python/generated_cases.c.h" + #line 3202 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3207,16 +3209,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2252 "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)); attrs = match_class(tstate, subject, type, oparg, names); - #line 3216 "Python/generated_cases.c.h" + #line 3218 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2257 "Python/bytecodes.c" + #line 2259 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3224,7 +3226,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3228 "Python/generated_cases.c.h" + #line 3230 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3233,10 +3235,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2267 "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 3240 "Python/generated_cases.c.h" + #line 3242 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3245,10 +3247,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2272 "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 3252 "Python/generated_cases.c.h" + #line 3254 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3258,11 +3260,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2277 "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; - #line 3266 "Python/generated_cases.c.h" + #line 3268 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3271,14 +3273,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2283 "Python/bytecodes.c" + #line 2285 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3278 "Python/generated_cases.c.h" + #line 3280 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2286 "Python/bytecodes.c" + #line 2288 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3282 "Python/generated_cases.c.h" + #line 3284 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3286,7 +3288,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2290 "Python/bytecodes.c" + #line 2292 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3309,11 +3311,11 @@ if (iter == NULL) { goto error; } - #line 3313 "Python/generated_cases.c.h" + #line 3315 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2313 "Python/bytecodes.c" + #line 2315 "Python/bytecodes.c" } - #line 3317 "Python/generated_cases.c.h" + #line 3319 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3323,7 +3325,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2331 "Python/bytecodes.c" + #line 2333 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3354,7 +3356,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3358 "Python/generated_cases.c.h" + #line 3360 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3362,7 +3364,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2364 "Python/bytecodes.c" + #line 2366 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3388,14 +3390,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3392 "Python/generated_cases.c.h" + #line 3394 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2392 "Python/bytecodes.c" + #line 2394 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3415,7 +3417,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3419 "Python/generated_cases.c.h" + #line 3421 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3425,7 +3427,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2414 "Python/bytecodes.c" + #line 2416 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3445,7 +3447,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3449 "Python/generated_cases.c.h" + #line 3451 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3455,7 +3457,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2436 "Python/bytecodes.c" + #line 2438 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3473,7 +3475,7 @@ if (next == NULL) { goto error; } - #line 3477 "Python/generated_cases.c.h" + #line 3479 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3482,7 +3484,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2456 "Python/bytecodes.c" + #line 2458 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3498,14 +3500,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3502 "Python/generated_cases.c.h" + #line 3504 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2474 "Python/bytecodes.c" + #line 2476 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3528,16 +3530,16 @@ Py_DECREF(enter); goto error; } - #line 3532 "Python/generated_cases.c.h" + #line 3534 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2497 "Python/bytecodes.c" + #line 2499 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3541 "Python/generated_cases.c.h" + #line 3543 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3548,7 +3550,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2506 "Python/bytecodes.c" + #line 2508 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3574,16 +3576,16 @@ Py_DECREF(enter); goto error; } - #line 3578 "Python/generated_cases.c.h" + #line 3580 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2532 "Python/bytecodes.c" + #line 2534 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3587 "Python/generated_cases.c.h" + #line 3589 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3595,7 +3597,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2541 "Python/bytecodes.c" + #line 2543 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3616,7 +3618,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3620 "Python/generated_cases.c.h" + #line 3622 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3625,7 +3627,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2580 "Python/bytecodes.c" + #line 2582 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3635,7 +3637,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3639 "Python/generated_cases.c.h" + #line 3641 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3649,7 +3651,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 2592 "Python/bytecodes.c" + #line 2594 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3666,7 +3668,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3670 "Python/generated_cases.c.h" + #line 3672 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3680,7 +3682,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2611 "Python/bytecodes.c" + #line 2613 "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); @@ -3690,7 +3692,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3694 "Python/generated_cases.c.h" + #line 3696 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3704,7 +3706,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2623 "Python/bytecodes.c" + #line 2625 "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; @@ -3718,7 +3720,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3722 "Python/generated_cases.c.h" + #line 3724 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3727,16 +3729,16 @@ } TARGET(KW_NAMES) { - #line 2639 "Python/bytecodes.c" + #line 2641 "Python/bytecodes.c" assert(kwnames == NULL); - assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); - kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3735 "Python/generated_cases.c.h" + assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); + kwnames = GETITEM(FRAME_CO_CONSTS, oparg); + #line 3737 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2645 "Python/bytecodes.c" + #line 2647 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3749,7 +3751,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3753 "Python/generated_cases.c.h" + #line 3755 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3759,7 +3761,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2690 "Python/bytecodes.c" + #line 2692 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3841,7 +3843,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3845 "Python/generated_cases.c.h" + #line 3847 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3853,7 +3855,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2778 "Python/bytecodes.c" + #line 2780 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3863,7 +3865,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3867 "Python/generated_cases.c.h" + #line 3869 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3872,7 +3874,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2790 "Python/bytecodes.c" + #line 2792 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3898,7 +3900,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3902 "Python/generated_cases.c.h" + #line 3904 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3906,7 +3908,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2818 "Python/bytecodes.c" + #line 2820 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3942,7 +3944,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3946 "Python/generated_cases.c.h" + #line 3948 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3950,7 +3952,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2856 "Python/bytecodes.c" + #line 2858 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3960,7 +3962,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3964 "Python/generated_cases.c.h" + #line 3966 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3973,7 +3975,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2868 "Python/bytecodes.c" + #line 2870 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3984,7 +3986,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3988 "Python/generated_cases.c.h" + #line 3990 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3998,7 +4000,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2882 "Python/bytecodes.c" + #line 2884 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4009,7 +4011,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4013 "Python/generated_cases.c.h" + #line 4015 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4023,7 +4025,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2896 "Python/bytecodes.c" + #line 2898 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4045,7 +4047,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4049 "Python/generated_cases.c.h" + #line 4051 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4059,7 +4061,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2921 "Python/bytecodes.c" + #line 2923 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4087,7 +4089,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4091 "Python/generated_cases.c.h" + #line 4093 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4101,7 +4103,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2952 "Python/bytecodes.c" + #line 2954 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4133,7 +4135,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4137 "Python/generated_cases.c.h" + #line 4139 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4147,7 +4149,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2987 "Python/bytecodes.c" + #line 2989 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4179,7 +4181,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4183 "Python/generated_cases.c.h" + #line 4185 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4193,7 +4195,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3022 "Python/bytecodes.c" + #line 3024 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4218,7 +4220,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4222 "Python/generated_cases.c.h" + #line 4224 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4231,7 +4233,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3049 "Python/bytecodes.c" + #line 3051 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4258,7 +4260,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4262 "Python/generated_cases.c.h" + #line 4264 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4270,7 +4272,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3079 "Python/bytecodes.c" + #line 3081 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4288,14 +4290,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4292 "Python/generated_cases.c.h" + #line 4294 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3099 "Python/bytecodes.c" + #line 3101 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4326,7 +4328,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4330 "Python/generated_cases.c.h" + #line 4332 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4339,7 +4341,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3133 "Python/bytecodes.c" + #line 3135 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4368,7 +4370,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4372 "Python/generated_cases.c.h" + #line 4374 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4381,7 +4383,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3165 "Python/bytecodes.c" + #line 3167 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4410,7 +4412,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4414 "Python/generated_cases.c.h" + #line 4416 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4423,7 +4425,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3197 "Python/bytecodes.c" + #line 3199 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4451,7 +4453,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4455 "Python/generated_cases.c.h" + #line 4457 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4461,9 +4463,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3228 "Python/bytecodes.c" + #line 3230 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4467 "Python/generated_cases.c.h" + #line 4469 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4472,7 +4474,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3232 "Python/bytecodes.c" + #line 3234 "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)); @@ -4534,14 +4536,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4538 "Python/generated_cases.c.h" + #line 4540 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3294 "Python/bytecodes.c" + #line 3296 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4545 "Python/generated_cases.c.h" + #line 4547 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4552,7 +4554,7 @@ TARGET(MAKE_FUNCTION) { PyObject *codeobj = stack_pointer[-1]; PyObject *func; - #line 3300 "Python/bytecodes.c" + #line 3302 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4564,7 +4566,7 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4568 "Python/generated_cases.c.h" + #line 4570 "Python/generated_cases.c.h" stack_pointer[-1] = func; DISPATCH(); } @@ -4572,7 +4574,7 @@ TARGET(SET_FUNCTION_ATTRIBUTE) { PyObject *func = stack_pointer[-1]; PyObject *attr = stack_pointer[-2]; - #line 3314 "Python/bytecodes.c" + #line 3316 "Python/bytecodes.c" assert(PyFunction_Check(func)); PyFunctionObject *func_obj = (PyFunctionObject *)func; switch(oparg) { @@ -4597,14 +4599,14 @@ default: Py_UNREACHABLE(); } - #line 4601 "Python/generated_cases.c.h" + #line 4603 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3341 "Python/bytecodes.c" + #line 3343 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4625,7 +4627,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4629 "Python/generated_cases.c.h" + #line 4631 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4633,15 +4635,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3364 "Python/bytecodes.c" + #line 3366 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4639 "Python/generated_cases.c.h" + #line 4641 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3366 "Python/bytecodes.c" + #line 3368 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4645 "Python/generated_cases.c.h" + #line 4647 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4652,7 +4654,7 @@ PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? stack_pointer[-((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))] : NULL; PyObject *value = stack_pointer[-(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))]; PyObject *result; - #line 3370 "Python/bytecodes.c" + #line 3372 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4687,7 +4689,7 @@ Py_DECREF(value); Py_XDECREF(fmt_spec); if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - #line 4691 "Python/generated_cases.c.h" + #line 4693 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4696,10 +4698,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3407 "Python/bytecodes.c" + #line 3409 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4703 "Python/generated_cases.c.h" + #line 4705 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4711,7 +4713,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3412 "Python/bytecodes.c" + #line 3414 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4726,12 +4728,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4730 "Python/generated_cases.c.h" + #line 4732 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3427 "Python/bytecodes.c" + #line 3429 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4735 "Python/generated_cases.c.h" + #line 4737 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4741,16 +4743,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3432 "Python/bytecodes.c" + #line 3434 "Python/bytecodes.c" assert(oparg >= 2); - #line 4747 "Python/generated_cases.c.h" + #line 4749 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3436 "Python/bytecodes.c" + #line 3438 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4762,26 +4764,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4766 "Python/generated_cases.c.h" + #line 4768 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3450 "Python/bytecodes.c" + #line 3452 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4772 "Python/generated_cases.c.h" + #line 4774 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3454 "Python/bytecodes.c" + #line 3456 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4779 "Python/generated_cases.c.h" + #line 4781 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3459 "Python/bytecodes.c" + #line 3461 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4790,12 +4792,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4794 "Python/generated_cases.c.h" + #line 4796 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3470 "Python/bytecodes.c" + #line 3472 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4804,12 +4806,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4808 "Python/generated_cases.c.h" + #line 4810 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3481 "Python/bytecodes.c" + #line 3483 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4821,12 +4823,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4825 "Python/generated_cases.c.h" + #line 4827 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3495 "Python/bytecodes.c" + #line 3497 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4838,30 +4840,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4842 "Python/generated_cases.c.h" + #line 4844 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3509 "Python/bytecodes.c" + #line 3511 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4853 "Python/generated_cases.c.h" + #line 4855 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3517 "Python/bytecodes.c" + #line 3519 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4860 "Python/generated_cases.c.h" + #line 4862 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3522 "Python/bytecodes.c" + #line 3524 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4867 "Python/generated_cases.c.h" + #line 4869 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 7c0cbdb35e0..faa5087adeb 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -855,9 +855,16 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { #endif enum InstructionFormat { INSTR_FMT_IB, INSTR_FMT_IBC, INSTR_FMT_IBC00, INSTR_FMT_IBC000, INSTR_FMT_IBC00000000, INSTR_FMT_IX, INSTR_FMT_IXC, INSTR_FMT_IXC000 }; +#define HAS_ARG_FLAG (1) +#define HAS_CONST_FLAG (2) +#define HAS_NAME_FLAG (4) +#define OPCODE_HAS_ARG(OP) (_PyOpcode_opcode_metadata[(OP)].flags & (HAS_ARG_FLAG)) +#define OPCODE_HAS_CONST(OP) (_PyOpcode_opcode_metadata[(OP)].flags & (HAS_CONST_FLAG)) +#define OPCODE_HAS_NAME(OP) (_PyOpcode_opcode_metadata[(OP)].flags & (HAS_NAME_FLAG)) struct opcode_metadata { bool valid_entry; enum InstructionFormat instr_format; + int flags; }; #define OPCODE_METADATA_FMT(OP) (_PyOpcode_opcode_metadata[(OP)].instr_format) @@ -868,208 +875,208 @@ struct opcode_metadata { extern const struct opcode_metadata _PyOpcode_opcode_metadata[512]; #else const struct opcode_metadata _PyOpcode_opcode_metadata[512] = { - [NOP] = { true, INSTR_FMT_IX }, - [RESUME] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_RESUME] = { true, INSTR_FMT_IB }, - [LOAD_CLOSURE] = { true, INSTR_FMT_IB }, - [LOAD_FAST_CHECK] = { true, INSTR_FMT_IB }, - [LOAD_FAST] = { true, INSTR_FMT_IB }, - [LOAD_FAST_AND_CLEAR] = { true, INSTR_FMT_IB }, - [LOAD_FAST_LOAD_FAST] = { true, INSTR_FMT_IB }, - [LOAD_CONST] = { true, INSTR_FMT_IB }, - [STORE_FAST] = { true, INSTR_FMT_IB }, - [STORE_FAST_MAYBE_NULL] = { true, INSTR_FMT_IB }, - [STORE_FAST_LOAD_FAST] = { true, INSTR_FMT_IB }, - [STORE_FAST_STORE_FAST] = { true, INSTR_FMT_IB }, - [POP_TOP] = { true, INSTR_FMT_IX }, - [PUSH_NULL] = { true, INSTR_FMT_IX }, - [END_FOR] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_END_FOR] = { true, INSTR_FMT_IX }, - [END_SEND] = { true, INSTR_FMT_IX }, - [INSTRUMENTED_END_SEND] = { true, INSTR_FMT_IX }, - [UNARY_NEGATIVE] = { true, INSTR_FMT_IX }, - [UNARY_NOT] = { true, INSTR_FMT_IX }, - [UNARY_INVERT] = { true, INSTR_FMT_IX }, - [BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IBC }, - [BINARY_OP_ADD_INT] = { true, INSTR_FMT_IBC }, - [BINARY_OP_SUBTRACT_INT] = { true, INSTR_FMT_IBC }, - [BINARY_OP_MULTIPLY_FLOAT] = { true, INSTR_FMT_IBC }, - [BINARY_OP_ADD_FLOAT] = { true, INSTR_FMT_IBC }, - [BINARY_OP_SUBTRACT_FLOAT] = { true, INSTR_FMT_IBC }, - [BINARY_OP_ADD_UNICODE] = { true, INSTR_FMT_IBC }, - [BINARY_OP_INPLACE_ADD_UNICODE] = { true, INSTR_FMT_IB }, - [BINARY_SUBSCR] = { true, INSTR_FMT_IXC }, - [BINARY_SLICE] = { true, INSTR_FMT_IX }, - [STORE_SLICE] = { true, INSTR_FMT_IX }, - [BINARY_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC }, - [BINARY_SUBSCR_TUPLE_INT] = { true, INSTR_FMT_IXC }, - [BINARY_SUBSCR_DICT] = { true, INSTR_FMT_IXC }, - [BINARY_SUBSCR_GETITEM] = { true, INSTR_FMT_IXC }, - [LIST_APPEND] = { true, INSTR_FMT_IB }, - [SET_ADD] = { true, INSTR_FMT_IB }, - [STORE_SUBSCR] = { true, INSTR_FMT_IXC }, - [STORE_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC }, - [STORE_SUBSCR_DICT] = { true, INSTR_FMT_IXC }, - [DELETE_SUBSCR] = { true, INSTR_FMT_IX }, - [CALL_INTRINSIC_1] = { true, INSTR_FMT_IB }, - [CALL_INTRINSIC_2] = { true, INSTR_FMT_IB }, - [RAISE_VARARGS] = { true, INSTR_FMT_IB }, - [INTERPRETER_EXIT] = { true, INSTR_FMT_IX }, - [RETURN_VALUE] = { true, INSTR_FMT_IX }, - [INSTRUMENTED_RETURN_VALUE] = { true, INSTR_FMT_IX }, - [RETURN_CONST] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_RETURN_CONST] = { true, INSTR_FMT_IB }, - [GET_AITER] = { true, INSTR_FMT_IX }, - [GET_ANEXT] = { true, INSTR_FMT_IX }, - [GET_AWAITABLE] = { true, INSTR_FMT_IB }, - [SEND] = { true, INSTR_FMT_IBC }, - [SEND_GEN] = { true, INSTR_FMT_IBC }, - [INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IX }, - [YIELD_VALUE] = { true, INSTR_FMT_IX }, - [POP_EXCEPT] = { true, INSTR_FMT_IX }, - [RERAISE] = { true, INSTR_FMT_IB }, - [END_ASYNC_FOR] = { true, INSTR_FMT_IX }, - [CLEANUP_THROW] = { true, INSTR_FMT_IX }, - [LOAD_ASSERTION_ERROR] = { true, INSTR_FMT_IX }, - [LOAD_BUILD_CLASS] = { true, INSTR_FMT_IX }, - [STORE_NAME] = { true, INSTR_FMT_IB }, - [DELETE_NAME] = { true, INSTR_FMT_IB }, - [UNPACK_SEQUENCE] = { true, INSTR_FMT_IBC }, - [UNPACK_SEQUENCE_TWO_TUPLE] = { true, INSTR_FMT_IBC }, - [UNPACK_SEQUENCE_TUPLE] = { true, INSTR_FMT_IBC }, - [UNPACK_SEQUENCE_LIST] = { true, INSTR_FMT_IBC }, - [UNPACK_EX] = { true, INSTR_FMT_IB }, - [STORE_ATTR] = { true, INSTR_FMT_IBC000 }, - [DELETE_ATTR] = { true, INSTR_FMT_IB }, - [STORE_GLOBAL] = { true, INSTR_FMT_IB }, - [DELETE_GLOBAL] = { true, INSTR_FMT_IB }, - [LOAD_LOCALS] = { true, INSTR_FMT_IB }, - [LOAD_NAME] = { true, INSTR_FMT_IB }, - [LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB }, - [LOAD_GLOBAL] = { true, INSTR_FMT_IBC000 }, - [LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC000 }, - [LOAD_GLOBAL_BUILTIN] = { true, INSTR_FMT_IBC000 }, - [DELETE_FAST] = { true, INSTR_FMT_IB }, - [MAKE_CELL] = { true, INSTR_FMT_IB }, - [DELETE_DEREF] = { true, INSTR_FMT_IB }, - [LOAD_FROM_DICT_OR_DEREF] = { true, INSTR_FMT_IB }, - [LOAD_DEREF] = { true, INSTR_FMT_IB }, - [STORE_DEREF] = { true, INSTR_FMT_IB }, - [COPY_FREE_VARS] = { true, INSTR_FMT_IB }, - [BUILD_STRING] = { true, INSTR_FMT_IB }, - [BUILD_TUPLE] = { true, INSTR_FMT_IB }, - [BUILD_LIST] = { true, INSTR_FMT_IB }, - [LIST_EXTEND] = { true, INSTR_FMT_IB }, - [SET_UPDATE] = { true, INSTR_FMT_IB }, - [BUILD_SET] = { true, INSTR_FMT_IB }, - [BUILD_MAP] = { true, INSTR_FMT_IB }, - [SETUP_ANNOTATIONS] = { true, INSTR_FMT_IX }, - [BUILD_CONST_KEY_MAP] = { true, INSTR_FMT_IB }, - [DICT_UPDATE] = { true, INSTR_FMT_IB }, - [DICT_MERGE] = { true, INSTR_FMT_IB }, - [MAP_ADD] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC }, - [LOAD_SUPER_METHOD] = { true, INSTR_FMT_IBC }, - [LOAD_ZERO_SUPER_METHOD] = { true, INSTR_FMT_IBC }, - [LOAD_ZERO_SUPER_ATTR] = { true, INSTR_FMT_IBC }, - [LOAD_SUPER_ATTR_ATTR] = { true, INSTR_FMT_IBC }, - [LOAD_SUPER_ATTR_METHOD] = { true, INSTR_FMT_IBC }, - [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_METHOD] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_SLOT] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_CLASS] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_PROPERTY] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = { true, INSTR_FMT_IBC00000000 }, - [STORE_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IXC000 }, - [STORE_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC000 }, - [STORE_ATTR_SLOT] = { true, INSTR_FMT_IXC000 }, - [COMPARE_OP] = { true, INSTR_FMT_IBC }, - [COMPARE_OP_FLOAT] = { true, INSTR_FMT_IBC }, - [COMPARE_OP_INT] = { true, INSTR_FMT_IBC }, - [COMPARE_OP_STR] = { true, INSTR_FMT_IBC }, - [IS_OP] = { true, INSTR_FMT_IB }, - [CONTAINS_OP] = { true, INSTR_FMT_IB }, - [CHECK_EG_MATCH] = { true, INSTR_FMT_IX }, - [CHECK_EXC_MATCH] = { true, INSTR_FMT_IX }, - [IMPORT_NAME] = { true, INSTR_FMT_IB }, - [IMPORT_FROM] = { true, INSTR_FMT_IB }, - [JUMP_FORWARD] = { true, INSTR_FMT_IB }, - [JUMP_BACKWARD] = { true, INSTR_FMT_IB }, - [JUMP] = { true, INSTR_FMT_IB }, - [JUMP_NO_INTERRUPT] = { true, INSTR_FMT_IB }, - [ENTER_EXECUTOR] = { true, INSTR_FMT_IB }, - [POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB }, - [POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB }, - [POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB }, - [POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB }, - [JUMP_BACKWARD_NO_INTERRUPT] = { true, INSTR_FMT_IB }, - [GET_LEN] = { true, INSTR_FMT_IX }, - [MATCH_CLASS] = { true, INSTR_FMT_IB }, - [MATCH_MAPPING] = { true, INSTR_FMT_IX }, - [MATCH_SEQUENCE] = { true, INSTR_FMT_IX }, - [MATCH_KEYS] = { true, INSTR_FMT_IX }, - [GET_ITER] = { true, INSTR_FMT_IX }, - [GET_YIELD_FROM_ITER] = { true, INSTR_FMT_IX }, - [FOR_ITER] = { true, INSTR_FMT_IBC }, - [INSTRUMENTED_FOR_ITER] = { true, INSTR_FMT_IB }, - [FOR_ITER_LIST] = { true, INSTR_FMT_IBC }, - [FOR_ITER_TUPLE] = { true, INSTR_FMT_IBC }, - [FOR_ITER_RANGE] = { true, INSTR_FMT_IBC }, - [FOR_ITER_GEN] = { true, INSTR_FMT_IBC }, - [BEFORE_ASYNC_WITH] = { true, INSTR_FMT_IX }, - [BEFORE_WITH] = { true, INSTR_FMT_IX }, - [WITH_EXCEPT_START] = { true, INSTR_FMT_IX }, - [SETUP_FINALLY] = { true, INSTR_FMT_IX }, - [SETUP_CLEANUP] = { true, INSTR_FMT_IX }, - [SETUP_WITH] = { true, INSTR_FMT_IX }, - [POP_BLOCK] = { true, INSTR_FMT_IX }, - [PUSH_EXC_INFO] = { true, INSTR_FMT_IX }, - [LOAD_ATTR_METHOD_WITH_VALUES] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_METHOD_NO_DICT] = { true, INSTR_FMT_IBC00000000 }, - [LOAD_ATTR_METHOD_LAZY_DICT] = { true, INSTR_FMT_IBC00000000 }, - [KW_NAMES] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_CALL] = { true, INSTR_FMT_IB }, - [CALL] = { true, INSTR_FMT_IBC00 }, - [CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IBC00 }, - [CALL_PY_EXACT_ARGS] = { true, INSTR_FMT_IBC00 }, - [CALL_PY_WITH_DEFAULTS] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_TYPE_1] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_STR_1] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_TUPLE_1] = { true, INSTR_FMT_IBC00 }, - [CALL_BUILTIN_CLASS] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_BUILTIN_O] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_BUILTIN_FAST] = { true, INSTR_FMT_IBC00 }, - [CALL_BUILTIN_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_LEN] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_ISINSTANCE] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_LIST_APPEND] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_METHOD_DESCRIPTOR_O] = { true, INSTR_FMT_IBC00 }, - [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = { true, INSTR_FMT_IBC00 }, - [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = { true, INSTR_FMT_IBC00 }, - [INSTRUMENTED_CALL_FUNCTION_EX] = { true, INSTR_FMT_IX }, - [CALL_FUNCTION_EX] = { true, INSTR_FMT_IB }, - [MAKE_FUNCTION] = { true, INSTR_FMT_IX }, - [SET_FUNCTION_ATTRIBUTE] = { true, INSTR_FMT_IB }, - [RETURN_GENERATOR] = { true, INSTR_FMT_IX }, - [BUILD_SLICE] = { true, INSTR_FMT_IB }, - [FORMAT_VALUE] = { true, INSTR_FMT_IB }, - [COPY] = { true, INSTR_FMT_IB }, - [BINARY_OP] = { true, INSTR_FMT_IBC }, - [SWAP] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_INSTRUCTION] = { true, INSTR_FMT_IX }, - [INSTRUMENTED_JUMP_FORWARD] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_JUMP_BACKWARD] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB }, - [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB }, - [EXTENDED_ARG] = { true, INSTR_FMT_IB }, - [CACHE] = { true, INSTR_FMT_IX }, - [RESERVED] = { true, INSTR_FMT_IX }, + [NOP] = { true, INSTR_FMT_IX, 0 }, + [RESUME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_RESUME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_CLOSURE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_FAST_CHECK] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_FAST_AND_CLEAR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_FAST_LOAD_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_CONST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG }, + [STORE_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [STORE_FAST_MAYBE_NULL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [STORE_FAST_LOAD_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [STORE_FAST_STORE_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [POP_TOP] = { true, INSTR_FMT_IX, 0 }, + [PUSH_NULL] = { true, INSTR_FMT_IX, 0 }, + [END_FOR] = { true, INSTR_FMT_IB, 0 }, + [INSTRUMENTED_END_FOR] = { true, INSTR_FMT_IX, 0 }, + [END_SEND] = { true, INSTR_FMT_IX, 0 }, + [INSTRUMENTED_END_SEND] = { true, INSTR_FMT_IX, 0 }, + [UNARY_NEGATIVE] = { true, INSTR_FMT_IX, 0 }, + [UNARY_NOT] = { true, INSTR_FMT_IX, 0 }, + [UNARY_INVERT] = { true, INSTR_FMT_IX, 0 }, + [BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IBC, 0 }, + [BINARY_OP_ADD_INT] = { true, INSTR_FMT_IBC, 0 }, + [BINARY_OP_SUBTRACT_INT] = { true, INSTR_FMT_IBC, 0 }, + [BINARY_OP_MULTIPLY_FLOAT] = { true, INSTR_FMT_IBC, 0 }, + [BINARY_OP_ADD_FLOAT] = { true, INSTR_FMT_IBC, 0 }, + [BINARY_OP_SUBTRACT_FLOAT] = { true, INSTR_FMT_IBC, 0 }, + [BINARY_OP_ADD_UNICODE] = { true, INSTR_FMT_IBC, 0 }, + [BINARY_OP_INPLACE_ADD_UNICODE] = { true, INSTR_FMT_IB, 0 }, + [BINARY_SUBSCR] = { true, INSTR_FMT_IXC, 0 }, + [BINARY_SLICE] = { true, INSTR_FMT_IX, 0 }, + [STORE_SLICE] = { true, INSTR_FMT_IX, 0 }, + [BINARY_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC, 0 }, + [BINARY_SUBSCR_TUPLE_INT] = { true, INSTR_FMT_IXC, 0 }, + [BINARY_SUBSCR_DICT] = { true, INSTR_FMT_IXC, 0 }, + [BINARY_SUBSCR_GETITEM] = { true, INSTR_FMT_IXC, 0 }, + [LIST_APPEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [SET_ADD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [STORE_SUBSCR] = { true, INSTR_FMT_IXC, 0 }, + [STORE_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC, 0 }, + [STORE_SUBSCR_DICT] = { true, INSTR_FMT_IXC, 0 }, + [DELETE_SUBSCR] = { true, INSTR_FMT_IX, 0 }, + [CALL_INTRINSIC_1] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [CALL_INTRINSIC_2] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [RAISE_VARARGS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INTERPRETER_EXIT] = { true, INSTR_FMT_IX, 0 }, + [RETURN_VALUE] = { true, INSTR_FMT_IX, 0 }, + [INSTRUMENTED_RETURN_VALUE] = { true, INSTR_FMT_IX, 0 }, + [RETURN_CONST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG }, + [INSTRUMENTED_RETURN_CONST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG }, + [GET_AITER] = { true, INSTR_FMT_IX, 0 }, + [GET_ANEXT] = { true, INSTR_FMT_IX, 0 }, + [GET_AWAITABLE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [SEND] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [SEND_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [POP_EXCEPT] = { true, INSTR_FMT_IX, 0 }, + [RERAISE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [END_ASYNC_FOR] = { true, INSTR_FMT_IX, 0 }, + [CLEANUP_THROW] = { true, INSTR_FMT_IX, 0 }, + [LOAD_ASSERTION_ERROR] = { true, INSTR_FMT_IX, 0 }, + [LOAD_BUILD_CLASS] = { true, INSTR_FMT_IX, 0 }, + [STORE_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [DELETE_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [UNPACK_SEQUENCE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [UNPACK_SEQUENCE_TWO_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [UNPACK_SEQUENCE_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [UNPACK_SEQUENCE_LIST] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [UNPACK_EX] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [STORE_ATTR] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [DELETE_ATTR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [STORE_GLOBAL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [DELETE_GLOBAL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_LOCALS] = { true, INSTR_FMT_IB, 0 }, + [LOAD_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_GLOBAL] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG }, + [LOAD_GLOBAL_BUILTIN] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG }, + [DELETE_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [MAKE_CELL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [DELETE_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_FROM_DICT_OR_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [STORE_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [COPY_FREE_VARS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [BUILD_STRING] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [BUILD_TUPLE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [BUILD_LIST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LIST_EXTEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [SET_UPDATE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [BUILD_SET] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [BUILD_MAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [SETUP_ANNOTATIONS] = { true, INSTR_FMT_IX, 0 }, + [BUILD_CONST_KEY_MAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [DICT_UPDATE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [DICT_MERGE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [MAP_ADD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, + [LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_SUPER_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_ZERO_SUPER_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_ZERO_SUPER_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_SUPER_ATTR_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_SUPER_ATTR_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_METHOD] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, + [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, + [LOAD_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [LOAD_ATTR_SLOT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, + [LOAD_ATTR_CLASS] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, + [LOAD_ATTR_PROPERTY] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG }, + [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [STORE_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IXC000, 0 }, + [STORE_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [STORE_ATTR_SLOT] = { true, INSTR_FMT_IXC000, 0 }, + [COMPARE_OP] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [COMPARE_OP_FLOAT] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [COMPARE_OP_INT] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [COMPARE_OP_STR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [IS_OP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [CONTAINS_OP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [CHECK_EG_MATCH] = { true, INSTR_FMT_IX, 0 }, + [CHECK_EXC_MATCH] = { true, INSTR_FMT_IX, 0 }, + [IMPORT_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [IMPORT_FROM] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG }, + [JUMP_FORWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [JUMP_BACKWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [JUMP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [JUMP_NO_INTERRUPT] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [JUMP_BACKWARD_NO_INTERRUPT] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [GET_LEN] = { true, INSTR_FMT_IX, 0 }, + [MATCH_CLASS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [MATCH_MAPPING] = { true, INSTR_FMT_IX, 0 }, + [MATCH_SEQUENCE] = { true, INSTR_FMT_IX, 0 }, + [MATCH_KEYS] = { true, INSTR_FMT_IX, 0 }, + [GET_ITER] = { true, INSTR_FMT_IX, 0 }, + [GET_YIELD_FROM_ITER] = { true, INSTR_FMT_IX, 0 }, + [FOR_ITER] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [INSTRUMENTED_FOR_ITER] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [FOR_ITER_LIST] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [FOR_ITER_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [FOR_ITER_RANGE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [FOR_ITER_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [BEFORE_ASYNC_WITH] = { true, INSTR_FMT_IX, 0 }, + [BEFORE_WITH] = { true, INSTR_FMT_IX, 0 }, + [WITH_EXCEPT_START] = { true, INSTR_FMT_IX, 0 }, + [SETUP_FINALLY] = { true, INSTR_FMT_IX, 0 }, + [SETUP_CLEANUP] = { true, INSTR_FMT_IX, 0 }, + [SETUP_WITH] = { true, INSTR_FMT_IX, 0 }, + [POP_BLOCK] = { true, INSTR_FMT_IX, 0 }, + [PUSH_EXC_INFO] = { true, INSTR_FMT_IX, 0 }, + [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 }, + [CALL_PY_EXACT_ARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_PY_WITH_DEFAULTS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_TYPE_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_STR_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_TUPLE_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_BUILTIN_CLASS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_BUILTIN_O] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_BUILTIN_FAST] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_BUILTIN_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_LEN] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_ISINSTANCE] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_LIST_APPEND] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_METHOD_DESCRIPTOR_O] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, + [INSTRUMENTED_CALL_FUNCTION_EX] = { true, INSTR_FMT_IX, 0 }, + [CALL_FUNCTION_EX] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [MAKE_FUNCTION] = { true, INSTR_FMT_IX, 0 }, + [SET_FUNCTION_ATTRIBUTE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [RETURN_GENERATOR] = { true, INSTR_FMT_IX, 0 }, + [BUILD_SLICE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [FORMAT_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [COPY] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [BINARY_OP] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG }, + [SWAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_INSTRUCTION] = { true, INSTR_FMT_IX, 0 }, + [INSTRUMENTED_JUMP_FORWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_JUMP_BACKWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [EXTENDED_ARG] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [CACHE] = { true, INSTR_FMT_IX, 0 }, + [RESERVED] = { true, INSTR_FMT_IX, 0 }, }; #endif diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 3a003b3fba2..8aa500e9e74 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -34,6 +34,11 @@ RE_PREDICTED = ( UNUSED = "unused" BITS_PER_CODE_UNIT = 16 +RESERVED_WORDS = { + "co_consts" : "Use FRAME_CO_CONSTS.", + "co_names": "Use FRAME_CO_NAMES.", +} + arg_parser = argparse.ArgumentParser( description="Generate the code for the interpreter switch.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, @@ -223,6 +228,7 @@ class Formatter: def cast(self, dst: StackEffect, src: StackEffect) -> str: return f"({dst.type or 'PyObject *'})" if src.type != dst.type else "" +INSTRUCTION_FLAGS = ['HAS_ARG', 'HAS_CONST', 'HAS_NAME'] @dataclasses.dataclass class Instruction: @@ -244,6 +250,7 @@ class Instruction: output_effects: list[StackEffect] unmoved_names: frozenset[str] instr_fmt: str + flags: int # Set later family: parser.Family | None = None @@ -272,7 +279,17 @@ class Instruction: else: break self.unmoved_names = frozenset(unmoved_names) - if variable_used(inst, "oparg"): + flag_data = { + 'HAS_ARG' : variable_used(inst, "oparg"), + 'HAS_CONST': variable_used(inst, "FRAME_CO_CONSTS"), + 'HAS_NAME' : variable_used(inst, "FRAME_CO_NAMES"), + } + assert set(flag_data.keys()) == set(INSTRUCTION_FLAGS) + self.flags = 0 + for i, name in enumerate(INSTRUCTION_FLAGS): + self.flags |= (1< None: - """Analyze each super- and macro instruction.""" + """Analyze each macro and pseudo instruction.""" self.macro_instrs = {} self.pseudo_instrs = {} for name, macro in self.macros.items(): @@ -754,6 +777,7 @@ class Analyzer: sp = initial_sp parts: list[Component | parser.CacheEffect] = [] format = "IB" + flags = 0 cache = "C" for component in components: match component: @@ -769,11 +793,12 @@ class Analyzer: for _ in range(ce.size): format += cache cache = "0" + flags |= instr.flags case _: typing.assert_never(component) final_sp = sp return MacroInstruction( - macro.name, stack, initial_sp, final_sp, format, macro, parts + macro.name, stack, initial_sp, final_sp, format, flags, macro, parts ) def analyze_pseudo(self, pseudo: parser.Pseudo) -> PseudoInstruction: @@ -782,7 +807,9 @@ class Analyzer: # Make sure the targets have the same fmt fmts = list(set([t.instr_fmt for t in targets])) assert(len(fmts) == 1) - return PseudoInstruction(pseudo.name, fmts[0], targets) + flags_list = list(set([t.flags for t in targets])) + assert(len(flags_list) == 1) + return PseudoInstruction(pseudo.name, targets, fmts[0], flags_list[0]) def analyze_instruction( self, instr: Instruction, stack: list[StackEffect], sp: int @@ -1005,10 +1032,19 @@ class Analyzer: # Write type definitions self.out.emit(f"enum InstructionFormat {{ {', '.join(format_enums)} }};") + for i, flag in enumerate(INSTRUCTION_FLAGS): + self.out.emit(f"#define {flag}{INSTR_FLAG_SUFFIX} ({1 << i})"); + for flag in INSTRUCTION_FLAGS: + flag_name = f"{flag}{INSTR_FLAG_SUFFIX}" + self.out.emit( + f"#define OPCODE_{flag}(OP) " + f"(_PyOpcode_opcode_metadata[(OP)].flags & ({flag_name}))") + self.out.emit("struct opcode_metadata {") with self.out.indent(): self.out.emit("bool valid_entry;") self.out.emit("enum InstructionFormat instr_format;") + self.out.emit("int flags;") self.out.emit("};") self.out.emit("") self.out.emit("#define OPCODE_METADATA_FMT(OP) " @@ -1049,23 +1085,25 @@ class Analyzer: self.out.emit(f" ((OP) == {op}) || \\") self.out.emit(f" 0") + def emit_metadata_entry(self, name: str, fmt: str, flags: int) -> None: + flags_strs = [f"{name}{INSTR_FLAG_SUFFIX}" + for i, name in enumerate(INSTRUCTION_FLAGS) if (flags & (1< None: """Write metadata for a single instruction.""" - self.out.emit( - f" [{instr.name}] = {{ true, {INSTR_FMT_PREFIX}{instr.instr_fmt} }}," - ) + self.emit_metadata_entry(instr.name, instr.instr_fmt, instr.flags) def write_metadata_for_macro(self, mac: MacroInstruction) -> None: """Write metadata for a macro-instruction.""" - self.out.emit( - f" [{mac.name}] = {{ true, {INSTR_FMT_PREFIX}{mac.instr_fmt} }}," - ) + self.emit_metadata_entry(mac.name, mac.instr_fmt, mac.flags) def write_metadata_for_pseudo(self, ps: PseudoInstruction) -> None: """Write metadata for a macro-instruction.""" - self.out.emit( - f" [{ps.name}] = {{ true, {INSTR_FMT_PREFIX}{ps.instr_fmt} }}," - ) + self.emit_metadata_entry(ps.name, ps.instr_fmt, ps.flags) def write_instructions(self) -> None: """Write instructions to output file."""