From f0898abcb086f642e7d2225d6a69ce252781d154 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 7 Jun 2023 23:39:49 +0100 Subject: [PATCH 1/8] gh-105481: add flags to each instr in the opcode metadata table, to replace opcode.hasarg/hasname/hasconst --- Python/bytecodes.c | 1 + Python/compile.c | 4 + Python/generated_cases.c.h | 703 ++++++++++++------------ Python/opcode_metadata.h | 393 ++++++------- Tools/cases_generator/generate_cases.py | 71 ++- 5 files changed, 617 insertions(+), 555 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index bd40369997c696..67823956233c82 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -951,6 +951,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; diff --git a/Python/compile.c b/Python/compile.c index 32431728422765..713bf4b4a32b6c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -244,6 +244,10 @@ instr_sequence_use_label(instr_sequence *seq, int lbl) { static int instr_sequence_addop(instr_sequence *seq, int opcode, int oparg, location loc) { + if (!IS_PSEUDO_OPCODE(opcode)) { + assert(!HAS_ARG(opcode) == !OPCODE_HAS_ARG(opcode)); + assert(!HAS_CONST(opcode) == !OPCODE_HAS_CONST(opcode)); + } assert(IS_WITHIN_OPCODE_RANGE(opcode)); assert(HAS_ARG(opcode) || HAS_TARGET(opcode) || oparg == 0); assert(0 <= oparg && oparg < (1 << 30)); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 31559ec0c12c20..84023b6c72a79c 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -1326,6 +1326,7 @@ // 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; @@ -1338,15 +1339,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1342 "Python/generated_cases.c.h" + #line 1343 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 969 "Python/bytecodes.c" + #line 970 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1350 "Python/generated_cases.c.h" + #line 1351 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1354,7 +1355,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 974 "Python/bytecodes.c" + #line 975 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1372,26 +1373,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1376 "Python/generated_cases.c.h" + #line 1377 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 994 "Python/bytecodes.c" + #line 995 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1385 "Python/generated_cases.c.h" + #line 1386 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 997 "Python/bytecodes.c" + #line 998 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1395 "Python/generated_cases.c.h" + #line 1396 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1402,23 +1403,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1006 "Python/bytecodes.c" + #line 1007 "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 1411 "Python/generated_cases.c.h" + #line 1412 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1011 "Python/bytecodes.c" + #line 1012 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1422 "Python/generated_cases.c.h" + #line 1423 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1427,9 +1428,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1020 "Python/bytecodes.c" + #line 1021 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1433 "Python/generated_cases.c.h" + #line 1434 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1437,7 +1438,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1024 "Python/bytecodes.c" + #line 1025 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1459,7 +1460,7 @@ if (true) goto error; } } - #line 1463 "Python/generated_cases.c.h" + #line 1464 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1467,33 +1468,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1049 "Python/bytecodes.c" + #line 1050 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1478 "Python/generated_cases.c.h" + #line 1479 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1056 "Python/bytecodes.c" + #line 1057 "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 1487 "Python/generated_cases.c.h" + #line 1488 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1063 "Python/bytecodes.c" + #line 1064 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1491 "Python/generated_cases.c.h" + #line 1492 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1067 "Python/bytecodes.c" + #line 1068 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1510,7 +1511,7 @@ name); goto error; } - #line 1514 "Python/generated_cases.c.h" + #line 1515 "Python/generated_cases.c.h" DISPATCH(); } @@ -1518,7 +1519,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1093 "Python/bytecodes.c" + #line 1094 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1531,11 +1532,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1535 "Python/generated_cases.c.h" + #line 1536 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1106 "Python/bytecodes.c" + #line 1107 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1539 "Python/generated_cases.c.h" + #line 1540 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1545,14 +1546,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1110 "Python/bytecodes.c" + #line 1111 "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 1556 "Python/generated_cases.c.h" + #line 1557 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1563,7 +1564,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1120 "Python/bytecodes.c" + #line 1121 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1571,7 +1572,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1575 "Python/generated_cases.c.h" + #line 1576 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1582,7 +1583,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1131 "Python/bytecodes.c" + #line 1132 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1590,7 +1591,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1594 "Python/generated_cases.c.h" + #line 1595 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1600,15 +1601,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1142 "Python/bytecodes.c" + #line 1143 "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 1608 "Python/generated_cases.c.h" + #line 1609 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1146 "Python/bytecodes.c" + #line 1147 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1612 "Python/generated_cases.c.h" + #line 1613 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1619,7 +1620,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1157 "Python/bytecodes.c" + #line 1158 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1635,12 +1636,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1639 "Python/generated_cases.c.h" + #line 1640 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1173 "Python/bytecodes.c" + #line 1174 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1644 "Python/generated_cases.c.h" + #line 1645 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1648,34 +1649,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1177 "Python/bytecodes.c" + #line 1178 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1655 "Python/generated_cases.c.h" + #line 1656 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1180 "Python/bytecodes.c" + #line 1181 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1659 "Python/generated_cases.c.h" + #line 1660 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1184 "Python/bytecodes.c" + #line 1185 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1669 "Python/generated_cases.c.h" + #line 1670 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1187 "Python/bytecodes.c" + #line 1188 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1673 "Python/generated_cases.c.h" + #line 1674 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1191 "Python/bytecodes.c" + #line 1192 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1687,7 +1688,7 @@ } goto error; } - #line 1691 "Python/generated_cases.c.h" + #line 1692 "Python/generated_cases.c.h" DISPATCH(); } @@ -1695,7 +1696,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1205 "Python/bytecodes.c" + #line 1206 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1703,7 +1704,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1707 "Python/generated_cases.c.h" + #line 1708 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1715,7 +1716,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1205 "Python/bytecodes.c" + #line 1206 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1723,13 +1724,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1727 "Python/generated_cases.c.h" + #line 1728 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1217 "Python/bytecodes.c" + #line 1218 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1786,7 +1787,7 @@ } } } - #line 1790 "Python/generated_cases.c.h" + #line 1791 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1799,7 +1800,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1217 "Python/bytecodes.c" + #line 1218 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1856,7 +1857,7 @@ } } } - #line 1860 "Python/generated_cases.c.h" + #line 1861 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1868,7 +1869,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1286 "Python/bytecodes.c" + #line 1287 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1920,7 +1921,7 @@ } } null = NULL; - #line 1924 "Python/generated_cases.c.h" + #line 1925 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1934,7 +1935,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1340 "Python/bytecodes.c" + #line 1341 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1945,7 +1946,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1949 "Python/generated_cases.c.h" + #line 1950 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1960,7 +1961,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 1353 "Python/bytecodes.c" + #line 1354 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1975,7 +1976,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1979 "Python/generated_cases.c.h" + #line 1980 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1985,16 +1986,16 @@ } TARGET(DELETE_FAST) { - #line 1370 "Python/bytecodes.c" + #line 1371 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 1993 "Python/generated_cases.c.h" + #line 1994 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1376 "Python/bytecodes.c" + #line 1377 "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); @@ -2003,12 +2004,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2007 "Python/generated_cases.c.h" + #line 2008 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1387 "Python/bytecodes.c" + #line 1388 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2019,14 +2020,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2023 "Python/generated_cases.c.h" + #line 2024 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1400 "Python/bytecodes.c" + #line 1401 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -2061,14 +2062,14 @@ } Py_INCREF(value); } - #line 2065 "Python/generated_cases.c.h" + #line 2066 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1437 "Python/bytecodes.c" + #line 1438 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2076,7 +2077,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2080 "Python/generated_cases.c.h" + #line 2081 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2084,18 +2085,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1447 "Python/bytecodes.c" + #line 1448 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2093 "Python/generated_cases.c.h" + #line 2094 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1454 "Python/bytecodes.c" + #line 1455 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -2106,22 +2107,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2110 "Python/generated_cases.c.h" + #line 2111 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1467 "Python/bytecodes.c" + #line 1468 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2119 "Python/generated_cases.c.h" + #line 2120 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1469 "Python/bytecodes.c" + #line 1470 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2125 "Python/generated_cases.c.h" + #line 2126 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2131,10 +2132,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1473 "Python/bytecodes.c" + #line 1474 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2138 "Python/generated_cases.c.h" + #line 2139 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2144,10 +2145,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1478 "Python/bytecodes.c" + #line 1479 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2151 "Python/generated_cases.c.h" + #line 2152 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2157,7 +2158,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1483 "Python/bytecodes.c" + #line 1484 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2168,13 +2169,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2172 "Python/generated_cases.c.h" + #line 2173 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1494 "Python/bytecodes.c" + #line 1495 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2178 "Python/generated_cases.c.h" + #line 2179 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2183,13 +2184,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1501 "Python/bytecodes.c" + #line 1502 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2189 "Python/generated_cases.c.h" + #line 2190 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1503 "Python/bytecodes.c" + #line 1504 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2193 "Python/generated_cases.c.h" + #line 2194 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2197,7 +2198,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1507 "Python/bytecodes.c" + #line 1508 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2212,7 +2213,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2216 "Python/generated_cases.c.h" + #line 2217 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2222,7 +2223,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1524 "Python/bytecodes.c" + #line 1525 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2230,13 +2231,13 @@ if (map == NULL) goto error; - #line 2234 "Python/generated_cases.c.h" + #line 2235 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1532 "Python/bytecodes.c" + #line 1533 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2240 "Python/generated_cases.c.h" + #line 2241 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2244,7 +2245,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1536 "Python/bytecodes.c" + #line 1537 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2284,7 +2285,7 @@ Py_DECREF(ann_dict); } } - #line 2288 "Python/generated_cases.c.h" + #line 2289 "Python/generated_cases.c.h" DISPATCH(); } @@ -2292,7 +2293,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1578 "Python/bytecodes.c" + #line 1579 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2302,14 +2303,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2306 "Python/generated_cases.c.h" + #line 2307 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1588 "Python/bytecodes.c" + #line 1589 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2313 "Python/generated_cases.c.h" + #line 2314 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2317,7 +2318,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1592 "Python/bytecodes.c" + #line 1593 "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)) { @@ -2325,12 +2326,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2329 "Python/generated_cases.c.h" + #line 2330 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1600 "Python/bytecodes.c" + #line 1601 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2334 "Python/generated_cases.c.h" + #line 2335 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2338,17 +2339,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1606 "Python/bytecodes.c" + #line 1607 "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 2347 "Python/generated_cases.c.h" + #line 2348 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1611 "Python/bytecodes.c" + #line 1612 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2352 "Python/generated_cases.c.h" + #line 2353 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2358,26 +2359,26 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1618 "Python/bytecodes.c" + #line 1619 "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 2368 "Python/generated_cases.c.h" + #line 2369 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1627 "Python/bytecodes.c" + #line 1628 "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 2381 "Python/generated_cases.c.h" + #line 2382 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2388,7 +2389,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1641 "Python/bytecodes.c" + #line 1642 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2430,16 +2431,16 @@ } } } - #line 2434 "Python/generated_cases.c.h" + #line 2435 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1683 "Python/bytecodes.c" + #line 1684 "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 2443 "Python/generated_cases.c.h" + #line 2444 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2454,20 +2455,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1690 "Python/bytecodes.c" + #line 1691 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2465 "Python/generated_cases.c.h" + #line 2466 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1697 "Python/bytecodes.c" + #line 1698 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2471 "Python/generated_cases.c.h" + #line 2472 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2482,7 +2483,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1701 "Python/bytecodes.c" + #line 1702 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2505,7 +2506,7 @@ res = res2; res2 = NULL; } - #line 2509 "Python/generated_cases.c.h" + #line 2510 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2519,7 +2520,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1740 "Python/bytecodes.c" + #line 1741 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2553,9 +2554,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2557 "Python/generated_cases.c.h" + #line 2558 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1774 "Python/bytecodes.c" + #line 1775 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2564,12 +2565,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2568 "Python/generated_cases.c.h" + #line 2569 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1783 "Python/bytecodes.c" + #line 1784 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2573 "Python/generated_cases.c.h" + #line 2574 "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; } @@ -2583,7 +2584,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1788 "Python/bytecodes.c" + #line 1789 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2596,7 +2597,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2600 "Python/generated_cases.c.h" + #line 2601 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2611,7 +2612,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1804 "Python/bytecodes.c" + #line 1805 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2624,7 +2625,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2628 "Python/generated_cases.c.h" + #line 2629 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2639,7 +2640,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1820 "Python/bytecodes.c" + #line 1821 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2666,7 +2667,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2670 "Python/generated_cases.c.h" + #line 2671 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2681,7 +2682,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1850 "Python/bytecodes.c" + #line 1851 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2691,7 +2692,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2695 "Python/generated_cases.c.h" + #line 2696 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2706,7 +2707,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1863 "Python/bytecodes.c" + #line 1864 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2718,7 +2719,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2722 "Python/generated_cases.c.h" + #line 2723 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2732,7 +2733,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 1878 "Python/bytecodes.c" + #line 1879 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2756,7 +2757,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2760 "Python/generated_cases.c.h" + #line 2761 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2764,7 +2765,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 1904 "Python/bytecodes.c" + #line 1905 "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); @@ -2790,7 +2791,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2794 "Python/generated_cases.c.h" + #line 2795 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2798,7 +2799,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 1932 "Python/bytecodes.c" + #line 1933 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2816,7 +2817,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2820 "Python/generated_cases.c.h" + #line 2821 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2827,7 +2828,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 1952 "Python/bytecodes.c" + #line 1953 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2866,7 +2867,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2870 "Python/generated_cases.c.h" + #line 2871 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2877,7 +2878,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 1993 "Python/bytecodes.c" + #line 1994 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2887,7 +2888,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2891 "Python/generated_cases.c.h" + #line 2892 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2899,7 +2900,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2012 "Python/bytecodes.c" + #line 2013 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2912,12 +2913,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2916 "Python/generated_cases.c.h" + #line 2917 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2025 "Python/bytecodes.c" + #line 2026 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2921 "Python/generated_cases.c.h" + #line 2922 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2928,7 +2929,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2029 "Python/bytecodes.c" + #line 2030 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2939,7 +2940,7 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2943 "Python/generated_cases.c.h" + #line 2944 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2950,7 +2951,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2043 "Python/bytecodes.c" + #line 2044 "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); @@ -2965,7 +2966,7 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2969 "Python/generated_cases.c.h" + #line 2970 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2976,7 +2977,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2061 "Python/bytecodes.c" + #line 2062 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2988,7 +2989,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 2992 "Python/generated_cases.c.h" + #line 2993 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2999,14 +3000,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2075 "Python/bytecodes.c" + #line 2076 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3005 "Python/generated_cases.c.h" + #line 3006 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2077 "Python/bytecodes.c" + #line 2078 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3010 "Python/generated_cases.c.h" + #line 3011 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3016,15 +3017,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2081 "Python/bytecodes.c" + #line 2082 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3022 "Python/generated_cases.c.h" + #line 3023 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2083 "Python/bytecodes.c" + #line 2084 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3028 "Python/generated_cases.c.h" + #line 3029 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3035,12 +3036,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2088 "Python/bytecodes.c" + #line 2089 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3041 "Python/generated_cases.c.h" + #line 3042 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2090 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3048,10 +3049,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3052 "Python/generated_cases.c.h" + #line 3053 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2098 "Python/bytecodes.c" + #line 2099 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3060,7 +3061,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3064 "Python/generated_cases.c.h" + #line 3065 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3070,21 +3071,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2109 "Python/bytecodes.c" + #line 2110 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3077 "Python/generated_cases.c.h" + #line 3078 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2112 "Python/bytecodes.c" + #line 2113 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3084 "Python/generated_cases.c.h" + #line 3085 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2117 "Python/bytecodes.c" + #line 2118 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3088 "Python/generated_cases.c.h" + #line 3089 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3093,15 +3094,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2121 "Python/bytecodes.c" + #line 2122 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3100 "Python/generated_cases.c.h" + #line 3101 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2124 "Python/bytecodes.c" + #line 2125 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3105 "Python/generated_cases.c.h" + #line 3106 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3110,26 +3111,26 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2128 "Python/bytecodes.c" + #line 2129 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3118 "Python/generated_cases.c.h" + #line 3119 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2134 "Python/bytecodes.c" + #line 2135 "Python/bytecodes.c" JUMPBY(oparg); - #line 3127 "Python/generated_cases.c.h" + #line 3128 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2138 "Python/bytecodes.c" + #line 2139 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3146,13 +3147,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3150 "Python/generated_cases.c.h" + #line 3151 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2158 "Python/bytecodes.c" + #line 2159 "Python/bytecodes.c" _PyExecutorObject *executor = (_PyExecutorObject *)frame->f_code->co_executors->executors[oparg]; Py_INCREF(executor); frame = executor->execute(executor, frame, stack_pointer); @@ -3161,21 +3162,21 @@ goto error; } goto resume_frame; - #line 3165 "Python/generated_cases.c.h" + #line 3166 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2169 "Python/bytecodes.c" + #line 2170 "Python/bytecodes.c" if (Py_IsFalse(cond)) { JUMPBY(oparg); } else if (!Py_IsTrue(cond)) { int err = PyObject_IsTrue(cond); - #line 3177 "Python/generated_cases.c.h" + #line 3178 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2175 "Python/bytecodes.c" + #line 2176 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -3183,22 +3184,22 @@ if (err < 0) goto pop_1_error; } } - #line 3187 "Python/generated_cases.c.h" + #line 3188 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2185 "Python/bytecodes.c" + #line 2186 "Python/bytecodes.c" if (Py_IsTrue(cond)) { JUMPBY(oparg); } else if (!Py_IsFalse(cond)) { int err = PyObject_IsTrue(cond); - #line 3200 "Python/generated_cases.c.h" + #line 3201 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2191 "Python/bytecodes.c" + #line 2192 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -3206,63 +3207,63 @@ if (err < 0) goto pop_1_error; } } - #line 3210 "Python/generated_cases.c.h" + #line 3211 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2201 "Python/bytecodes.c" + #line 2202 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3219 "Python/generated_cases.c.h" + #line 3220 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2203 "Python/bytecodes.c" + #line 2204 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3224 "Python/generated_cases.c.h" + #line 3225 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2208 "Python/bytecodes.c" + #line 2209 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3236 "Python/generated_cases.c.h" + #line 3237 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2213 "Python/bytecodes.c" + #line 2214 "Python/bytecodes.c" } - #line 3240 "Python/generated_cases.c.h" + #line 3241 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2217 "Python/bytecodes.c" + #line 2218 "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 3253 "Python/generated_cases.c.h" + #line 3254 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2226 "Python/bytecodes.c" + #line 2227 "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 3266 "Python/generated_cases.c.h" + #line 3267 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3273,16 +3274,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2234 "Python/bytecodes.c" + #line 2235 "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 3282 "Python/generated_cases.c.h" + #line 3283 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2239 "Python/bytecodes.c" + #line 2240 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3290,7 +3291,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3294 "Python/generated_cases.c.h" + #line 3295 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3299,10 +3300,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2249 "Python/bytecodes.c" + #line 2250 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3306 "Python/generated_cases.c.h" + #line 3307 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3312,10 +3313,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2255 "Python/bytecodes.c" + #line 2256 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3319 "Python/generated_cases.c.h" + #line 3320 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3326,11 +3327,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2261 "Python/bytecodes.c" + #line 2262 "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 3334 "Python/generated_cases.c.h" + #line 3335 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3339,14 +3340,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2267 "Python/bytecodes.c" + #line 2268 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3346 "Python/generated_cases.c.h" + #line 3347 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2270 "Python/bytecodes.c" + #line 2271 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3350 "Python/generated_cases.c.h" + #line 3351 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3354,7 +3355,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2274 "Python/bytecodes.c" + #line 2275 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3377,11 +3378,11 @@ if (iter == NULL) { goto error; } - #line 3381 "Python/generated_cases.c.h" + #line 3382 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2297 "Python/bytecodes.c" + #line 2298 "Python/bytecodes.c" } - #line 3385 "Python/generated_cases.c.h" + #line 3386 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3392,7 +3393,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2316 "Python/bytecodes.c" + #line 2317 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3423,7 +3424,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3427 "Python/generated_cases.c.h" + #line 3428 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3431,7 +3432,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2349 "Python/bytecodes.c" + #line 2350 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3457,14 +3458,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3461 "Python/generated_cases.c.h" + #line 3462 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2377 "Python/bytecodes.c" + #line 2378 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3484,7 +3485,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3488 "Python/generated_cases.c.h" + #line 3489 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3494,7 +3495,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2399 "Python/bytecodes.c" + #line 2400 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3514,7 +3515,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3518 "Python/generated_cases.c.h" + #line 3519 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3524,7 +3525,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2421 "Python/bytecodes.c" + #line 2422 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3542,7 +3543,7 @@ if (next == NULL) { goto error; } - #line 3546 "Python/generated_cases.c.h" + #line 3547 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3551,7 +3552,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2441 "Python/bytecodes.c" + #line 2442 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3567,14 +3568,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3571 "Python/generated_cases.c.h" + #line 3572 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2459 "Python/bytecodes.c" + #line 2460 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3597,16 +3598,16 @@ Py_DECREF(enter); goto error; } - #line 3601 "Python/generated_cases.c.h" + #line 3602 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2482 "Python/bytecodes.c" + #line 2483 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3610 "Python/generated_cases.c.h" + #line 3611 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3618,7 +3619,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2492 "Python/bytecodes.c" + #line 2493 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3644,16 +3645,16 @@ Py_DECREF(enter); goto error; } - #line 3648 "Python/generated_cases.c.h" + #line 3649 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2518 "Python/bytecodes.c" + #line 2519 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3657 "Python/generated_cases.c.h" + #line 3658 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3665,7 +3666,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2527 "Python/bytecodes.c" + #line 2528 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3686,7 +3687,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3690 "Python/generated_cases.c.h" + #line 3691 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3695,7 +3696,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2550 "Python/bytecodes.c" + #line 2551 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3705,7 +3706,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3709 "Python/generated_cases.c.h" + #line 3710 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3719,7 +3720,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 2562 "Python/bytecodes.c" + #line 2563 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3736,7 +3737,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3740 "Python/generated_cases.c.h" + #line 3741 "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; } @@ -3750,7 +3751,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2581 "Python/bytecodes.c" + #line 2582 "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); @@ -3760,7 +3761,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3764 "Python/generated_cases.c.h" + #line 3765 "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; } @@ -3774,7 +3775,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2593 "Python/bytecodes.c" + #line 2594 "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; @@ -3788,7 +3789,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3792 "Python/generated_cases.c.h" + #line 3793 "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; } @@ -3797,16 +3798,16 @@ } TARGET(KW_NAMES) { - #line 2609 "Python/bytecodes.c" + #line 2610 "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 3805 "Python/generated_cases.c.h" + #line 3806 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2615 "Python/bytecodes.c" + #line 2616 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3819,7 +3820,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3823 "Python/generated_cases.c.h" + #line 3824 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3829,7 +3830,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2660 "Python/bytecodes.c" + #line 2661 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3911,7 +3912,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3915 "Python/generated_cases.c.h" + #line 3916 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3923,7 +3924,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2748 "Python/bytecodes.c" + #line 2749 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3933,7 +3934,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3937 "Python/generated_cases.c.h" + #line 3938 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3942,7 +3943,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2760 "Python/bytecodes.c" + #line 2761 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3968,7 +3969,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3972 "Python/generated_cases.c.h" + #line 3973 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3976,7 +3977,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2788 "Python/bytecodes.c" + #line 2789 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4012,7 +4013,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4016 "Python/generated_cases.c.h" + #line 4017 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4020,7 +4021,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2826 "Python/bytecodes.c" + #line 2827 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4030,7 +4031,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4034 "Python/generated_cases.c.h" + #line 4035 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4043,7 +4044,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2838 "Python/bytecodes.c" + #line 2839 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4054,7 +4055,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4058 "Python/generated_cases.c.h" + #line 4059 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4068,7 +4069,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2852 "Python/bytecodes.c" + #line 2853 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4079,7 +4080,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4083 "Python/generated_cases.c.h" + #line 4084 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4093,7 +4094,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2866 "Python/bytecodes.c" + #line 2867 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4115,7 +4116,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4119 "Python/generated_cases.c.h" + #line 4120 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4129,7 +4130,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2891 "Python/bytecodes.c" + #line 2892 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4157,7 +4158,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4161 "Python/generated_cases.c.h" + #line 4162 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4171,7 +4172,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2922 "Python/bytecodes.c" + #line 2923 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4203,7 +4204,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4207 "Python/generated_cases.c.h" + #line 4208 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4217,7 +4218,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2957 "Python/bytecodes.c" + #line 2958 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4249,7 +4250,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4253 "Python/generated_cases.c.h" + #line 4254 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4263,7 +4264,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2992 "Python/bytecodes.c" + #line 2993 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4288,7 +4289,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4292 "Python/generated_cases.c.h" + #line 4293 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4301,7 +4302,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3019 "Python/bytecodes.c" + #line 3020 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4328,7 +4329,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4332 "Python/generated_cases.c.h" + #line 4333 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4340,7 +4341,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3049 "Python/bytecodes.c" + #line 3050 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4358,14 +4359,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4362 "Python/generated_cases.c.h" + #line 4363 "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 3069 "Python/bytecodes.c" + #line 3070 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4396,7 +4397,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4400 "Python/generated_cases.c.h" + #line 4401 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4409,7 +4410,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3103 "Python/bytecodes.c" + #line 3104 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4438,7 +4439,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4442 "Python/generated_cases.c.h" + #line 4443 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4451,7 +4452,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3135 "Python/bytecodes.c" + #line 3136 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4480,7 +4481,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4484 "Python/generated_cases.c.h" + #line 4485 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4493,7 +4494,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3167 "Python/bytecodes.c" + #line 3168 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4521,7 +4522,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4525 "Python/generated_cases.c.h" + #line 4526 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4531,9 +4532,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3198 "Python/bytecodes.c" + #line 3199 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4537 "Python/generated_cases.c.h" + #line 4538 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4542,7 +4543,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3202 "Python/bytecodes.c" + #line 3203 "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)); @@ -4604,14 +4605,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4608 "Python/generated_cases.c.h" + #line 4609 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3264 "Python/bytecodes.c" + #line 3265 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4615 "Python/generated_cases.c.h" + #line 4616 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4626,7 +4627,7 @@ PyObject *kwdefaults = (oparg & MAKE_FUNCTION_KWDEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & MAKE_FUNCTION_DEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0))] : NULL; PyObject *func; - #line 3274 "Python/bytecodes.c" + #line 3275 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4655,14 +4656,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4659 "Python/generated_cases.c.h" + #line 4660 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3305 "Python/bytecodes.c" + #line 3306 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4683,7 +4684,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4687 "Python/generated_cases.c.h" + #line 4688 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4691,15 +4692,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3328 "Python/bytecodes.c" + #line 3329 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4697 "Python/generated_cases.c.h" + #line 4698 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3330 "Python/bytecodes.c" + #line 3331 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4703 "Python/generated_cases.c.h" + #line 4704 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4710,7 +4711,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 3334 "Python/bytecodes.c" + #line 3335 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4745,7 +4746,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 4749 "Python/generated_cases.c.h" + #line 4750 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4754,10 +4755,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3371 "Python/bytecodes.c" + #line 3372 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4761 "Python/generated_cases.c.h" + #line 4762 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4769,7 +4770,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3376 "Python/bytecodes.c" + #line 3377 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4784,12 +4785,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4788 "Python/generated_cases.c.h" + #line 4789 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3391 "Python/bytecodes.c" + #line 3392 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4793 "Python/generated_cases.c.h" + #line 4794 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4799,16 +4800,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3396 "Python/bytecodes.c" + #line 3397 "Python/bytecodes.c" assert(oparg >= 2); - #line 4805 "Python/generated_cases.c.h" + #line 4806 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3400 "Python/bytecodes.c" + #line 3401 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4820,26 +4821,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4824 "Python/generated_cases.c.h" + #line 4825 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3414 "Python/bytecodes.c" + #line 3415 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4830 "Python/generated_cases.c.h" + #line 4831 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3418 "Python/bytecodes.c" + #line 3419 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4837 "Python/generated_cases.c.h" + #line 4838 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3423 "Python/bytecodes.c" + #line 3424 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4848,12 +4849,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4852 "Python/generated_cases.c.h" + #line 4853 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3434 "Python/bytecodes.c" + #line 3435 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4862,12 +4863,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4866 "Python/generated_cases.c.h" + #line 4867 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3445 "Python/bytecodes.c" + #line 3446 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4879,12 +4880,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4883 "Python/generated_cases.c.h" + #line 4884 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3459 "Python/bytecodes.c" + #line 3460 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4896,30 +4897,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4900 "Python/generated_cases.c.h" + #line 4901 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3473 "Python/bytecodes.c" + #line 3474 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4911 "Python/generated_cases.c.h" + #line 4912 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3481 "Python/bytecodes.c" + #line 3482 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4918 "Python/generated_cases.c.h" + #line 4919 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3486 "Python/bytecodes.c" + #line 3487 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4925 "Python/generated_cases.c.h" + #line 4926 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index ce9c2e7b25a3a8..4117dd52dcfaf9 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -800,207 +800,214 @@ _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_IBIB, 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; }; #ifndef NEED_OPCODE_METADATA extern const struct opcode_metadata _PyOpcode_opcode_metadata[256]; #else const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { - [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_LOAD_FAST] = { true, INSTR_FMT_IB }, - [STORE_FAST_STORE_FAST] = { true, INSTR_FMT_IB }, - [LOAD_FAST__LOAD_CONST] = { true, INSTR_FMT_IBIB }, - [LOAD_CONST__LOAD_FAST] = { true, INSTR_FMT_IBIB }, - [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_ATTR_ATTR] = { true, INSTR_FMT_IBC }, - [LOAD_SUPER_ATTR_METHOD] = { true, INSTR_FMT_IBC }, - [LOAD_ATTR] = { 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 }, - [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 }, - [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_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, 1 }, + [INSTRUMENTED_RESUME] = { true, INSTR_FMT_IB, 1 }, + [LOAD_CLOSURE] = { true, INSTR_FMT_IB, 1 }, + [LOAD_FAST_CHECK] = { true, INSTR_FMT_IB, 1 }, + [LOAD_FAST] = { true, INSTR_FMT_IB, 1 }, + [LOAD_FAST_AND_CLEAR] = { true, INSTR_FMT_IB, 1 }, + [LOAD_FAST_LOAD_FAST] = { true, INSTR_FMT_IB, 1 }, + [LOAD_CONST] = { true, INSTR_FMT_IB, 3 }, + [STORE_FAST] = { true, INSTR_FMT_IB, 1 }, + [STORE_FAST_LOAD_FAST] = { true, INSTR_FMT_IB, 1 }, + [STORE_FAST_STORE_FAST] = { true, INSTR_FMT_IB, 1 }, + [LOAD_FAST__LOAD_CONST] = { true, INSTR_FMT_IBIB, 3 }, + [LOAD_CONST__LOAD_FAST] = { true, INSTR_FMT_IBIB, 3 }, + [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, 1 }, + [SET_ADD] = { true, INSTR_FMT_IB, 1 }, + [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, 1 }, + [CALL_INTRINSIC_2] = { true, INSTR_FMT_IB, 1 }, + [RAISE_VARARGS] = { true, INSTR_FMT_IB, 1 }, + [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, 3 }, + [INSTRUMENTED_RETURN_CONST] = { true, INSTR_FMT_IB, 3 }, + [GET_AITER] = { true, INSTR_FMT_IX, 0 }, + [GET_ANEXT] = { true, INSTR_FMT_IX, 0 }, + [GET_AWAITABLE] = { true, INSTR_FMT_IB, 1 }, + [SEND] = { true, INSTR_FMT_IBC, 1 }, + [SEND_GEN] = { true, INSTR_FMT_IBC, 1 }, + [INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IX, 0 }, + [YIELD_VALUE] = { true, INSTR_FMT_IB, 1 }, + [POP_EXCEPT] = { true, INSTR_FMT_IX, 0 }, + [RERAISE] = { true, INSTR_FMT_IB, 1 }, + [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, 5 }, + [DELETE_NAME] = { true, INSTR_FMT_IB, 5 }, + [UNPACK_SEQUENCE] = { true, INSTR_FMT_IBC, 1 }, + [UNPACK_SEQUENCE_TWO_TUPLE] = { true, INSTR_FMT_IBC, 1 }, + [UNPACK_SEQUENCE_TUPLE] = { true, INSTR_FMT_IBC, 1 }, + [UNPACK_SEQUENCE_LIST] = { true, INSTR_FMT_IBC, 1 }, + [UNPACK_EX] = { true, INSTR_FMT_IB, 1 }, + [STORE_ATTR] = { true, INSTR_FMT_IBC000, 5 }, + [DELETE_ATTR] = { true, INSTR_FMT_IB, 5 }, + [STORE_GLOBAL] = { true, INSTR_FMT_IB, 5 }, + [DELETE_GLOBAL] = { true, INSTR_FMT_IB, 5 }, + [LOAD_LOCALS] = { true, INSTR_FMT_IB, 0 }, + [LOAD_NAME] = { true, INSTR_FMT_IB, 5 }, + [LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB, 5 }, + [LOAD_GLOBAL] = { true, INSTR_FMT_IBC000, 5 }, + [LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC000, 1 }, + [LOAD_GLOBAL_BUILTIN] = { true, INSTR_FMT_IBC000, 1 }, + [DELETE_FAST] = { true, INSTR_FMT_IB, 1 }, + [MAKE_CELL] = { true, INSTR_FMT_IB, 1 }, + [DELETE_DEREF] = { true, INSTR_FMT_IB, 1 }, + [LOAD_FROM_DICT_OR_DEREF] = { true, INSTR_FMT_IB, 1 }, + [LOAD_DEREF] = { true, INSTR_FMT_IB, 1 }, + [STORE_DEREF] = { true, INSTR_FMT_IB, 1 }, + [COPY_FREE_VARS] = { true, INSTR_FMT_IB, 1 }, + [BUILD_STRING] = { true, INSTR_FMT_IB, 1 }, + [BUILD_TUPLE] = { true, INSTR_FMT_IB, 1 }, + [BUILD_LIST] = { true, INSTR_FMT_IB, 1 }, + [LIST_EXTEND] = { true, INSTR_FMT_IB, 1 }, + [SET_UPDATE] = { true, INSTR_FMT_IB, 1 }, + [BUILD_SET] = { true, INSTR_FMT_IB, 1 }, + [BUILD_MAP] = { true, INSTR_FMT_IB, 1 }, + [SETUP_ANNOTATIONS] = { true, INSTR_FMT_IX, 0 }, + [BUILD_CONST_KEY_MAP] = { true, INSTR_FMT_IB, 1 }, + [DICT_UPDATE] = { true, INSTR_FMT_IB, 1 }, + [DICT_MERGE] = { true, INSTR_FMT_IB, 1 }, + [MAP_ADD] = { true, INSTR_FMT_IB, 1 }, + [INSTRUMENTED_LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC, 5 }, + [LOAD_SUPER_ATTR_ATTR] = { true, INSTR_FMT_IBC, 5 }, + [LOAD_SUPER_ATTR_METHOD] = { true, INSTR_FMT_IBC, 5 }, + [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000, 5 }, + [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC00000000, 5 }, + [LOAD_ATTR_SLOT] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_ATTR_CLASS] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_ATTR_PROPERTY] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = { true, INSTR_FMT_IBC00000000, 5 }, + [STORE_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IXC000, 0 }, + [STORE_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC000, 5 }, + [STORE_ATTR_SLOT] = { true, INSTR_FMT_IXC000, 0 }, + [COMPARE_OP] = { true, INSTR_FMT_IBC, 1 }, + [COMPARE_OP_FLOAT] = { true, INSTR_FMT_IBC, 1 }, + [COMPARE_OP_INT] = { true, INSTR_FMT_IBC, 1 }, + [COMPARE_OP_STR] = { true, INSTR_FMT_IBC, 1 }, + [IS_OP] = { true, INSTR_FMT_IB, 1 }, + [CONTAINS_OP] = { true, INSTR_FMT_IB, 1 }, + [CHECK_EG_MATCH] = { true, INSTR_FMT_IX, 0 }, + [CHECK_EXC_MATCH] = { true, INSTR_FMT_IX, 0 }, + [IMPORT_NAME] = { true, INSTR_FMT_IB, 5 }, + [IMPORT_FROM] = { true, INSTR_FMT_IB, 5 }, + [JUMP_FORWARD] = { true, INSTR_FMT_IB, 1 }, + [JUMP_BACKWARD] = { true, INSTR_FMT_IB, 1 }, + [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, 1 }, + [POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, 1 }, + [POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, 1 }, + [POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, 1 }, + [POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, 1 }, + [JUMP_BACKWARD_NO_INTERRUPT] = { true, INSTR_FMT_IB, 1 }, + [GET_LEN] = { true, INSTR_FMT_IX, 0 }, + [MATCH_CLASS] = { true, INSTR_FMT_IB, 1 }, + [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, 1 }, + [INSTRUMENTED_FOR_ITER] = { true, INSTR_FMT_IB, 1 }, + [FOR_ITER_LIST] = { true, INSTR_FMT_IBC, 1 }, + [FOR_ITER_TUPLE] = { true, INSTR_FMT_IBC, 1 }, + [FOR_ITER_RANGE] = { true, INSTR_FMT_IBC, 1 }, + [FOR_ITER_GEN] = { true, INSTR_FMT_IBC, 1 }, + [BEFORE_ASYNC_WITH] = { true, INSTR_FMT_IX, 0 }, + [BEFORE_WITH] = { true, INSTR_FMT_IX, 0 }, + [WITH_EXCEPT_START] = { true, INSTR_FMT_IX, 0 }, + [PUSH_EXC_INFO] = { true, INSTR_FMT_IX, 0 }, + [LOAD_ATTR_METHOD_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_ATTR_METHOD_NO_DICT] = { true, INSTR_FMT_IBC00000000, 1 }, + [LOAD_ATTR_METHOD_LAZY_DICT] = { true, INSTR_FMT_IBC00000000, 1 }, + [KW_NAMES] = { true, INSTR_FMT_IB, 3 }, + [INSTRUMENTED_CALL] = { true, INSTR_FMT_IB, 1 }, + [CALL] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_PY_EXACT_ARGS] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_PY_WITH_DEFAULTS] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_TYPE_1] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_STR_1] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_TUPLE_1] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_BUILTIN_CLASS] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_BUILTIN_O] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_BUILTIN_FAST] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_BUILTIN_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_LEN] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_ISINSTANCE] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_LIST_APPEND] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_METHOD_DESCRIPTOR_O] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = { true, INSTR_FMT_IBC00, 1 }, + [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = { true, INSTR_FMT_IBC00, 1 }, + [INSTRUMENTED_CALL_FUNCTION_EX] = { true, INSTR_FMT_IX, 0 }, + [CALL_FUNCTION_EX] = { true, INSTR_FMT_IB, 1 }, + [MAKE_FUNCTION] = { true, INSTR_FMT_IB, 1 }, + [RETURN_GENERATOR] = { true, INSTR_FMT_IX, 0 }, + [BUILD_SLICE] = { true, INSTR_FMT_IB, 1 }, + [FORMAT_VALUE] = { true, INSTR_FMT_IB, 1 }, + [COPY] = { true, INSTR_FMT_IB, 1 }, + [BINARY_OP] = { true, INSTR_FMT_IBC, 1 }, + [SWAP] = { true, INSTR_FMT_IB, 1 }, + [INSTRUMENTED_INSTRUCTION] = { true, INSTR_FMT_IX, 0 }, + [INSTRUMENTED_JUMP_FORWARD] = { true, INSTR_FMT_IB, 1 }, + [INSTRUMENTED_JUMP_BACKWARD] = { true, INSTR_FMT_IB, 1 }, + [INSTRUMENTED_POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, 1 }, + [INSTRUMENTED_POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, 1 }, + [INSTRUMENTED_POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, 1 }, + [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, 1 }, + [EXTENDED_ARG] = { true, INSTR_FMT_IB, 1 }, + [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 22184d5051e7ca..0af5b9dfed53e3 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -223,6 +223,7 @@ def assign(self, dst: StackEffect, src: StackEffect): 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: @@ -245,6 +246,7 @@ class Instruction: output_effects: list[StackEffect] unmoved_names: frozenset[str] instr_fmt: str + flags: int # Set later family: parser.Family | None = None @@ -273,7 +275,18 @@ def __init__(self, inst: parser.InstDef): else: break self.unmoved_names = frozenset(unmoved_names) - if variable_used(inst, "oparg"): + if inst.name == 'YIELD_VALUE': breakpoint() + flag_data = { + 'HAS_ARG' : variable_used(inst, "oparg"), + 'HAS_CONST': variable_used(inst, "frame->f_code->co_consts", delim="->"), + 'HAS_NAME' : variable_used(inst, "frame->f_code->co_names", delim="->"), + } + assert set(flag_data.keys()) == set(INSTRUCTION_FLAGS) + self.flags = 0 + for i, name in enumerate(INSTRUCTION_FLAGS): + self.flags |= (1< SuperInstruction: sp = initial_sp parts: list[Component] = [] format = "" + flags = 0 for instr in components: part, sp = self.analyze_instruction(instr, stack, sp) parts.append(part) format += instr.instr_fmt + flags |= instr.flags final_sp = sp return SuperInstruction( - super.name, stack, initial_sp, final_sp, format, super, parts + super.name, stack, initial_sp, final_sp, format, flags, super, parts ) def analyze_macro(self, macro: parser.Macro) -> MacroInstruction: @@ -776,6 +792,7 @@ def analyze_macro(self, macro: parser.Macro) -> MacroInstruction: sp = initial_sp parts: list[Component | parser.CacheEffect] = [] format = "IB" + flags = 0 cache = "C" for component in components: match component: @@ -791,11 +808,12 @@ def analyze_macro(self, macro: parser.Macro) -> MacroInstruction: 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_instruction( @@ -1013,10 +1031,16 @@ def write_metadata(self) -> None: # Write type definitions self.out.emit(f"enum InstructionFormat {{ {', '.join(format_enums)} }};") + for i, name in enumerate(INSTRUCTION_FLAGS): + self.out.emit(f"#define {name}_FLAG ({1 << i})"); + for name in INSTRUCTION_FLAGS: + self.out.emit(f"#define OPCODE_{name}(OP) (_PyOpcode_opcode_metadata[(OP)].flags & {name}_FLAG)"); + 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("") @@ -1048,19 +1072,19 @@ def write_metadata(self) -> None: def write_metadata_for_inst(self, instr: Instruction) -> None: """Write metadata for a single instruction.""" self.out.emit( - f" [{instr.name}] = {{ true, {INSTR_FMT_PREFIX}{instr.instr_fmt} }}," + f" [{instr.name}] = {{ true, {INSTR_FMT_PREFIX}{instr.instr_fmt}, {instr.flags} }}," ) def write_metadata_for_super(self, sup: SuperInstruction) -> None: """Write metadata for a super-instruction.""" self.out.emit( - f" [{sup.name}] = {{ true, {INSTR_FMT_PREFIX}{sup.instr_fmt} }}," + f" [{sup.name}] = {{ true, {INSTR_FMT_PREFIX}{sup.instr_fmt}, {sup.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} }}," + f" [{mac.name}] = {{ true, {INSTR_FMT_PREFIX}{mac.instr_fmt}, {mac.flags} }}," ) def write_instructions(self) -> None: @@ -1257,11 +1281,36 @@ def always_exits(lines: list[str]) -> bool: ) -def variable_used(node: parser.Node, name: str) -> bool: - """Determine whether a variable with a given name is used in a node.""" - return any( - token.kind == "IDENTIFIER" and token.text == name for token in node.tokens - ) +def variable_used(node: parser.Node, name: str, delim: str = None) -> bool: + """Determine whether a variable with a given name is used in a node. + If delim is not None, the name is assumed to be a chain of names + delimited by delim. For example: "frame->f_code->co_consts", delim="->". + """ + if delim is None: + return any( + token.kind == "IDENTIFIER" and token.text == name for token in node.tokens + ) + + # delim is not None - look for the sequence of names + orig_names = name.split(delim) + orig_names.reverse() + names = orig_names + + need_delim = False + for token in node.tokens: + if need_delim: + if token.text == delim: + need_delim = False + else: + # no match, start over + names = orig_names + continue + if token.kind == "IDENTIFIER" and token.text == names[-1]: + names.pop() + if not names: + return True + need_delim = True + return False def main(): From 35430de502b8666f44e4bad4c9e546f900187461 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 8 Jun 2023 12:45:06 +0100 Subject: [PATCH 2/8] emit symbolic flags --- Python/bytecodes.c | 1 + Python/generated_cases.c.h | 707 ++++++++++++------------ Python/opcode_metadata.h | 272 ++++----- Tools/cases_generator/generate_cases.py | 33 +- 4 files changed, 510 insertions(+), 503 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 67823956233c82..26bc852466775e 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -930,6 +930,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); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 84023b6c72a79c..879f053a027aee 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -1302,6 +1302,7 @@ PyObject *retval = stack_pointer[-1]; #line 932 "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); @@ -1317,12 +1318,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1321 "Python/generated_cases.c.h" + #line 1322 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 951 "Python/bytecodes.c" + #line 952 "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. @@ -1339,15 +1340,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; - #line 1343 "Python/generated_cases.c.h" + #line 1344 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 970 "Python/bytecodes.c" + #line 971 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); - #line 1351 "Python/generated_cases.c.h" + #line 1352 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1355,7 +1356,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 975 "Python/bytecodes.c" + #line 976 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1373,26 +1374,26 @@ Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; - #line 1377 "Python/generated_cases.c.h" + #line 1378 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 995 "Python/bytecodes.c" + #line 996 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { - #line 1386 "Python/generated_cases.c.h" + #line 1387 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 998 "Python/bytecodes.c" + #line 999 "Python/bytecodes.c" } else { Py_INCREF(exc); _PyErr_SetRaisedException(tstate, exc); goto exception_unwind; } - #line 1396 "Python/generated_cases.c.h" + #line 1397 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1403,23 +1404,23 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 1007 "Python/bytecodes.c" + #line 1008 "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 1412 "Python/generated_cases.c.h" + #line 1413 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1012 "Python/bytecodes.c" + #line 1013 "Python/bytecodes.c" none = Py_None; } else { _PyErr_SetRaisedException(tstate, Py_NewRef(exc_value)); goto exception_unwind; } - #line 1423 "Python/generated_cases.c.h" + #line 1424 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1428,9 +1429,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1021 "Python/bytecodes.c" + #line 1022 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); - #line 1434 "Python/generated_cases.c.h" + #line 1435 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1438,7 +1439,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1025 "Python/bytecodes.c" + #line 1026 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1460,7 +1461,7 @@ if (true) goto error; } } - #line 1464 "Python/generated_cases.c.h" + #line 1465 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1468,33 +1469,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1050 "Python/bytecodes.c" + #line 1051 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); - #line 1479 "Python/generated_cases.c.h" + #line 1480 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1057 "Python/bytecodes.c" + #line 1058 "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 1488 "Python/generated_cases.c.h" + #line 1489 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1064 "Python/bytecodes.c" + #line 1065 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1492 "Python/generated_cases.c.h" + #line 1493 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { - #line 1068 "Python/bytecodes.c" + #line 1069 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1511,7 +1512,7 @@ name); goto error; } - #line 1515 "Python/generated_cases.c.h" + #line 1516 "Python/generated_cases.c.h" DISPATCH(); } @@ -1519,7 +1520,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1094 "Python/bytecodes.c" + #line 1095 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1532,11 +1533,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); - #line 1536 "Python/generated_cases.c.h" + #line 1537 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1107 "Python/bytecodes.c" + #line 1108 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1540 "Python/generated_cases.c.h" + #line 1541 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1546,14 +1547,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1111 "Python/bytecodes.c" + #line 1112 "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 1557 "Python/generated_cases.c.h" + #line 1558 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1564,7 +1565,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1121 "Python/bytecodes.c" + #line 1122 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1572,7 +1573,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1576 "Python/generated_cases.c.h" + #line 1577 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1583,7 +1584,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1132 "Python/bytecodes.c" + #line 1133 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1591,7 +1592,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } - #line 1595 "Python/generated_cases.c.h" + #line 1596 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1601,15 +1602,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1143 "Python/bytecodes.c" + #line 1144 "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 1609 "Python/generated_cases.c.h" + #line 1610 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1147 "Python/bytecodes.c" + #line 1148 "Python/bytecodes.c" if (res == 0) goto pop_1_error; - #line 1613 "Python/generated_cases.c.h" + #line 1614 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1620,7 +1621,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1158 "Python/bytecodes.c" + #line 1159 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1636,12 +1637,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); - #line 1640 "Python/generated_cases.c.h" + #line 1641 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1174 "Python/bytecodes.c" + #line 1175 "Python/bytecodes.c" if (err) goto pop_2_error; - #line 1645 "Python/generated_cases.c.h" + #line 1646 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1649,34 +1650,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1178 "Python/bytecodes.c" + #line 1179 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); - #line 1656 "Python/generated_cases.c.h" + #line 1657 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1181 "Python/bytecodes.c" + #line 1182 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1660 "Python/generated_cases.c.h" + #line 1661 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1185 "Python/bytecodes.c" + #line 1186 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); - #line 1670 "Python/generated_cases.c.h" + #line 1671 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1188 "Python/bytecodes.c" + #line 1189 "Python/bytecodes.c" if (err) goto pop_1_error; - #line 1674 "Python/generated_cases.c.h" + #line 1675 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { - #line 1192 "Python/bytecodes.c" + #line 1193 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1688,7 +1689,7 @@ } goto error; } - #line 1692 "Python/generated_cases.c.h" + #line 1693 "Python/generated_cases.c.h" DISPATCH(); } @@ -1696,7 +1697,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1206 "Python/bytecodes.c" + #line 1207 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1704,7 +1705,7 @@ if (true) goto error; } Py_INCREF(locals); - #line 1708 "Python/generated_cases.c.h" + #line 1709 "Python/generated_cases.c.h" _tmp_1 = locals; } STACK_GROW(1); @@ -1716,7 +1717,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1206 "Python/bytecodes.c" + #line 1207 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1724,13 +1725,13 @@ if (true) goto error; } Py_INCREF(locals); - #line 1728 "Python/generated_cases.c.h" + #line 1729 "Python/generated_cases.c.h" _tmp_1 = locals; } { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1218 "Python/bytecodes.c" + #line 1219 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1787,7 +1788,7 @@ } } } - #line 1791 "Python/generated_cases.c.h" + #line 1792 "Python/generated_cases.c.h" _tmp_1 = v; } STACK_GROW(1); @@ -1800,7 +1801,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1218 "Python/bytecodes.c" + #line 1219 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1857,7 +1858,7 @@ } } } - #line 1861 "Python/generated_cases.c.h" + #line 1862 "Python/generated_cases.c.h" _tmp_1 = v; } stack_pointer[-1] = _tmp_1; @@ -1869,7 +1870,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1287 "Python/bytecodes.c" + #line 1288 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1921,7 +1922,7 @@ } } null = NULL; - #line 1925 "Python/generated_cases.c.h" + #line 1926 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1935,7 +1936,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1341 "Python/bytecodes.c" + #line 1342 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1946,7 +1947,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1950 "Python/generated_cases.c.h" + #line 1951 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1961,7 +1962,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 1354 "Python/bytecodes.c" + #line 1355 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1976,7 +1977,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; - #line 1980 "Python/generated_cases.c.h" + #line 1981 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1986,16 +1987,16 @@ } TARGET(DELETE_FAST) { - #line 1371 "Python/bytecodes.c" + #line 1372 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); - #line 1994 "Python/generated_cases.c.h" + #line 1995 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { - #line 1377 "Python/bytecodes.c" + #line 1378 "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); @@ -2004,12 +2005,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); - #line 2008 "Python/generated_cases.c.h" + #line 2009 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { - #line 1388 "Python/bytecodes.c" + #line 1389 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2020,14 +2021,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); - #line 2024 "Python/generated_cases.c.h" + #line 2025 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1401 "Python/bytecodes.c" + #line 1402 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -2062,14 +2063,14 @@ } Py_INCREF(value); } - #line 2066 "Python/generated_cases.c.h" + #line 2067 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; - #line 1438 "Python/bytecodes.c" + #line 1439 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2077,7 +2078,7 @@ if (true) goto error; } Py_INCREF(value); - #line 2081 "Python/generated_cases.c.h" + #line 2082 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -2085,18 +2086,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1448 "Python/bytecodes.c" + #line 1449 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); - #line 2094 "Python/generated_cases.c.h" + #line 2095 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { - #line 1455 "Python/bytecodes.c" + #line 1456 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -2107,22 +2108,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } - #line 2111 "Python/generated_cases.c.h" + #line 2112 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1468 "Python/bytecodes.c" + #line 1469 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); - #line 2120 "Python/generated_cases.c.h" + #line 2121 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1470 "Python/bytecodes.c" + #line 1471 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2126 "Python/generated_cases.c.h" + #line 2127 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -2132,10 +2133,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1474 "Python/bytecodes.c" + #line 1475 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2139 "Python/generated_cases.c.h" + #line 2140 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -2145,10 +2146,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1479 "Python/bytecodes.c" + #line 1480 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } - #line 2152 "Python/generated_cases.c.h" + #line 2153 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -2158,7 +2159,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1484 "Python/bytecodes.c" + #line 1485 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2169,13 +2170,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } - #line 2173 "Python/generated_cases.c.h" + #line 2174 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1495 "Python/bytecodes.c" + #line 1496 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); - #line 2179 "Python/generated_cases.c.h" + #line 2180 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -2184,13 +2185,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1502 "Python/bytecodes.c" + #line 1503 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); - #line 2190 "Python/generated_cases.c.h" + #line 2191 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1504 "Python/bytecodes.c" + #line 1505 "Python/bytecodes.c" if (err < 0) goto pop_1_error; - #line 2194 "Python/generated_cases.c.h" + #line 2195 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -2198,7 +2199,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1508 "Python/bytecodes.c" + #line 1509 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2213,7 +2214,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } - #line 2217 "Python/generated_cases.c.h" + #line 2218 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -2223,7 +2224,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1525 "Python/bytecodes.c" + #line 1526 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2231,13 +2232,13 @@ if (map == NULL) goto error; - #line 2235 "Python/generated_cases.c.h" + #line 2236 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1533 "Python/bytecodes.c" + #line 1534 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } - #line 2241 "Python/generated_cases.c.h" + #line 2242 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -2245,7 +2246,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1537 "Python/bytecodes.c" + #line 1538 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2285,7 +2286,7 @@ Py_DECREF(ann_dict); } } - #line 2289 "Python/generated_cases.c.h" + #line 2290 "Python/generated_cases.c.h" DISPATCH(); } @@ -2293,7 +2294,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1579 "Python/bytecodes.c" + #line 1580 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2303,14 +2304,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); - #line 2307 "Python/generated_cases.c.h" + #line 2308 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1589 "Python/bytecodes.c" + #line 1590 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } - #line 2314 "Python/generated_cases.c.h" + #line 2315 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -2318,7 +2319,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1593 "Python/bytecodes.c" + #line 1594 "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)) { @@ -2326,12 +2327,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } - #line 2330 "Python/generated_cases.c.h" + #line 2331 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1601 "Python/bytecodes.c" + #line 1602 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2335 "Python/generated_cases.c.h" + #line 2336 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2339,17 +2340,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1607 "Python/bytecodes.c" + #line 1608 "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 2348 "Python/generated_cases.c.h" + #line 2349 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1612 "Python/bytecodes.c" + #line 1613 "Python/bytecodes.c" if (true) goto pop_1_error; } - #line 2353 "Python/generated_cases.c.h" + #line 2354 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2359,26 +2360,26 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1619 "Python/bytecodes.c" + #line 1620 "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 2369 "Python/generated_cases.c.h" + #line 2370 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1628 "Python/bytecodes.c" + #line 1629 "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 2382 "Python/generated_cases.c.h" + #line 2383 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2389,7 +2390,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1642 "Python/bytecodes.c" + #line 1643 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2431,16 +2432,16 @@ } } } - #line 2435 "Python/generated_cases.c.h" + #line 2436 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1684 "Python/bytecodes.c" + #line 1685 "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 2444 "Python/generated_cases.c.h" + #line 2445 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2455,20 +2456,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1691 "Python/bytecodes.c" + #line 1692 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); STAT_INC(LOAD_SUPER_ATTR, hit); PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); - #line 2466 "Python/generated_cases.c.h" + #line 2467 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1698 "Python/bytecodes.c" + #line 1699 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; - #line 2472 "Python/generated_cases.c.h" + #line 2473 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2483,7 +2484,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1702 "Python/bytecodes.c" + #line 1703 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2506,7 +2507,7 @@ res = res2; res2 = NULL; } - #line 2510 "Python/generated_cases.c.h" + #line 2511 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2520,7 +2521,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1741 "Python/bytecodes.c" + #line 1742 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2554,9 +2555,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2558 "Python/generated_cases.c.h" + #line 2559 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1775 "Python/bytecodes.c" + #line 1776 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2565,12 +2566,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2569 "Python/generated_cases.c.h" + #line 2570 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1784 "Python/bytecodes.c" + #line 1785 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2574 "Python/generated_cases.c.h" + #line 2575 "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; } @@ -2584,7 +2585,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1789 "Python/bytecodes.c" + #line 1790 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2597,7 +2598,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2601 "Python/generated_cases.c.h" + #line 2602 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2612,7 +2613,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1805 "Python/bytecodes.c" + #line 1806 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2625,7 +2626,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2629 "Python/generated_cases.c.h" + #line 2630 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2640,7 +2641,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1821 "Python/bytecodes.c" + #line 1822 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2667,7 +2668,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2671 "Python/generated_cases.c.h" + #line 2672 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2682,7 +2683,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1851 "Python/bytecodes.c" + #line 1852 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2692,7 +2693,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2696 "Python/generated_cases.c.h" + #line 2697 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2707,7 +2708,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1864 "Python/bytecodes.c" + #line 1865 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2719,7 +2720,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2723 "Python/generated_cases.c.h" + #line 2724 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2733,7 +2734,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 1879 "Python/bytecodes.c" + #line 1880 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2757,7 +2758,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2761 "Python/generated_cases.c.h" + #line 2762 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2765,7 +2766,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 1905 "Python/bytecodes.c" + #line 1906 "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); @@ -2791,7 +2792,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2795 "Python/generated_cases.c.h" + #line 2796 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2799,7 +2800,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 1933 "Python/bytecodes.c" + #line 1934 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2817,7 +2818,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2821 "Python/generated_cases.c.h" + #line 2822 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2828,7 +2829,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 1953 "Python/bytecodes.c" + #line 1954 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2867,7 +2868,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2871 "Python/generated_cases.c.h" + #line 2872 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2878,7 +2879,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 1994 "Python/bytecodes.c" + #line 1995 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2888,7 +2889,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2892 "Python/generated_cases.c.h" + #line 2893 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2900,7 +2901,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2013 "Python/bytecodes.c" + #line 2014 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2913,12 +2914,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2917 "Python/generated_cases.c.h" + #line 2918 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2026 "Python/bytecodes.c" + #line 2027 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2922 "Python/generated_cases.c.h" + #line 2923 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2929,7 +2930,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2030 "Python/bytecodes.c" + #line 2031 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2940,7 +2941,7 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2944 "Python/generated_cases.c.h" + #line 2945 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2951,7 +2952,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2044 "Python/bytecodes.c" + #line 2045 "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); @@ -2966,7 +2967,7 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; - #line 2970 "Python/generated_cases.c.h" + #line 2971 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2977,7 +2978,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2062 "Python/bytecodes.c" + #line 2063 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2989,7 +2990,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 2993 "Python/generated_cases.c.h" + #line 2994 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -3000,14 +3001,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2076 "Python/bytecodes.c" + #line 2077 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 3006 "Python/generated_cases.c.h" + #line 3007 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2078 "Python/bytecodes.c" + #line 2079 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3011 "Python/generated_cases.c.h" + #line 3012 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3017,15 +3018,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2082 "Python/bytecodes.c" + #line 2083 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 3023 "Python/generated_cases.c.h" + #line 3024 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2084 "Python/bytecodes.c" + #line 2085 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; - #line 3029 "Python/generated_cases.c.h" + #line 3030 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -3036,12 +3037,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2089 "Python/bytecodes.c" + #line 2090 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 3042 "Python/generated_cases.c.h" + #line 3043 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2091 "Python/bytecodes.c" + #line 2092 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3049,10 +3050,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 3053 "Python/generated_cases.c.h" + #line 3054 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2099 "Python/bytecodes.c" + #line 2100 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3061,7 +3062,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 3065 "Python/generated_cases.c.h" + #line 3066 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -3071,21 +3072,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2110 "Python/bytecodes.c" + #line 2111 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 3078 "Python/generated_cases.c.h" + #line 3079 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2113 "Python/bytecodes.c" + #line 2114 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 3085 "Python/generated_cases.c.h" + #line 3086 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2118 "Python/bytecodes.c" + #line 2119 "Python/bytecodes.c" b = res ? Py_True : Py_False; - #line 3089 "Python/generated_cases.c.h" + #line 3090 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -3094,15 +3095,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2122 "Python/bytecodes.c" + #line 2123 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 3101 "Python/generated_cases.c.h" + #line 3102 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2125 "Python/bytecodes.c" + #line 2126 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 3106 "Python/generated_cases.c.h" + #line 3107 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -3111,26 +3112,26 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2129 "Python/bytecodes.c" + #line 2130 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 3119 "Python/generated_cases.c.h" + #line 3120 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2135 "Python/bytecodes.c" + #line 2136 "Python/bytecodes.c" JUMPBY(oparg); - #line 3128 "Python/generated_cases.c.h" + #line 3129 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2139 "Python/bytecodes.c" + #line 2140 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3147,13 +3148,13 @@ goto resume_frame; } #endif /* ENABLE_SPECIALIZATION */ - #line 3151 "Python/generated_cases.c.h" + #line 3152 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(ENTER_EXECUTOR) { - #line 2159 "Python/bytecodes.c" + #line 2160 "Python/bytecodes.c" _PyExecutorObject *executor = (_PyExecutorObject *)frame->f_code->co_executors->executors[oparg]; Py_INCREF(executor); frame = executor->execute(executor, frame, stack_pointer); @@ -3162,21 +3163,21 @@ goto error; } goto resume_frame; - #line 3166 "Python/generated_cases.c.h" + #line 3167 "Python/generated_cases.c.h" } TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2170 "Python/bytecodes.c" + #line 2171 "Python/bytecodes.c" if (Py_IsFalse(cond)) { JUMPBY(oparg); } else if (!Py_IsTrue(cond)) { int err = PyObject_IsTrue(cond); - #line 3178 "Python/generated_cases.c.h" + #line 3179 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2176 "Python/bytecodes.c" + #line 2177 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -3184,22 +3185,22 @@ if (err < 0) goto pop_1_error; } } - #line 3188 "Python/generated_cases.c.h" + #line 3189 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2186 "Python/bytecodes.c" + #line 2187 "Python/bytecodes.c" if (Py_IsTrue(cond)) { JUMPBY(oparg); } else if (!Py_IsFalse(cond)) { int err = PyObject_IsTrue(cond); - #line 3201 "Python/generated_cases.c.h" + #line 3202 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2192 "Python/bytecodes.c" + #line 2193 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -3207,63 +3208,63 @@ if (err < 0) goto pop_1_error; } } - #line 3211 "Python/generated_cases.c.h" + #line 3212 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2202 "Python/bytecodes.c" + #line 2203 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 3220 "Python/generated_cases.c.h" + #line 3221 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2204 "Python/bytecodes.c" + #line 2205 "Python/bytecodes.c" JUMPBY(oparg); } - #line 3225 "Python/generated_cases.c.h" + #line 3226 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2209 "Python/bytecodes.c" + #line 2210 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { - #line 3237 "Python/generated_cases.c.h" + #line 3238 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2214 "Python/bytecodes.c" + #line 2215 "Python/bytecodes.c" } - #line 3241 "Python/generated_cases.c.h" + #line 3242 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2218 "Python/bytecodes.c" + #line 2219 "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 3254 "Python/generated_cases.c.h" + #line 3255 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2227 "Python/bytecodes.c" + #line 2228 "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 3267 "Python/generated_cases.c.h" + #line 3268 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -3274,16 +3275,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2235 "Python/bytecodes.c" + #line 2236 "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 3283 "Python/generated_cases.c.h" + #line 3284 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2240 "Python/bytecodes.c" + #line 2241 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3291,7 +3292,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } - #line 3295 "Python/generated_cases.c.h" + #line 3296 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -3300,10 +3301,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2250 "Python/bytecodes.c" + #line 2251 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; - #line 3307 "Python/generated_cases.c.h" + #line 3308 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3313,10 +3314,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2256 "Python/bytecodes.c" + #line 2257 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; - #line 3320 "Python/generated_cases.c.h" + #line 3321 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3327,11 +3328,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2262 "Python/bytecodes.c" + #line 2263 "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 3335 "Python/generated_cases.c.h" + #line 3336 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3340,14 +3341,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2268 "Python/bytecodes.c" + #line 2269 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3347 "Python/generated_cases.c.h" + #line 3348 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2271 "Python/bytecodes.c" + #line 2272 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3351 "Python/generated_cases.c.h" + #line 3352 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3355,7 +3356,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2275 "Python/bytecodes.c" + #line 2276 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3378,11 +3379,11 @@ if (iter == NULL) { goto error; } - #line 3382 "Python/generated_cases.c.h" + #line 3383 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2298 "Python/bytecodes.c" + #line 2299 "Python/bytecodes.c" } - #line 3386 "Python/generated_cases.c.h" + #line 3387 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3393,7 +3394,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2317 "Python/bytecodes.c" + #line 2318 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3424,7 +3425,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3428 "Python/generated_cases.c.h" + #line 3429 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3432,7 +3433,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2350 "Python/bytecodes.c" + #line 2351 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3458,14 +3459,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3462 "Python/generated_cases.c.h" + #line 3463 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2378 "Python/bytecodes.c" + #line 2379 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3485,7 +3486,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3489 "Python/generated_cases.c.h" + #line 3490 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3495,7 +3496,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2400 "Python/bytecodes.c" + #line 2401 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3515,7 +3516,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3519 "Python/generated_cases.c.h" + #line 3520 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3525,7 +3526,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2422 "Python/bytecodes.c" + #line 2423 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3543,7 +3544,7 @@ if (next == NULL) { goto error; } - #line 3547 "Python/generated_cases.c.h" + #line 3548 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3552,7 +3553,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2442 "Python/bytecodes.c" + #line 2443 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3568,14 +3569,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3572 "Python/generated_cases.c.h" + #line 3573 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2460 "Python/bytecodes.c" + #line 2461 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3598,16 +3599,16 @@ Py_DECREF(enter); goto error; } - #line 3602 "Python/generated_cases.c.h" + #line 3603 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2483 "Python/bytecodes.c" + #line 2484 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3611 "Python/generated_cases.c.h" + #line 3612 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3619,7 +3620,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2493 "Python/bytecodes.c" + #line 2494 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3645,16 +3646,16 @@ Py_DECREF(enter); goto error; } - #line 3649 "Python/generated_cases.c.h" + #line 3650 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2519 "Python/bytecodes.c" + #line 2520 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3658 "Python/generated_cases.c.h" + #line 3659 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3666,7 +3667,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2528 "Python/bytecodes.c" + #line 2529 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3687,7 +3688,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3691 "Python/generated_cases.c.h" + #line 3692 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3696,7 +3697,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2551 "Python/bytecodes.c" + #line 2552 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3706,7 +3707,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3710 "Python/generated_cases.c.h" + #line 3711 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3720,7 +3721,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 2563 "Python/bytecodes.c" + #line 2564 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3737,7 +3738,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3741 "Python/generated_cases.c.h" + #line 3742 "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; } @@ -3751,7 +3752,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2582 "Python/bytecodes.c" + #line 2583 "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); @@ -3761,7 +3762,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3765 "Python/generated_cases.c.h" + #line 3766 "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; } @@ -3775,7 +3776,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2594 "Python/bytecodes.c" + #line 2595 "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; @@ -3789,7 +3790,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3793 "Python/generated_cases.c.h" + #line 3794 "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; } @@ -3798,16 +3799,16 @@ } TARGET(KW_NAMES) { - #line 2610 "Python/bytecodes.c" + #line 2611 "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 3806 "Python/generated_cases.c.h" + #line 3807 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2616 "Python/bytecodes.c" + #line 2617 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3820,7 +3821,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3824 "Python/generated_cases.c.h" + #line 3825 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3830,7 +3831,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2661 "Python/bytecodes.c" + #line 2662 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3912,7 +3913,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3916 "Python/generated_cases.c.h" + #line 3917 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3924,7 +3925,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2749 "Python/bytecodes.c" + #line 2750 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3934,7 +3935,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3938 "Python/generated_cases.c.h" + #line 3939 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3943,7 +3944,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2761 "Python/bytecodes.c" + #line 2762 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3969,7 +3970,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3973 "Python/generated_cases.c.h" + #line 3974 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3977,7 +3978,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2789 "Python/bytecodes.c" + #line 2790 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4013,7 +4014,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 4017 "Python/generated_cases.c.h" + #line 4018 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -4021,7 +4022,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2827 "Python/bytecodes.c" + #line 2828 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4031,7 +4032,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 4035 "Python/generated_cases.c.h" + #line 4036 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4044,7 +4045,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2839 "Python/bytecodes.c" + #line 2840 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4055,7 +4056,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4059 "Python/generated_cases.c.h" + #line 4060 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4069,7 +4070,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2853 "Python/bytecodes.c" + #line 2854 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4080,7 +4081,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4084 "Python/generated_cases.c.h" + #line 4085 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4094,7 +4095,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2867 "Python/bytecodes.c" + #line 2868 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4116,7 +4117,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4120 "Python/generated_cases.c.h" + #line 4121 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4130,7 +4131,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2892 "Python/bytecodes.c" + #line 2893 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4158,7 +4159,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4162 "Python/generated_cases.c.h" + #line 4163 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4172,7 +4173,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2923 "Python/bytecodes.c" + #line 2924 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4204,7 +4205,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 4208 "Python/generated_cases.c.h" + #line 4209 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4218,7 +4219,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2958 "Python/bytecodes.c" + #line 2959 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4250,7 +4251,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4254 "Python/generated_cases.c.h" + #line 4255 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4264,7 +4265,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2993 "Python/bytecodes.c" + #line 2994 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4289,7 +4290,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4293 "Python/generated_cases.c.h" + #line 4294 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4302,7 +4303,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3020 "Python/bytecodes.c" + #line 3021 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4329,7 +4330,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4333 "Python/generated_cases.c.h" + #line 4334 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4341,7 +4342,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3050 "Python/bytecodes.c" + #line 3051 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4359,14 +4360,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4363 "Python/generated_cases.c.h" + #line 4364 "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 3070 "Python/bytecodes.c" + #line 3071 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4397,7 +4398,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4401 "Python/generated_cases.c.h" + #line 4402 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4410,7 +4411,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3104 "Python/bytecodes.c" + #line 3105 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4439,7 +4440,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4443 "Python/generated_cases.c.h" + #line 4444 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4452,7 +4453,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3136 "Python/bytecodes.c" + #line 3137 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4481,7 +4482,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4485 "Python/generated_cases.c.h" + #line 4486 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4494,7 +4495,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3168 "Python/bytecodes.c" + #line 3169 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4522,7 +4523,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4526 "Python/generated_cases.c.h" + #line 4527 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4532,9 +4533,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3199 "Python/bytecodes.c" + #line 3200 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4538 "Python/generated_cases.c.h" + #line 4539 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4543,7 +4544,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3203 "Python/bytecodes.c" + #line 3204 "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)); @@ -4605,14 +4606,14 @@ } result = PyObject_Call(func, callargs, kwargs); } - #line 4609 "Python/generated_cases.c.h" + #line 4610 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3265 "Python/bytecodes.c" + #line 3266 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4616 "Python/generated_cases.c.h" + #line 4617 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4627,7 +4628,7 @@ PyObject *kwdefaults = (oparg & MAKE_FUNCTION_KWDEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & MAKE_FUNCTION_DEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0))] : NULL; PyObject *func; - #line 3275 "Python/bytecodes.c" + #line 3276 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4656,14 +4657,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4660 "Python/generated_cases.c.h" + #line 4661 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3306 "Python/bytecodes.c" + #line 3307 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4684,7 +4685,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4688 "Python/generated_cases.c.h" + #line 4689 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4692,15 +4693,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3329 "Python/bytecodes.c" + #line 3330 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4698 "Python/generated_cases.c.h" + #line 4699 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3331 "Python/bytecodes.c" + #line 3332 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4704 "Python/generated_cases.c.h" + #line 4705 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4711,7 +4712,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 3335 "Python/bytecodes.c" + #line 3336 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4746,7 +4747,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 4750 "Python/generated_cases.c.h" + #line 4751 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4755,10 +4756,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3372 "Python/bytecodes.c" + #line 3373 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4762 "Python/generated_cases.c.h" + #line 4763 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4770,7 +4771,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3377 "Python/bytecodes.c" + #line 3378 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4785,12 +4786,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4789 "Python/generated_cases.c.h" + #line 4790 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3392 "Python/bytecodes.c" + #line 3393 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4794 "Python/generated_cases.c.h" + #line 4795 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4800,16 +4801,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3397 "Python/bytecodes.c" + #line 3398 "Python/bytecodes.c" assert(oparg >= 2); - #line 4806 "Python/generated_cases.c.h" + #line 4807 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3401 "Python/bytecodes.c" + #line 3402 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4821,26 +4822,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4825 "Python/generated_cases.c.h" + #line 4826 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3415 "Python/bytecodes.c" + #line 3416 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4831 "Python/generated_cases.c.h" + #line 4832 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3419 "Python/bytecodes.c" + #line 3420 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4838 "Python/generated_cases.c.h" + #line 4839 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3424 "Python/bytecodes.c" + #line 3425 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4849,12 +4850,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4853 "Python/generated_cases.c.h" + #line 4854 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3435 "Python/bytecodes.c" + #line 3436 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4863,12 +4864,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4867 "Python/generated_cases.c.h" + #line 4868 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3446 "Python/bytecodes.c" + #line 3447 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4880,12 +4881,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4884 "Python/generated_cases.c.h" + #line 4885 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3460 "Python/bytecodes.c" + #line 3461 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4897,30 +4898,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4901 "Python/generated_cases.c.h" + #line 4902 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3474 "Python/bytecodes.c" + #line 3475 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4912 "Python/generated_cases.c.h" + #line 4913 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3482 "Python/bytecodes.c" + #line 3483 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4919 "Python/generated_cases.c.h" + #line 4920 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3487 "Python/bytecodes.c" + #line 3488 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4926 "Python/generated_cases.c.h" + #line 4927 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 4117dd52dcfaf9..3ded61edf1da10 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -803,9 +803,9 @@ enum InstructionFormat { INSTR_FMT_IB, INSTR_FMT_IBC, INSTR_FMT_IBC00, INSTR_FMT #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) +#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; @@ -817,19 +817,19 @@ extern const struct opcode_metadata _PyOpcode_opcode_metadata[256]; #else const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [NOP] = { true, INSTR_FMT_IX, 0 }, - [RESUME] = { true, INSTR_FMT_IB, 1 }, - [INSTRUMENTED_RESUME] = { true, INSTR_FMT_IB, 1 }, - [LOAD_CLOSURE] = { true, INSTR_FMT_IB, 1 }, - [LOAD_FAST_CHECK] = { true, INSTR_FMT_IB, 1 }, - [LOAD_FAST] = { true, INSTR_FMT_IB, 1 }, - [LOAD_FAST_AND_CLEAR] = { true, INSTR_FMT_IB, 1 }, - [LOAD_FAST_LOAD_FAST] = { true, INSTR_FMT_IB, 1 }, - [LOAD_CONST] = { true, INSTR_FMT_IB, 3 }, - [STORE_FAST] = { true, INSTR_FMT_IB, 1 }, - [STORE_FAST_LOAD_FAST] = { true, INSTR_FMT_IB, 1 }, - [STORE_FAST_STORE_FAST] = { true, INSTR_FMT_IB, 1 }, - [LOAD_FAST__LOAD_CONST] = { true, INSTR_FMT_IBIB, 3 }, - [LOAD_CONST__LOAD_FAST] = { true, INSTR_FMT_IBIB, 3 }, + [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_LOAD_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [STORE_FAST_STORE_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [LOAD_FAST__LOAD_CONST] = { true, INSTR_FMT_IBIB, HAS_ARG_FLAG|HAS_CONST_FLAG }, + [LOAD_CONST__LOAD_FAST] = { true, INSTR_FMT_IBIB, HAS_ARG_FLAG|HAS_CONST_FLAG }, [POP_TOP] = { true, INSTR_FMT_IX, 0 }, [PUSH_NULL] = { true, INSTR_FMT_IX, 0 }, [END_FOR] = { true, INSTR_FMT_IB, 0 }, @@ -854,159 +854,159 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [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, 1 }, - [SET_ADD] = { true, INSTR_FMT_IB, 1 }, + [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, 1 }, - [CALL_INTRINSIC_2] = { true, INSTR_FMT_IB, 1 }, - [RAISE_VARARGS] = { true, INSTR_FMT_IB, 1 }, + [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, 3 }, - [INSTRUMENTED_RETURN_CONST] = { true, INSTR_FMT_IB, 3 }, + [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, 1 }, - [SEND] = { true, INSTR_FMT_IBC, 1 }, - [SEND_GEN] = { true, INSTR_FMT_IBC, 1 }, - [INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IX, 0 }, - [YIELD_VALUE] = { true, INSTR_FMT_IB, 1 }, + [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, 1 }, + [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, 5 }, - [DELETE_NAME] = { true, INSTR_FMT_IB, 5 }, - [UNPACK_SEQUENCE] = { true, INSTR_FMT_IBC, 1 }, - [UNPACK_SEQUENCE_TWO_TUPLE] = { true, INSTR_FMT_IBC, 1 }, - [UNPACK_SEQUENCE_TUPLE] = { true, INSTR_FMT_IBC, 1 }, - [UNPACK_SEQUENCE_LIST] = { true, INSTR_FMT_IBC, 1 }, - [UNPACK_EX] = { true, INSTR_FMT_IB, 1 }, - [STORE_ATTR] = { true, INSTR_FMT_IBC000, 5 }, - [DELETE_ATTR] = { true, INSTR_FMT_IB, 5 }, - [STORE_GLOBAL] = { true, INSTR_FMT_IB, 5 }, - [DELETE_GLOBAL] = { true, INSTR_FMT_IB, 5 }, + [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, 5 }, - [LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB, 5 }, - [LOAD_GLOBAL] = { true, INSTR_FMT_IBC000, 5 }, - [LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC000, 1 }, - [LOAD_GLOBAL_BUILTIN] = { true, INSTR_FMT_IBC000, 1 }, - [DELETE_FAST] = { true, INSTR_FMT_IB, 1 }, - [MAKE_CELL] = { true, INSTR_FMT_IB, 1 }, - [DELETE_DEREF] = { true, INSTR_FMT_IB, 1 }, - [LOAD_FROM_DICT_OR_DEREF] = { true, INSTR_FMT_IB, 1 }, - [LOAD_DEREF] = { true, INSTR_FMT_IB, 1 }, - [STORE_DEREF] = { true, INSTR_FMT_IB, 1 }, - [COPY_FREE_VARS] = { true, INSTR_FMT_IB, 1 }, - [BUILD_STRING] = { true, INSTR_FMT_IB, 1 }, - [BUILD_TUPLE] = { true, INSTR_FMT_IB, 1 }, - [BUILD_LIST] = { true, INSTR_FMT_IB, 1 }, - [LIST_EXTEND] = { true, INSTR_FMT_IB, 1 }, - [SET_UPDATE] = { true, INSTR_FMT_IB, 1 }, - [BUILD_SET] = { true, INSTR_FMT_IB, 1 }, - [BUILD_MAP] = { true, INSTR_FMT_IB, 1 }, + [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, 1 }, - [DICT_UPDATE] = { true, INSTR_FMT_IB, 1 }, - [DICT_MERGE] = { true, INSTR_FMT_IB, 1 }, - [MAP_ADD] = { true, INSTR_FMT_IB, 1 }, - [INSTRUMENTED_LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC, 5 }, - [LOAD_SUPER_ATTR_ATTR] = { true, INSTR_FMT_IBC, 5 }, - [LOAD_SUPER_ATTR_METHOD] = { true, INSTR_FMT_IBC, 5 }, - [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000, 5 }, - [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC00000000, 5 }, - [LOAD_ATTR_SLOT] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_ATTR_CLASS] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_ATTR_PROPERTY] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = { true, INSTR_FMT_IBC00000000, 5 }, + [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_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_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, 5 }, + [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, 1 }, - [COMPARE_OP_FLOAT] = { true, INSTR_FMT_IBC, 1 }, - [COMPARE_OP_INT] = { true, INSTR_FMT_IBC, 1 }, - [COMPARE_OP_STR] = { true, INSTR_FMT_IBC, 1 }, - [IS_OP] = { true, INSTR_FMT_IB, 1 }, - [CONTAINS_OP] = { true, INSTR_FMT_IB, 1 }, + [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, 5 }, - [IMPORT_FROM] = { true, INSTR_FMT_IB, 5 }, - [JUMP_FORWARD] = { true, INSTR_FMT_IB, 1 }, - [JUMP_BACKWARD] = { true, INSTR_FMT_IB, 1 }, - [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, 1 }, - [POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, 1 }, - [POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, 1 }, - [POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, 1 }, - [POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, 1 }, - [JUMP_BACKWARD_NO_INTERRUPT] = { true, INSTR_FMT_IB, 1 }, + [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 }, + [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, 1 }, + [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, 1 }, - [INSTRUMENTED_FOR_ITER] = { true, INSTR_FMT_IB, 1 }, - [FOR_ITER_LIST] = { true, INSTR_FMT_IBC, 1 }, - [FOR_ITER_TUPLE] = { true, INSTR_FMT_IBC, 1 }, - [FOR_ITER_RANGE] = { true, INSTR_FMT_IBC, 1 }, - [FOR_ITER_GEN] = { true, INSTR_FMT_IBC, 1 }, + [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 }, [PUSH_EXC_INFO] = { true, INSTR_FMT_IX, 0 }, - [LOAD_ATTR_METHOD_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_ATTR_METHOD_NO_DICT] = { true, INSTR_FMT_IBC00000000, 1 }, - [LOAD_ATTR_METHOD_LAZY_DICT] = { true, INSTR_FMT_IBC00000000, 1 }, - [KW_NAMES] = { true, INSTR_FMT_IB, 3 }, - [INSTRUMENTED_CALL] = { true, INSTR_FMT_IB, 1 }, - [CALL] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_PY_EXACT_ARGS] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_PY_WITH_DEFAULTS] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_TYPE_1] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_STR_1] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_TUPLE_1] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_BUILTIN_CLASS] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_BUILTIN_O] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_BUILTIN_FAST] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_BUILTIN_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_LEN] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_ISINSTANCE] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_LIST_APPEND] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_METHOD_DESCRIPTOR_O] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = { true, INSTR_FMT_IBC00, 1 }, - [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = { true, INSTR_FMT_IBC00, 1 }, + [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, 1 }, - [MAKE_FUNCTION] = { true, INSTR_FMT_IB, 1 }, + [CALL_FUNCTION_EX] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, + [MAKE_FUNCTION] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, [RETURN_GENERATOR] = { true, INSTR_FMT_IX, 0 }, - [BUILD_SLICE] = { true, INSTR_FMT_IB, 1 }, - [FORMAT_VALUE] = { true, INSTR_FMT_IB, 1 }, - [COPY] = { true, INSTR_FMT_IB, 1 }, - [BINARY_OP] = { true, INSTR_FMT_IBC, 1 }, - [SWAP] = { true, INSTR_FMT_IB, 1 }, + [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, 1 }, - [INSTRUMENTED_JUMP_BACKWARD] = { true, INSTR_FMT_IB, 1 }, - [INSTRUMENTED_POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, 1 }, - [INSTRUMENTED_POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, 1 }, - [INSTRUMENTED_POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, 1 }, - [INSTRUMENTED_POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, 1 }, - [EXTENDED_ARG] = { true, INSTR_FMT_IB, 1 }, + [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 }, }; diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 0af5b9dfed53e3..f03fdbadb1359b 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -275,7 +275,6 @@ def __init__(self, inst: parser.InstDef): else: break self.unmoved_names = frozenset(unmoved_names) - if inst.name == 'YIELD_VALUE': breakpoint() flag_data = { 'HAS_ARG' : variable_used(inst, "oparg"), 'HAS_CONST': variable_used(inst, "frame->f_code->co_consts", delim="->"), @@ -513,6 +512,7 @@ class OverriddenInstructionPlaceHolder: AnyInstruction = Instruction | SuperInstruction | MacroInstruction INSTR_FMT_PREFIX = "INSTR_FMT_" +INSTR_FLAG_SUFFIX = "_FLAG" class Analyzer: @@ -1031,10 +1031,13 @@ def write_metadata(self) -> None: # Write type definitions self.out.emit(f"enum InstructionFormat {{ {', '.join(format_enums)} }};") - for i, name in enumerate(INSTRUCTION_FLAGS): - self.out.emit(f"#define {name}_FLAG ({1 << i})"); - for name in INSTRUCTION_FLAGS: - self.out.emit(f"#define OPCODE_{name}(OP) (_PyOpcode_opcode_metadata[(OP)].flags & {name}_FLAG)"); + 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(): @@ -1069,23 +1072,25 @@ def write_metadata(self) -> None: self.out.emit("};") self.out.emit("#endif") - def write_metadata_for_inst(self, instr: Instruction) -> None: - """Write metadata for a single instruction.""" + 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.emit_metadata_entry(instr.name, instr.instr_fmt, instr.flags) + def write_metadata_for_super(self, sup: SuperInstruction) -> None: """Write metadata for a super-instruction.""" - self.out.emit( - f" [{sup.name}] = {{ true, {INSTR_FMT_PREFIX}{sup.instr_fmt}, {sup.flags} }}," - ) + self.emit_metadata_entry(sup.name, sup.instr_fmt, sup.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}, {mac.flags} }}," - ) + self.emit_metadata_entry(mac.name, mac.instr_fmt, mac.flags) def write_instructions(self) -> None: """Write instructions to output file.""" From fdce9f41afd9dc8be614980bcd057d558ede8252 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 8 Jun 2023 13:08:10 +0100 Subject: [PATCH 3/8] add macros CO_CONSTS, CO_NAMES --- Python/bytecodes.c | 50 +++++++++++----------- Python/ceval_macros.h | 5 +++ Python/generated_cases.c.h | 56 ++++++++++++------------- Tools/cases_generator/generate_cases.py | 35 +++------------- 4 files changed, 63 insertions(+), 83 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 26bc852466775e..bad9ea447a0e8c 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -211,7 +211,7 @@ dummy_func( } inst(LOAD_CONST, (-- value)) { - value = GETITEM(frame->f_code->co_consts, oparg); + value = GETITEM(CO_CONSTS, oparg); Py_INCREF(value); } @@ -713,7 +713,7 @@ dummy_func( } inst(RETURN_CONST, (--)) { - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -729,7 +729,7 @@ dummy_func( } inst(INSTRUMENTED_RETURN_CONST, (--)) { - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1048,7 +1048,7 @@ dummy_func( inst(STORE_NAME, (v -- )) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1066,7 +1066,7 @@ dummy_func( } inst(DELETE_NAME, (--)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1158,7 +1158,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(CO_NAMES, oparg); next_instr--; _Py_Specialize_StoreAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1169,28 +1169,28 @@ dummy_func( #else (void)counter; // Unused. #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(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(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(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(CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); // Can't use ERROR_IF here. @@ -1216,7 +1216,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(CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); if (v != NULL) { @@ -1288,7 +1288,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(CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadGlobal(GLOBALS(), BUILTINS(), next_instr, name); DISPATCH_SAME_OPARG(); @@ -1296,7 +1296,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(CO_NAMES, oparg>>1); if (PyDict_CheckExact(GLOBALS()) && PyDict_CheckExact(BUILTINS())) { @@ -1640,7 +1640,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(CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; @@ -1693,7 +1693,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(CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); DECREF_INPUTS(); ERROR_IF(res == NULL, error); @@ -1704,7 +1704,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(CO_NAMES, oparg >> 2); PyTypeObject *cls = (PyTypeObject *)class; int method_found = 0; res2 = _PySuper_Lookup(cls, self, name, @@ -1742,7 +1742,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(CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1750,7 +1750,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(CO_NAMES, oparg >> 1); if (oparg & 1) { /* Designed to work in tandem with CALL, pushes two values. */ PyObject* meth = NULL; @@ -1828,7 +1828,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(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)) { @@ -1916,7 +1916,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(CO_NAMES, oparg >> 1); Py_INCREF(f); _PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, f, 2); // Manipulate stack directly because we exit with DISPATCH_INLINED(). @@ -1960,7 +1960,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(CO_NAMES, oparg); DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, STORE_ATTR); PyObject *old_value; uint64_t new_version; @@ -2120,14 +2120,14 @@ dummy_func( } inst(IMPORT_NAME, (level, fromlist -- res)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(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(CO_NAMES, oparg); res = import_from(tstate, from, name); ERROR_IF(res == NULL, error); } @@ -2609,8 +2609,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(CO_CONSTS)); + kwnames = GETITEM(CO_CONSTS, oparg); } inst(INSTRUMENTED_CALL, ( -- )) { diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 86a48f68eaf4e0..c7da885a6e104b 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -234,6 +234,11 @@ GETITEM(PyObject *v, Py_ssize_t i) { #define STACK_SHRINK(n) BASIC_STACKADJ(-(n)) #endif + +/* Data access macros */ +#define CO_CONSTS (frame->f_code->co_consts) +#define CO_NAMES (frame->f_code->co_names) + /* Local variable macros */ #define GETLOCAL(i) (frame->localsplus[i]) diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 879f053a027aee..e7470d18a0fbe0 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -125,7 +125,7 @@ PREDICTED(LOAD_CONST); PyObject *value; #line 214 "Python/bytecodes.c" - value = GETITEM(frame->f_code->co_consts, oparg); + value = GETITEM(CO_CONSTS, oparg); Py_INCREF(value); #line 131 "Python/generated_cases.c.h" STACK_GROW(1); @@ -185,7 +185,7 @@ { PyObject *value; #line 214 "Python/bytecodes.c" - value = GETITEM(frame->f_code->co_consts, oparg); + value = GETITEM(CO_CONSTS, oparg); Py_INCREF(value); #line 191 "Python/generated_cases.c.h" _tmp_1 = value; @@ -202,7 +202,7 @@ { PyObject *value; #line 214 "Python/bytecodes.c" - value = GETITEM(frame->f_code->co_consts, oparg); + value = GETITEM(CO_CONSTS, oparg); Py_INCREF(value); #line 208 "Python/generated_cases.c.h" _tmp_2 = value; @@ -1045,7 +1045,7 @@ TARGET(RETURN_CONST) { #line 716 "Python/bytecodes.c" - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1063,7 +1063,7 @@ TARGET(INSTRUMENTED_RETURN_CONST) { #line 732 "Python/bytecodes.c" - PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); + PyObject *retval = GETITEM(CO_CONSTS, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1470,7 +1470,7 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; #line 1051 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1496,7 +1496,7 @@ TARGET(DELETE_NAME) { #line 1069 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1624,7 +1624,7 @@ #line 1159 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); next_instr--; _Py_Specialize_StoreAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1635,7 +1635,7 @@ #else (void)counter; // Unused. #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); #line 1641 "Python/generated_cases.c.h" Py_DECREF(v); @@ -1651,7 +1651,7 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; #line 1179 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); #line 1657 "Python/generated_cases.c.h" Py_DECREF(owner); @@ -1665,7 +1665,7 @@ TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; #line 1186 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); #line 1671 "Python/generated_cases.c.h" Py_DECREF(v); @@ -1678,7 +1678,7 @@ TARGET(DELETE_GLOBAL) { #line 1193 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); // Can't use ERROR_IF here. @@ -1732,7 +1732,7 @@ PyObject *mod_or_class_dict = _tmp_1; PyObject *v; #line 1219 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); if (v != NULL) { @@ -1802,7 +1802,7 @@ PyObject *mod_or_class_dict = _tmp_1; PyObject *v; #line 1219 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); if (v != NULL) { @@ -1874,7 +1874,7 @@ #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(CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadGlobal(GLOBALS(), BUILTINS(), next_instr, name); DISPATCH_SAME_OPARG(); @@ -1882,7 +1882,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(CO_NAMES, oparg>>1); if (PyDict_CheckExact(GLOBALS()) && PyDict_CheckExact(BUILTINS())) { @@ -2391,7 +2391,7 @@ PyObject *res2 = NULL; PyObject *res; #line 1643 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); + PyObject *name = GETITEM(CO_NAMES, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; @@ -2461,7 +2461,7 @@ 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(CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); #line 2467 "Python/generated_cases.c.h" Py_DECREF(global_super); @@ -2489,7 +2489,7 @@ 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(CO_NAMES, oparg >> 2); PyTypeObject *cls = (PyTypeObject *)class; int method_found = 0; res2 = _PySuper_Lookup(cls, self, name, @@ -2525,7 +2525,7 @@ #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(CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -2533,7 +2533,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(CO_NAMES, oparg >> 1); if (oparg & 1) { /* Designed to work in tandem with CALL, pushes two values. */ PyObject* meth = NULL; @@ -2651,7 +2651,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(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)) { @@ -2780,7 +2780,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(CO_NAMES, oparg >> 1); Py_INCREF(f); _PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, f, 2); // Manipulate stack directly because we exit with DISPATCH_INLINED(). @@ -2839,7 +2839,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(CO_NAMES, oparg); DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, STORE_ATTR); PyObject *old_value; uint64_t new_version; @@ -3096,7 +3096,7 @@ PyObject *level = stack_pointer[-2]; PyObject *res; #line 2123 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); #line 3102 "Python/generated_cases.c.h" Py_DECREF(level); @@ -3113,7 +3113,7 @@ PyObject *from = stack_pointer[-1]; PyObject *res; #line 2130 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg); + PyObject *name = GETITEM(CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; #line 3120 "Python/generated_cases.c.h" @@ -3801,8 +3801,8 @@ TARGET(KW_NAMES) { #line 2611 "Python/bytecodes.c" 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(CO_CONSTS)); + kwnames = GETITEM(CO_CONSTS, oparg); #line 3807 "Python/generated_cases.c.h" DISPATCH(); } diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index f03fdbadb1359b..987172bfe3384e 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -277,8 +277,8 @@ def __init__(self, inst: parser.InstDef): self.unmoved_names = frozenset(unmoved_names) flag_data = { 'HAS_ARG' : variable_used(inst, "oparg"), - 'HAS_CONST': variable_used(inst, "frame->f_code->co_consts", delim="->"), - 'HAS_NAME' : variable_used(inst, "frame->f_code->co_names", delim="->"), + 'HAS_CONST': variable_used(inst, "CO_CONSTS"), + 'HAS_NAME' : variable_used(inst, "CO_NAMES"), } assert set(flag_data.keys()) == set(INSTRUCTION_FLAGS) self.flags = 0 @@ -1288,35 +1288,10 @@ def always_exits(lines: list[str]) -> bool: def variable_used(node: parser.Node, name: str, delim: str = None) -> bool: """Determine whether a variable with a given name is used in a node. - If delim is not None, the name is assumed to be a chain of names - delimited by delim. For example: "frame->f_code->co_consts", delim="->". """ - if delim is None: - return any( - token.kind == "IDENTIFIER" and token.text == name for token in node.tokens - ) - - # delim is not None - look for the sequence of names - orig_names = name.split(delim) - orig_names.reverse() - names = orig_names - - need_delim = False - for token in node.tokens: - if need_delim: - if token.text == delim: - need_delim = False - else: - # no match, start over - names = orig_names - continue - if token.kind == "IDENTIFIER" and token.text == names[-1]: - names.pop() - if not names: - return True - need_delim = True - return False - + return any( + token.kind == "IDENTIFIER" and token.text == name for token in node.tokens + ) def main(): """Parse command line, parse input, analyze, write output.""" From 14fa4c637e7d9a1b6de5229ae6964c54a609d668 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 13 Jun 2023 13:50:25 +0100 Subject: [PATCH 4/8] code review comments --- Python/bytecodes.c | 50 +++++++++++----------- Python/ceval_macros.h | 4 +- Python/generated_cases.c.h | 56 ++++++++++++------------- Python/opcode_metadata.h | 48 ++++++++++----------- Tools/cases_generator/generate_cases.py | 10 ++--- 5 files changed, 84 insertions(+), 84 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index bad9ea447a0e8c..2130d26e1fa83d 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -211,7 +211,7 @@ dummy_func( } inst(LOAD_CONST, (-- value)) { - value = GETITEM(CO_CONSTS, oparg); + value = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(value); } @@ -713,7 +713,7 @@ dummy_func( } inst(RETURN_CONST, (--)) { - PyObject *retval = GETITEM(CO_CONSTS, oparg); + PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -729,7 +729,7 @@ dummy_func( } inst(INSTRUMENTED_RETURN_CONST, (--)) { - PyObject *retval = GETITEM(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); @@ -1048,7 +1048,7 @@ dummy_func( inst(STORE_NAME, (v -- )) { - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1066,7 +1066,7 @@ dummy_func( } inst(DELETE_NAME, (--)) { - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1158,7 +1158,7 @@ dummy_func( inst(STORE_ATTR, (counter/1, unused/3, v, owner --)) { #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); next_instr--; _Py_Specialize_StoreAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1169,28 +1169,28 @@ dummy_func( #else (void)counter; // Unused. #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(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(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(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(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); // Can't use ERROR_IF here. @@ -1216,7 +1216,7 @@ dummy_func( macro(LOAD_LOCALS) = _LOAD_LOCALS; op(_LOAD_FROM_DICT_OR_GLOBALS, (mod_or_class_dict -- v)) { - PyObject *name = GETITEM(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) { @@ -1288,7 +1288,7 @@ dummy_func( #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(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(); @@ -1296,7 +1296,7 @@ dummy_func( STAT_INC(LOAD_GLOBAL, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(CO_NAMES, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); if (PyDict_CheckExact(GLOBALS()) && PyDict_CheckExact(BUILTINS())) { @@ -1640,7 +1640,7 @@ dummy_func( }; inst(LOAD_SUPER_ATTR, (unused/1, global_super, class, self -- res2 if (oparg & 1), res)) { - PyObject *name = GETITEM(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; @@ -1693,7 +1693,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(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); @@ -1704,7 +1704,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(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, @@ -1742,7 +1742,7 @@ dummy_func( #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(CO_NAMES, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1750,7 +1750,7 @@ dummy_func( STAT_INC(LOAD_ATTR, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(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; @@ -1828,7 +1828,7 @@ dummy_func( PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, LOAD_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(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)) { @@ -1916,7 +1916,7 @@ dummy_func( DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), LOAD_ATTR); STAT_INC(LOAD_ATTR, hit); - PyObject *name = GETITEM(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(). @@ -1960,7 +1960,7 @@ dummy_func( PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, STORE_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(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; @@ -2120,14 +2120,14 @@ dummy_func( } inst(IMPORT_NAME, (level, fromlist -- res)) { - PyObject *name = GETITEM(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(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); ERROR_IF(res == NULL, error); } @@ -2609,8 +2609,8 @@ dummy_func( inst(KW_NAMES, (--)) { assert(kwnames == NULL); - assert(oparg < PyTuple_GET_SIZE(CO_CONSTS)); - kwnames = GETITEM(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 c7da885a6e104b..62e5481cbe5fab 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -236,8 +236,8 @@ GETITEM(PyObject *v, Py_ssize_t i) { /* Data access macros */ -#define CO_CONSTS (frame->f_code->co_consts) -#define CO_NAMES (frame->f_code->co_names) +#define FRAME_CO_CONSTS (frame->f_code->co_consts) +#define FRAME_CO_NAMES (frame->f_code->co_names) /* Local variable macros */ diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index e7470d18a0fbe0..3a230e6678672b 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -125,7 +125,7 @@ PREDICTED(LOAD_CONST); PyObject *value; #line 214 "Python/bytecodes.c" - value = GETITEM(CO_CONSTS, oparg); + value = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(value); #line 131 "Python/generated_cases.c.h" STACK_GROW(1); @@ -185,7 +185,7 @@ { PyObject *value; #line 214 "Python/bytecodes.c" - value = GETITEM(CO_CONSTS, oparg); + value = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(value); #line 191 "Python/generated_cases.c.h" _tmp_1 = value; @@ -202,7 +202,7 @@ { PyObject *value; #line 214 "Python/bytecodes.c" - value = GETITEM(CO_CONSTS, oparg); + value = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(value); #line 208 "Python/generated_cases.c.h" _tmp_2 = value; @@ -1045,7 +1045,7 @@ TARGET(RETURN_CONST) { #line 716 "Python/bytecodes.c" - PyObject *retval = GETITEM(CO_CONSTS, oparg); + PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg); Py_INCREF(retval); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1063,7 +1063,7 @@ TARGET(INSTRUMENTED_RETURN_CONST) { #line 732 "Python/bytecodes.c" - PyObject *retval = GETITEM(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); @@ -1470,7 +1470,7 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; #line 1051 "Python/bytecodes.c" - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1496,7 +1496,7 @@ TARGET(DELETE_NAME) { #line 1069 "Python/bytecodes.c" - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *ns = LOCALS(); int err; if (ns == NULL) { @@ -1624,7 +1624,7 @@ #line 1159 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); next_instr--; _Py_Specialize_StoreAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -1635,7 +1635,7 @@ #else (void)counter; // Unused. #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, v); #line 1641 "Python/generated_cases.c.h" Py_DECREF(v); @@ -1651,7 +1651,7 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; #line 1179 "Python/bytecodes.c" - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); #line 1657 "Python/generated_cases.c.h" Py_DECREF(owner); @@ -1665,7 +1665,7 @@ TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; #line 1186 "Python/bytecodes.c" - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); #line 1671 "Python/generated_cases.c.h" Py_DECREF(v); @@ -1678,7 +1678,7 @@ TARGET(DELETE_GLOBAL) { #line 1193 "Python/bytecodes.c" - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); // Can't use ERROR_IF here. @@ -1732,7 +1732,7 @@ PyObject *mod_or_class_dict = _tmp_1; PyObject *v; #line 1219 "Python/bytecodes.c" - PyObject *name = GETITEM(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) { @@ -1802,7 +1802,7 @@ PyObject *mod_or_class_dict = _tmp_1; PyObject *v; #line 1219 "Python/bytecodes.c" - PyObject *name = GETITEM(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) { @@ -1874,7 +1874,7 @@ #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(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(); @@ -1882,7 +1882,7 @@ STAT_INC(LOAD_GLOBAL, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(CO_NAMES, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); if (PyDict_CheckExact(GLOBALS()) && PyDict_CheckExact(BUILTINS())) { @@ -2391,7 +2391,7 @@ PyObject *res2 = NULL; PyObject *res; #line 1643 "Python/bytecodes.c" - PyObject *name = GETITEM(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; @@ -2461,7 +2461,7 @@ 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(CO_NAMES, oparg >> 2); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); res = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); #line 2467 "Python/generated_cases.c.h" Py_DECREF(global_super); @@ -2489,7 +2489,7 @@ 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(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, @@ -2525,7 +2525,7 @@ #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { - PyObject *name = GETITEM(CO_NAMES, oparg>>1); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); next_instr--; _Py_Specialize_LoadAttr(owner, next_instr, name); DISPATCH_SAME_OPARG(); @@ -2533,7 +2533,7 @@ STAT_INC(LOAD_ATTR, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ - PyObject *name = GETITEM(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; @@ -2651,7 +2651,7 @@ PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, LOAD_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(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)) { @@ -2780,7 +2780,7 @@ DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), LOAD_ATTR); STAT_INC(LOAD_ATTR, hit); - PyObject *name = GETITEM(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(). @@ -2839,7 +2839,7 @@ PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(dict == NULL, STORE_ATTR); assert(PyDict_CheckExact((PyObject *)dict)); - PyObject *name = GETITEM(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; @@ -3096,7 +3096,7 @@ PyObject *level = stack_pointer[-2]; PyObject *res; #line 2123 "Python/bytecodes.c" - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_name(tstate, frame, name, fromlist, level); #line 3102 "Python/generated_cases.c.h" Py_DECREF(level); @@ -3113,7 +3113,7 @@ PyObject *from = stack_pointer[-1]; PyObject *res; #line 2130 "Python/bytecodes.c" - PyObject *name = GETITEM(CO_NAMES, oparg); + PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; #line 3120 "Python/generated_cases.c.h" @@ -3801,8 +3801,8 @@ TARGET(KW_NAMES) { #line 2611 "Python/bytecodes.c" assert(kwnames == NULL); - assert(oparg < PyTuple_GET_SIZE(CO_CONSTS)); - kwnames = GETITEM(CO_CONSTS, oparg); + assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS)); + kwnames = GETITEM(FRAME_CO_CONSTS, oparg); #line 3807 "Python/generated_cases.c.h" DISPATCH(); } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 3ded61edf1da10..3b17f0c38598a4 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -824,12 +824,12 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [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 }, + [LOAD_CONST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG }, [STORE_FAST] = { 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 }, - [LOAD_FAST__LOAD_CONST] = { true, INSTR_FMT_IBIB, HAS_ARG_FLAG|HAS_CONST_FLAG }, - [LOAD_CONST__LOAD_FAST] = { true, INSTR_FMT_IBIB, HAS_ARG_FLAG|HAS_CONST_FLAG }, + [LOAD_FAST__LOAD_CONST] = { true, INSTR_FMT_IBIB, HAS_ARG_FLAG | HAS_CONST_FLAG }, + [LOAD_CONST__LOAD_FAST] = { true, INSTR_FMT_IBIB, HAS_ARG_FLAG | HAS_CONST_FLAG }, [POP_TOP] = { true, INSTR_FMT_IX, 0 }, [PUSH_NULL] = { true, INSTR_FMT_IX, 0 }, [END_FOR] = { true, INSTR_FMT_IB, 0 }, @@ -866,8 +866,8 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [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 }, + [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 }, @@ -881,21 +881,21 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [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 }, + [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 }, + [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_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 }, @@ -918,19 +918,19 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [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_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_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_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_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 }, + [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_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 }, @@ -940,8 +940,8 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [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 }, + [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 }, [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, @@ -970,7 +970,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [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 }, + [KW_NAMES] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG }, [INSTRUMENTED_CALL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, [CALL] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, [CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG }, diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 987172bfe3384e..fa35e8d1dbb6e6 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -277,8 +277,8 @@ def __init__(self, inst: parser.InstDef): self.unmoved_names = frozenset(unmoved_names) flag_data = { 'HAS_ARG' : variable_used(inst, "oparg"), - 'HAS_CONST': variable_used(inst, "CO_CONSTS"), - 'HAS_NAME' : variable_used(inst, "CO_NAMES"), + '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 @@ -1075,7 +1075,7 @@ def write_metadata(self) -> None: 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< bool: def variable_used(node: parser.Node, name: str, delim: str = None) -> bool: - """Determine whether a variable with a given name is used in a node. - """ + """Determine whether a variable with a given name is used in a node.""" return any( token.kind == "IDENTIFIER" and token.text == name for token in node.tokens ) + def main(): """Parse command line, parse input, analyze, write output.""" args = arg_parser.parse_args() # Prints message and sys.exit(2) on error From e93f976e17397930fdae8700ea7957b49efd7655 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 13 Jun 2023 17:24:43 +0100 Subject: [PATCH 5/8] enable asseertions for pseudo-ops as well --- Python/compile.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 3676d7a23e726c..399a702ac1d7eb 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -248,10 +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) { - if (!IS_PSEUDO_OPCODE(opcode)) { - assert(!HAS_ARG(opcode) == !OPCODE_HAS_ARG(opcode)); - assert(!HAS_CONST(opcode) == !OPCODE_HAS_CONST(opcode)); - } + 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)); From fe06e045a34f861c9a369ea6878362a724a11e4a Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 13 Jun 2023 17:28:08 +0100 Subject: [PATCH 6/8] remove delim arg --- Tools/cases_generator/generate_cases.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 51d5fc89f6c1c7..33e18985dcd025 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -1266,7 +1266,7 @@ def always_exits(lines: list[str]) -> bool: ) -def variable_used(node: parser.Node, name: str, delim: str = None) -> bool: +def variable_used(node: parser.Node, name: str) -> bool: """Determine whether a variable with a given name is used in a node.""" return any( token.kind == "IDENTIFIER" and token.text == name for token in node.tokens From 0d3dc8e67759159f04a29ec9806f5a0d47f5323b Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 13 Jun 2023 20:43:01 +0100 Subject: [PATCH 7/8] forbid reserved words 'co_consts', 'co_names' --- Tools/cases_generator/generate_cases.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 33e18985dcd025..84f21b9230a916 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -34,6 +34,11 @@ 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, @@ -605,6 +610,9 @@ def parse_file(self, filename: str, instrs_idx: dict[str, int]) -> None: thing: parser.InstDef | parser.Macro | parser.Family | None thing_first_token = psr.peek() while thing := psr.definition(): + if ws := [w for w in RESERVED_WORDS if variable_used(thing, w)]: + self.error(f"'{ws[0]}' is a reserved word. {RESERVED_WORDS[ws[0]]}", thing) + match thing: case parser.InstDef(name=name): if name in self.instrs: From 33dfd3ed1cfb136589962975933f2bd2b331e798 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 13 Jun 2023 20:51:42 +0100 Subject: [PATCH 8/8] change order of args to PseudoInstruction --- Tools/cases_generator/generate_cases.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 84f21b9230a916..8aa500e9e7412a 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -500,9 +500,9 @@ class PseudoInstruction: """A pseudo instruction.""" name: str + targets: list[Instruction] instr_fmt: str flags: int - targets: list[Instruction] @dataclasses.dataclass @@ -809,7 +809,7 @@ def analyze_pseudo(self, pseudo: parser.Pseudo) -> PseudoInstruction: assert(len(fmts) == 1) flags_list = list(set([t.flags for t in targets])) assert(len(flags_list) == 1) - return PseudoInstruction(pseudo.name, fmts[0], flags_list[0], targets) + return PseudoInstruction(pseudo.name, targets, fmts[0], flags_list[0]) def analyze_instruction( self, instr: Instruction, stack: list[StackEffect], sp: int