diff options
author | Guido van Rossum <guido@python.org> | 2023-11-01 20:13:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 20:13:02 (GMT) |
commit | 7e135a48d619407cd4b2a6d80a4ce204b2f5f938 (patch) | |
tree | e0f063e3993696fc700092f50a1cee81f97974ff /Python/executor_cases.c.h | |
parent | 5d6db168b9cda58b4897763041a6109b93e421cb (diff) | |
download | cpython-7e135a48d619407cd4b2a6d80a4ce204b2f5f938.zip cpython-7e135a48d619407cd4b2a6d80a4ce204b2f5f938.tar.gz cpython-7e135a48d619407cd4b2a6d80a4ce204b2f5f938.tar.bz2 |
gh-111520: Integrate the Tier 2 interpreter in the Tier 1 interpreter (#111428)
- There is no longer a separate Python/executor.c file.
- Conventions in Python/bytecodes.c are slightly different -- don't use `goto error`,
you must use `GOTO_ERROR(error)` (same for others like `unused_local_error`).
- The `TIER_ONE` and `TIER_TWO` symbols are only valid in the generated (.c.h) files.
- In Lib/test/support/__init__.py, `Py_C_RECURSION_LIMIT` is imported from `_testcapi`.
- On Windows, in debug mode, stack allocation grows from 8MiB to 12MiB.
- **Beware!** This changes the env vars to enable uops and their debugging
to `PYTHON_UOPS` and `PYTHON_LLTRACE`.
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r-- | Python/executor_cases.c.h | 319 |
1 files changed, 162 insertions, 157 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 3477733..fdf3e4b 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -3,6 +3,11 @@ // Python/bytecodes.c // Do not edit! +#ifdef TIER_ONE + #error "This file is for Tier 2 only" +#endif +#define TIER_TWO 2 + case NOP: { break; } @@ -22,7 +27,7 @@ case LOAD_FAST_CHECK: { PyObject *value; value = GETLOCAL(oparg); - if (value == NULL) goto unbound_local_error; + if (value == NULL) goto unbound_local_error_tier_two; Py_INCREF(value); STACK_GROW(1); stack_pointer[-1] = value; @@ -99,7 +104,7 @@ value = stack_pointer[-1]; res = PyNumber_Negative(value); Py_DECREF(value); - if (res == NULL) goto pop_1_error; + if (res == NULL) goto pop_1_error_tier_two; stack_pointer[-1] = res; break; } @@ -120,7 +125,7 @@ value = stack_pointer[-1]; int err = PyObject_IsTrue(value); Py_DECREF(value); - if (err < 0) goto pop_1_error; + if (err < 0) goto pop_1_error_tier_two; res = err ? Py_True : Py_False; stack_pointer[-1] = res; break; @@ -199,7 +204,7 @@ PyObject *value; PyObject *res; value = stack_pointer[-1]; - uint32_t version = (uint32_t)operand; + uint32_t version = (uint32_t)next_uop[-1].operand; // This one is a bit weird, because we expect *some* failures: assert(version); DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); @@ -216,7 +221,7 @@ value = stack_pointer[-1]; res = PyNumber_Invert(value); Py_DECREF(value); - if (res == NULL) goto pop_1_error; + if (res == NULL) goto pop_1_error_tier_two; stack_pointer[-1] = res; break; } @@ -241,7 +246,7 @@ res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -257,7 +262,7 @@ res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -273,7 +278,7 @@ res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -357,7 +362,7 @@ res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -372,7 +377,7 @@ res = PyObject_GetItem(container, sub); Py_DECREF(container); Py_DECREF(sub); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -397,7 +402,7 @@ Py_DECREF(slice); } Py_DECREF(container); - if (res == NULL) goto pop_3_error; + if (res == NULL) goto pop_3_error_tier_two; STACK_SHRINK(2); stack_pointer[-1] = res; break; @@ -423,7 +428,7 @@ } Py_DECREF(v); Py_DECREF(container); - if (err) goto pop_4_error; + if (err) goto pop_4_error_tier_two; STACK_SHRINK(4); break; } @@ -514,7 +519,7 @@ } Py_DECREF(dict); Py_DECREF(sub); - if (true) goto pop_2_error; + if (true) goto pop_2_error_tier_two; } Py_INCREF(res); // Do this before DECREF'ing dict, sub Py_DECREF(dict); @@ -529,7 +534,7 @@ PyObject *list; v = stack_pointer[-1]; list = stack_pointer[-2 - (oparg-1)]; - if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; + if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error_tier_two; STACK_SHRINK(1); break; } @@ -541,7 +546,7 @@ set = stack_pointer[-2 - (oparg-1)]; int err = PySet_Add(set, v); Py_DECREF(v); - if (err) goto pop_1_error; + if (err) goto pop_1_error_tier_two; STACK_SHRINK(1); break; } @@ -558,7 +563,7 @@ Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - if (err) goto pop_3_error; + if (err) goto pop_3_error_tier_two; STACK_SHRINK(3); break; } @@ -601,7 +606,7 @@ STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); - if (err) goto pop_3_error; + if (err) goto pop_3_error_tier_two; STACK_SHRINK(3); break; } @@ -615,7 +620,7 @@ int err = PyObject_DelItem(container, sub); Py_DECREF(container); Py_DECREF(sub); - if (err) goto pop_2_error; + if (err) goto pop_2_error_tier_two; STACK_SHRINK(2); break; } @@ -627,7 +632,7 @@ assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg].func(tstate, value); Py_DECREF(value); - if (res == NULL) goto pop_1_error; + if (res == NULL) goto pop_1_error_tier_two; stack_pointer[-1] = res; break; } @@ -642,7 +647,7 @@ res = _PyIntrinsics_BinaryFunctions[oparg].func(tstate, value2, value1); Py_DECREF(value2); Py_DECREF(value1); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -691,12 +696,12 @@ "__aiter__ method, got %.100s", type->tp_name); Py_DECREF(obj); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } iter = (*getter)(obj); Py_DECREF(obj); - if (iter == NULL) goto pop_1_error; + if (iter == NULL) goto pop_1_error_tier_two; if (Py_TYPE(iter)->tp_as_async == NULL || Py_TYPE(iter)->tp_as_async->am_anext == NULL) { @@ -706,7 +711,7 @@ "that does not implement __anext__: %.100s", Py_TYPE(iter)->tp_name); Py_DECREF(iter); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } stack_pointer[-1] = iter; break; @@ -723,7 +728,7 @@ if (PyAsyncGen_CheckExact(aiter)) { awaitable = type->tp_as_async->am_anext(aiter); if (awaitable == NULL) { - goto error; + GOTO_ERROR(error); } } else { if (type->tp_as_async != NULL){ @@ -733,7 +738,7 @@ if (getter != NULL) { next_iter = (*getter)(aiter); if (next_iter == NULL) { - goto error; + GOTO_ERROR(error); } } else { @@ -741,7 +746,7 @@ "'async for' requires an iterator with " "__anext__ method, got %.100s", type->tp_name); - goto error; + GOTO_ERROR(error); } awaitable = _PyCoro_GetAwaitableIter(next_iter); @@ -753,7 +758,7 @@ Py_TYPE(next_iter)->tp_name); Py_DECREF(next_iter); - goto error; + GOTO_ERROR(error); } else { Py_DECREF(next_iter); } @@ -789,7 +794,7 @@ } } - if (iter == NULL) goto pop_1_error; + if (iter == NULL) goto pop_1_error_tier_two; stack_pointer[-1] = iter; break; } @@ -813,11 +818,11 @@ case LOAD_BUILD_CLASS: { PyObject *bc; - if (PyMapping_GetOptionalItem(BUILTINS(), &_Py_ID(__build_class__), &bc) < 0) goto error; + if (PyMapping_GetOptionalItem(BUILTINS(), &_Py_ID(__build_class__), &bc) < 0) goto error_tier_two; if (bc == NULL) { _PyErr_SetString(tstate, PyExc_NameError, "__build_class__ not found"); - if (true) goto error; + if (true) goto error_tier_two; } STACK_GROW(1); stack_pointer[-1] = bc; @@ -834,14 +839,14 @@ _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); Py_DECREF(v); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } if (PyDict_CheckExact(ns)) err = PyDict_SetItem(ns, name, v); else err = PyObject_SetItem(ns, name, v); Py_DECREF(v); - if (err) goto pop_1_error; + if (err) goto pop_1_error_tier_two; STACK_SHRINK(1); break; } @@ -853,7 +858,7 @@ if (ns == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals when deleting %R", name); - goto error; + GOTO_ERROR(error); } err = PyObject_DelItem(ns, name); // Can't use ERROR_IF here. @@ -861,7 +866,7 @@ _PyEval_FormatExcCheckArg(tstate, PyExc_NameError, NAME_ERROR_MSG, name); - goto error; + GOTO_ERROR(error); } break; } @@ -869,7 +874,7 @@ case _SPECIALIZE_UNPACK_SEQUENCE: { PyObject *seq; seq = stack_pointer[-1]; - uint16_t counter = (uint16_t)operand; + uint16_t counter = (uint16_t)next_uop[-1].operand; #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr = this_instr; @@ -888,7 +893,7 @@ PyObject **top = stack_pointer + oparg - 1; int res = _PyEval_UnpackIterable(tstate, seq, oparg, -1, top); Py_DECREF(seq); - if (res == 0) goto pop_1_error; + if (res == 0) goto pop_1_error_tier_two; STACK_SHRINK(1); STACK_GROW(oparg); break; @@ -954,7 +959,7 @@ PyObject **top = stack_pointer + totalargs - 1; int res = _PyEval_UnpackIterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); Py_DECREF(seq); - if (res == 0) goto pop_1_error; + if (res == 0) goto pop_1_error_tier_two; STACK_GROW((oparg & 0xFF) + (oparg >> 8)); break; } @@ -968,7 +973,7 @@ int err = PyObject_SetAttr(owner, name, v); Py_DECREF(v); Py_DECREF(owner); - if (err) goto pop_2_error; + if (err) goto pop_2_error_tier_two; STACK_SHRINK(2); break; } @@ -979,7 +984,7 @@ PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_DelAttr(owner, name); Py_DECREF(owner); - if (err) goto pop_1_error; + if (err) goto pop_1_error_tier_two; STACK_SHRINK(1); break; } @@ -990,7 +995,7 @@ PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); Py_DECREF(v); - if (err) goto pop_1_error; + if (err) goto pop_1_error_tier_two; STACK_SHRINK(1); break; } @@ -1005,7 +1010,7 @@ _PyEval_FormatExcCheckArg(tstate, PyExc_NameError, NAME_ERROR_MSG, name); } - goto error; + GOTO_ERROR(error); } break; } @@ -1016,7 +1021,7 @@ if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, "no locals found"); - if (true) goto error; + if (true) goto error_tier_two; } Py_INCREF(locals); STACK_GROW(1); @@ -1030,7 +1035,7 @@ mod_or_class_dict = stack_pointer[-1]; PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyMapping_GetOptionalItem(mod_or_class_dict, name, &v) < 0) { - goto error; + GOTO_ERROR(error); } if (v == NULL) { v = PyDict_GetItemWithError(GLOBALS(), name); @@ -1038,17 +1043,17 @@ Py_INCREF(v); } else if (_PyErr_Occurred(tstate)) { - goto error; + GOTO_ERROR(error); } else { if (PyMapping_GetOptionalItem(BUILTINS(), name, &v) < 0) { - goto error; + GOTO_ERROR(error); } if (v == NULL) { _PyEval_FormatExcCheckArg( tstate, PyExc_NameError, NAME_ERROR_MSG, name); - goto error; + GOTO_ERROR(error); } } } @@ -1063,11 +1068,11 @@ if (mod_or_class_dict == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, "no locals found"); - if (true) goto error; + if (true) goto error_tier_two; } PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); if (PyMapping_GetOptionalItem(mod_or_class_dict, name, &v) < 0) { - goto error; + GOTO_ERROR(error); } if (v == NULL) { v = PyDict_GetItemWithError(GLOBALS(), name); @@ -1075,17 +1080,17 @@ Py_INCREF(v); } else if (_PyErr_Occurred(tstate)) { - goto error; + GOTO_ERROR(error); } else { if (PyMapping_GetOptionalItem(BUILTINS(), name, &v) < 0) { - goto error; + GOTO_ERROR(error); } if (v == NULL) { _PyEval_FormatExcCheckArg( tstate, PyExc_NameError, NAME_ERROR_MSG, name); - goto error; + GOTO_ERROR(error); } } } @@ -1111,22 +1116,22 @@ _PyEval_FormatExcCheckArg(tstate, PyExc_NameError, NAME_ERROR_MSG, name); } - if (true) goto error; + if (true) goto error_tier_two; } Py_INCREF(res); } else { /* Slow-path if globals or builtins is not a dict */ /* namespace 1: globals */ - if (PyMapping_GetOptionalItem(GLOBALS(), name, &res) < 0) goto error; + if (PyMapping_GetOptionalItem(GLOBALS(), name, &res) < 0) goto error_tier_two; if (res == NULL) { /* namespace 2: builtins */ - if (PyMapping_GetOptionalItem(BUILTINS(), name, &res) < 0) goto error; + if (PyMapping_GetOptionalItem(BUILTINS(), name, &res) < 0) goto error_tier_two; if (res == NULL) { _PyEval_FormatExcCheckArg( tstate, PyExc_NameError, NAME_ERROR_MSG, name); - if (true) goto error; + if (true) goto error_tier_two; } } } @@ -1139,7 +1144,7 @@ } case _GUARD_GLOBALS_VERSION: { - uint16_t version = (uint16_t)operand; + uint16_t version = (uint16_t)next_uop[-1].operand; PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(!PyDict_CheckExact(dict), _GUARD_GLOBALS_VERSION); DEOPT_IF(dict->ma_keys->dk_version != version, _GUARD_GLOBALS_VERSION); @@ -1148,7 +1153,7 @@ } case _GUARD_BUILTINS_VERSION: { - uint16_t version = (uint16_t)operand; + uint16_t version = (uint16_t)next_uop[-1].operand; PyDictObject *dict = (PyDictObject *)BUILTINS(); DEOPT_IF(!PyDict_CheckExact(dict), _GUARD_BUILTINS_VERSION); DEOPT_IF(dict->ma_keys->dk_version != version, _GUARD_BUILTINS_VERSION); @@ -1159,7 +1164,7 @@ case _LOAD_GLOBAL_MODULE: { PyObject *res; PyObject *null = NULL; - uint16_t index = (uint16_t)operand; + uint16_t index = (uint16_t)next_uop[-1].operand; PyDictObject *dict = (PyDictObject *)GLOBALS(); PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(dict->ma_keys); res = entries[index].me_value; @@ -1177,7 +1182,7 @@ case _LOAD_GLOBAL_BUILTINS: { PyObject *res; PyObject *null = NULL; - uint16_t index = (uint16_t)operand; + uint16_t index = (uint16_t)next_uop[-1].operand; PyDictObject *bdict = (PyDictObject *)BUILTINS(); PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(bdict->ma_keys); res = entries[index].me_value; @@ -1194,7 +1199,7 @@ case DELETE_FAST: { PyObject *v = GETLOCAL(oparg); - if (v == NULL) goto unbound_local_error; + if (v == NULL) goto unbound_local_error_tier_two; SETLOCAL(oparg, NULL); break; } @@ -1205,7 +1210,7 @@ PyObject *initial = GETLOCAL(oparg); PyObject *cell = PyCell_New(initial); if (cell == NULL) { - goto error; + GOTO_ERROR(error); } SETLOCAL(oparg, cell); break; @@ -1218,7 +1223,7 @@ // Fortunately we don't need its superpower. if (oldobj == NULL) { _PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg); - goto error; + GOTO_ERROR(error); } PyCell_SET(cell, NULL); Py_DECREF(oldobj); @@ -1235,7 +1240,7 @@ name = PyTuple_GET_ITEM(_PyFrame_GetCode(frame)->co_localsplusnames, oparg); if (PyMapping_GetOptionalItem(class_dict, name, &value) < 0) { Py_DECREF(class_dict); - goto error; + GOTO_ERROR(error); } Py_DECREF(class_dict); if (!value) { @@ -1243,7 +1248,7 @@ value = PyCell_GET(cell); if (value == NULL) { _PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg); - goto error; + GOTO_ERROR(error); } Py_INCREF(value); } @@ -1257,7 +1262,7 @@ value = PyCell_GET(cell); if (value == NULL) { _PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg); - if (true) goto error; + if (true) goto error_tier_two; } Py_INCREF(value); STACK_GROW(1); @@ -1298,7 +1303,7 @@ for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - if (str == NULL) { STACK_SHRINK(oparg); goto error; } + if (str == NULL) { STACK_SHRINK(oparg); goto error_tier_two; } STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -1310,7 +1315,7 @@ PyObject *tup; values = stack_pointer - oparg; tup = _PyTuple_FromArraySteal(values, oparg); - if (tup == NULL) { STACK_SHRINK(oparg); goto error; } + if (tup == NULL) { STACK_SHRINK(oparg); goto error_tier_two; } STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -1322,7 +1327,7 @@ PyObject *list; values = stack_pointer - oparg; list = _PyList_FromArraySteal(values, oparg); - if (list == NULL) { STACK_SHRINK(oparg); goto error; } + if (list == NULL) { STACK_SHRINK(oparg); goto error_tier_two; } STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -1345,7 +1350,7 @@ Py_TYPE(iterable)->tp_name); } Py_DECREF(iterable); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } assert(Py_IsNone(none_val)); Py_DECREF(iterable); @@ -1360,7 +1365,7 @@ set = stack_pointer[-2 - (oparg-1)]; int err = _PySet_Update(set, iterable); Py_DECREF(iterable); - if (err < 0) goto pop_1_error; + if (err < 0) goto pop_1_error_tier_two; STACK_SHRINK(1); break; } @@ -1371,7 +1376,7 @@ values = stack_pointer - oparg; set = PySet_New(NULL); if (set == NULL) - goto error; + GOTO_ERROR(error); int err = 0; for (int i = 0; i < oparg; i++) { PyObject *item = values[i]; @@ -1381,7 +1386,7 @@ } if (err != 0) { Py_DECREF(set); - if (true) { STACK_SHRINK(oparg); goto error; } + if (true) { STACK_SHRINK(oparg); goto error_tier_two; } } STACK_SHRINK(oparg); STACK_GROW(1); @@ -1400,7 +1405,7 @@ for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } + if (map == NULL) { STACK_SHRINK(oparg*2); goto error_tier_two; } STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -1413,33 +1418,33 @@ if (LOCALS() == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when setting up annotations"); - if (true) goto error; + if (true) goto error_tier_two; } /* check if __annotations__ in locals()... */ if (PyDict_CheckExact(LOCALS())) { ann_dict = _PyDict_GetItemWithError(LOCALS(), &_Py_ID(__annotations__)); if (ann_dict == NULL) { - if (_PyErr_Occurred(tstate)) goto error; + if (_PyErr_Occurred(tstate)) goto error_tier_two; /* ...if not, create a new one */ ann_dict = PyDict_New(); - if (ann_dict == NULL) goto error; + if (ann_dict == NULL) goto error_tier_two; err = PyDict_SetItem(LOCALS(), &_Py_ID(__annotations__), ann_dict); Py_DECREF(ann_dict); - if (err) goto error; + if (err) goto error_tier_two; } } else { /* do the same if locals() is not a dict */ - if (PyMapping_GetOptionalItem(LOCALS(), &_Py_ID(__annotations__), &ann_dict) < 0) goto error; + if (PyMapping_GetOptionalItem(LOCALS(), &_Py_ID(__annotations__), &ann_dict) < 0) goto error_tier_two; if (ann_dict == NULL) { ann_dict = PyDict_New(); - if (ann_dict == NULL) goto error; + if (ann_dict == NULL) goto error_tier_two; err = PyObject_SetItem(LOCALS(), &_Py_ID(__annotations__), ann_dict); Py_DECREF(ann_dict); - if (err) goto error; + if (err) goto error_tier_two; } else { Py_DECREF(ann_dict); @@ -1458,7 +1463,7 @@ PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, "bad BUILD_CONST_KEY_MAP keys argument"); - goto error; // Pop the keys and values. + GOTO_ERROR(error); // Pop the keys and values. } map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, @@ -1467,7 +1472,7 @@ Py_DECREF(values[_i]); } Py_DECREF(keys); - if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } + if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error_tier_two; } STACK_SHRINK(oparg); stack_pointer[-1] = map; break; @@ -1485,7 +1490,7 @@ Py_TYPE(update)->tp_name); } Py_DECREF(update); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } Py_DECREF(update); STACK_SHRINK(1); @@ -1502,7 +1507,7 @@ if (_PyDict_MergeEx(dict, update, 2) < 0) { _PyEval_FormatKwargsError(tstate, callable, update); Py_DECREF(update); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } Py_DECREF(update); STACK_SHRINK(1); @@ -1519,7 +1524,7 @@ 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; + if (_PyDict_SetItem_Take2((PyDictObject *)dict, key, value) != 0) goto pop_2_error_tier_two; STACK_SHRINK(2); break; } @@ -1541,7 +1546,7 @@ Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - if (attr == NULL) goto pop_3_error; + if (attr == NULL) goto pop_3_error_tier_two; STACK_SHRINK(2); stack_pointer[-1] = attr; break; @@ -1569,7 +1574,7 @@ Py_DECREF(class); if (attr == NULL) { Py_DECREF(self); - if (true) goto pop_3_error; + if (true) goto pop_3_error_tier_two; } if (method_found) { self_or_null = self; // transfer ownership @@ -1608,7 +1613,7 @@ NULL | meth | arg1 | ... | argN */ Py_DECREF(owner); - if (attr == NULL) goto pop_1_error; + if (attr == NULL) goto pop_1_error_tier_two; self_or_null = NULL; } } @@ -1616,7 +1621,7 @@ /* Classic, pushes one value. */ attr = PyObject_GetAttr(owner, name); Py_DECREF(owner); - if (attr == NULL) goto pop_1_error; + if (attr == NULL) goto pop_1_error_tier_two; } STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1 - (oparg & 1 ? 1 : 0)] = attr; @@ -1627,7 +1632,7 @@ case _GUARD_TYPE_VERSION: { PyObject *owner; owner = stack_pointer[-1]; - uint32_t type_version = (uint32_t)operand; + uint32_t type_version = (uint32_t)next_uop[-1].operand; PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, _GUARD_TYPE_VERSION); @@ -1649,7 +1654,7 @@ PyObject *attr; PyObject *null = NULL; owner = stack_pointer[-1]; - uint16_t index = (uint16_t)operand; + uint16_t index = (uint16_t)next_uop[-1].operand; PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner); attr = _PyDictOrValues_GetValues(dorv)->values[index]; DEOPT_IF(attr == NULL, _LOAD_ATTR_INSTANCE_VALUE); @@ -1666,7 +1671,7 @@ case _CHECK_ATTR_MODULE: { PyObject *owner; owner = stack_pointer[-1]; - uint32_t type_version = (uint32_t)operand; + uint32_t type_version = (uint32_t)next_uop[-1].operand; DEOPT_IF(!PyModule_CheckExact(owner), _CHECK_ATTR_MODULE); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -1679,7 +1684,7 @@ PyObject *attr; PyObject *null = NULL; owner = stack_pointer[-1]; - uint16_t index = (uint16_t)operand; + uint16_t index = (uint16_t)next_uop[-1].operand; PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict->ma_keys->dk_kind == DICT_KEYS_UNICODE); assert(index < dict->ma_keys->dk_nentries); @@ -1713,7 +1718,7 @@ PyObject *attr; PyObject *null = NULL; owner = stack_pointer[-1]; - uint16_t hint = (uint16_t)operand; + uint16_t hint = (uint16_t)next_uop[-1].operand; PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner); PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv); DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, _LOAD_ATTR_WITH_HINT); @@ -1744,7 +1749,7 @@ PyObject *attr; PyObject *null = NULL; owner = stack_pointer[-1]; - uint16_t index = (uint16_t)operand; + uint16_t index = (uint16_t)next_uop[-1].operand; char *addr = (char *)owner + index; attr = *(PyObject **)addr; DEOPT_IF(attr == NULL, _LOAD_ATTR_SLOT); @@ -1761,7 +1766,7 @@ case _CHECK_ATTR_CLASS: { PyObject *owner; owner = stack_pointer[-1]; - uint32_t type_version = (uint32_t)operand; + uint32_t type_version = (uint32_t)next_uop[-1].operand; DEOPT_IF(!PyType_Check(owner), _CHECK_ATTR_CLASS); assert(type_version != 0); DEOPT_IF(((PyTypeObject *)owner)->tp_version_tag != type_version, _CHECK_ATTR_CLASS); @@ -1773,7 +1778,7 @@ PyObject *attr; PyObject *null = NULL; owner = stack_pointer[-1]; - PyObject *descr = (PyObject *)operand; + PyObject *descr = (PyObject *)next_uop[-1].operand; STAT_INC(LOAD_ATTR, hit); assert(descr != NULL); attr = Py_NewRef(descr); @@ -1799,7 +1804,7 @@ PyObject *value; owner = stack_pointer[-1]; value = stack_pointer[-2]; - uint16_t index = (uint16_t)operand; + uint16_t index = (uint16_t)next_uop[-1].operand; PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner); STAT_INC(STORE_ATTR, hit); PyDictValues *values = _PyDictOrValues_GetValues(dorv); @@ -1821,7 +1826,7 @@ PyObject *value; owner = stack_pointer[-1]; value = stack_pointer[-2]; - uint16_t index = (uint16_t)operand; + uint16_t index = (uint16_t)next_uop[-1].operand; char *addr = (char *)owner + index; STAT_INC(STORE_ATTR, hit); PyObject *old_value = *(PyObject **)addr; @@ -1842,11 +1847,11 @@ res = PyObject_RichCompare(left, right, oparg >> 5); Py_DECREF(left); Py_DECREF(right); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; if (oparg & 16) { int res_bool = PyObject_IsTrue(res); Py_DECREF(res); - if (res_bool < 0) goto pop_2_error; + if (res_bool < 0) goto pop_2_error_tier_two; res = res_bool ? Py_True : Py_False; } STACK_SHRINK(1); @@ -1949,7 +1954,7 @@ int res = PySequence_Contains(right, left); Py_DECREF(left); Py_DECREF(right); - if (res < 0) goto pop_2_error; + if (res < 0) goto pop_2_error_tier_two; b = (res ^ oparg) ? Py_True : Py_False; STACK_SHRINK(1); stack_pointer[-1] = b; @@ -1966,7 +1971,7 @@ if (_PyEval_CheckExceptStarTypeValid(tstate, match_type) < 0) { Py_DECREF(exc_value); Py_DECREF(match_type); - if (true) goto pop_2_error; + if (true) goto pop_2_error_tier_two; } match = NULL; @@ -1975,10 +1980,10 @@ &match, &rest); Py_DECREF(exc_value); Py_DECREF(match_type); - if (res < 0) goto pop_2_error; + if (res < 0) goto pop_2_error_tier_two; assert((match == NULL) == (rest == NULL)); - if (match == NULL) goto pop_2_error; + if (match == NULL) goto pop_2_error_tier_two; if (!Py_IsNone(match)) { PyErr_SetHandledException(match); @@ -1997,7 +2002,7 @@ assert(PyExceptionInstance_Check(left)); if (_PyEval_CheckExceptTypeValid(tstate, right) < 0) { Py_DECREF(right); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } int res = PyErr_GivenExceptionMatches(left, right); @@ -2028,9 +2033,9 @@ obj = stack_pointer[-1]; // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); - if (len_i < 0) goto error; + if (len_i < 0) goto error_tier_two; len_o = PyLong_FromSsize_t(len_i); - if (len_o == NULL) goto error; + if (len_o == NULL) goto error_tier_two; STACK_GROW(1); stack_pointer[-1] = len_o; break; @@ -2055,7 +2060,7 @@ assert(PyTuple_CheckExact(attrs)); // Success! } else { - if (_PyErr_Occurred(tstate)) goto pop_3_error; + if (_PyErr_Occurred(tstate)) goto pop_3_error_tier_two; attrs = Py_None; // Failure! } STACK_SHRINK(2); @@ -2093,7 +2098,7 @@ subject = stack_pointer[-2]; // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = _PyEval_MatchKeys(tstate, subject, keys); - if (values_or_none == NULL) goto error; + if (values_or_none == NULL) goto error_tier_two; STACK_GROW(1); stack_pointer[-1] = values_or_none; break; @@ -2106,7 +2111,7 @@ /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); Py_DECREF(iterable); - if (iter == NULL) goto pop_1_error; + if (iter == NULL) goto pop_1_error_tier_two; stack_pointer[-1] = iter; break; } @@ -2124,7 +2129,7 @@ _PyErr_SetString(tstate, PyExc_TypeError, "cannot 'yield from' a coroutine object " "in a non-coroutine generator"); - goto error; + GOTO_ERROR(error); } iter = iterable; } @@ -2135,7 +2140,7 @@ /* `iterable` is not a generator. */ iter = PyObject_GetIter(iterable); if (iter == NULL) { - goto error; + GOTO_ERROR(error); } Py_DECREF(iterable); } @@ -2264,7 +2269,7 @@ r->start = value + r->step; r->len--; next = PyLong_FromLong(value); - if (next == NULL) goto error; + if (next == NULL) goto error_tier_two; STACK_GROW(1); stack_pointer[-1] = next; break; @@ -2283,7 +2288,7 @@ "asynchronous context manager protocol", Py_TYPE(mgr)->tp_name); } - goto error; + GOTO_ERROR(error); } exit = _PyObject_LookupSpecial(mgr, &_Py_ID(__aexit__)); if (exit == NULL) { @@ -2295,14 +2300,14 @@ Py_TYPE(mgr)->tp_name); } Py_DECREF(enter); - goto error; + GOTO_ERROR(error); } Py_DECREF(mgr); res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); - if (true) goto pop_1_error; + if (true) goto pop_1_error_tier_two; } STACK_GROW(1); stack_pointer[-2] = exit; @@ -2342,7 +2347,7 @@ PyObject *stack[4] = {NULL, exc, val, tb}; res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); - if (res == NULL) goto error; + if (res == NULL) goto error_tier_two; STACK_GROW(1); stack_pointer[-1] = res; break; @@ -2379,7 +2384,7 @@ case _GUARD_KEYS_VERSION: { PyObject *owner; owner = stack_pointer[-1]; - uint32_t keys_version = (uint32_t)operand; + uint32_t keys_version = (uint32_t)next_uop[-1].operand; PyTypeObject *owner_cls = Py_TYPE(owner); PyHeapTypeObject *owner_heap_type = (PyHeapTypeObject *)owner_cls; DEOPT_IF(owner_heap_type->ht_cached_keys->dk_version != keys_version, _GUARD_KEYS_VERSION); @@ -2391,7 +2396,7 @@ PyObject *attr; PyObject *self; owner = stack_pointer[-1]; - PyObject *descr = (PyObject *)operand; + PyObject *descr = (PyObject *)next_uop[-1].operand; assert(oparg & 1); /* Cached method object */ STAT_INC(LOAD_ATTR, hit); @@ -2410,7 +2415,7 @@ PyObject *attr; PyObject *self; owner = stack_pointer[-1]; - PyObject *descr = (PyObject *)operand; + PyObject *descr = (PyObject *)next_uop[-1].operand; assert(oparg & 1); assert(Py_TYPE(owner)->tp_dictoffset == 0); STAT_INC(LOAD_ATTR, hit); @@ -2428,7 +2433,7 @@ PyObject *owner; PyObject *attr; owner = stack_pointer[-1]; - PyObject *descr = (PyObject *)operand; + PyObject *descr = (PyObject *)next_uop[-1].operand; assert((oparg & 1) == 0); STAT_INC(LOAD_ATTR, hit); assert(descr != NULL); @@ -2442,7 +2447,7 @@ PyObject *owner; PyObject *attr; owner = stack_pointer[-1]; - PyObject *descr = (PyObject *)operand; + PyObject *descr = (PyObject *)next_uop[-1].operand; assert((oparg & 1) == 0); assert(Py_TYPE(owner)->tp_dictoffset == 0); STAT_INC(LOAD_ATTR, hit); @@ -2469,7 +2474,7 @@ PyObject *attr; PyObject *self; owner = stack_pointer[-1]; - PyObject *descr = (PyObject *)operand; + PyObject *descr = (PyObject *)next_uop[-1].operand; assert(oparg & 1); STAT_INC(LOAD_ATTR, hit); assert(descr != NULL); @@ -2518,7 +2523,7 @@ PyObject *callable; self_or_null = stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; - uint32_t func_version = (uint32_t)operand; + uint32_t func_version = (uint32_t)next_uop[-1].operand; DEOPT_IF(!PyFunction_Check(callable), _CHECK_FUNCTION_EXACT_ARGS); PyFunctionObject *func = (PyFunctionObject *)callable; DEOPT_IF(func->func_version != func_version, _CHECK_FUNCTION_EXACT_ARGS); @@ -2623,7 +2628,7 @@ res = PyObject_Str(arg); Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2647,7 +2652,7 @@ res = PySequence_Tuple(arg); Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2663,7 +2668,7 @@ PyErr_Format(PyExc_TypeError, "__init__() should return None, not '%.200s'", Py_TYPE(should_be_none)->tp_name); - goto error; + GOTO_ERROR(error); } STACK_SHRINK(1); break; @@ -2692,7 +2697,7 @@ Py_DECREF(args[i]); } Py_DECREF(tp); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2722,7 +2727,7 @@ // This is slower but CPython promises to check all non-vectorcall // function calls. if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) { - goto error; + GOTO_ERROR(error); } PyObject *arg = args[0]; res = _PyCFunction_TrampolineCall(cfunc, PyCFunction_GET_SELF(callable), arg); @@ -2731,7 +2736,7 @@ Py_DECREF(arg); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2769,7 +2774,7 @@ Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } /* Not deopting because this doesn't mean our optimization was wrong. `res` can be NULL for valid reasons. Eg. getattr(x, 'invalid'). In those cases an exception is set, so we must @@ -2811,7 +2816,7 @@ Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2840,14 +2845,14 @@ PyObject *arg = args[0]; Py_ssize_t len_i = PyObject_Length(arg); if (len_i < 0) { - goto error; + GOTO_ERROR(error); } res = PyLong_FromSsize_t(len_i); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); Py_DECREF(callable); Py_DECREF(arg); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2876,7 +2881,7 @@ PyObject *inst = args[0]; int retval = PyObject_IsInstance(inst, cls); if (retval < 0) { - goto error; + GOTO_ERROR(error); } res = PyBool_FromLong(retval); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); @@ -2884,7 +2889,7 @@ Py_DECREF(inst); Py_DECREF(cls); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2917,7 +2922,7 @@ // This is slower but CPython promises to check all non-vectorcall // function calls. if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) { - goto error; + GOTO_ERROR(error); } res = _PyCFunction_TrampolineCall(cfunc, self, arg); _Py_LeaveRecursiveCallTstate(tstate); @@ -2925,7 +2930,7 @@ Py_DECREF(self); Py_DECREF(arg); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2965,7 +2970,7 @@ Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -2999,14 +3004,14 @@ // This is slower but CPython promises to check all non-vectorcall // function calls. if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) { - goto error; + GOTO_ERROR(error); } res = _PyCFunction_TrampolineCall(cfunc, self, NULL); _Py_LeaveRecursiveCallTstate(tstate); assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); Py_DECREF(self); Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3045,7 +3050,7 @@ Py_DECREF(args[i]); } Py_DECREF(callable); - if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error_tier_two; } STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3063,7 +3068,7 @@ Py_DECREF(codeobj); if (func_obj == NULL) { - goto error; + GOTO_ERROR(error); } _PyFunction_SetVersion( @@ -3119,7 +3124,7 @@ Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } + if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error_tier_two; } STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -3135,7 +3140,7 @@ conv_fn = CONVERSION_FUNCTIONS[oparg]; result = conv_fn(value); Py_DECREF(value); - if (result == NULL) goto pop_1_error; + if (result == NULL) goto pop_1_error_tier_two; stack_pointer[-1] = result; break; } @@ -3149,7 +3154,7 @@ if (!PyUnicode_CheckExact(value)) { res = PyObject_Format(value, NULL); Py_DECREF(value); - if (res == NULL) goto pop_1_error; + if (res == NULL) goto pop_1_error_tier_two; } else { res = value; @@ -3167,7 +3172,7 @@ res = PyObject_Format(value, fmt_spec); Py_DECREF(value); Py_DECREF(fmt_spec); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -3194,7 +3199,7 @@ res = _PyEval_BinaryOps[oparg](lhs, rhs); Py_DECREF(lhs); Py_DECREF(rhs); - if (res == NULL) goto pop_2_error; + if (res == NULL) goto pop_2_error_tier_two; STACK_SHRINK(1); stack_pointer[-1] = res; break; @@ -3215,7 +3220,7 @@ PyObject *flag; flag = stack_pointer[-1]; if (Py_IsFalse(flag)) { - pc = oparg; + next_uop = current_executor->trace + oparg; } STACK_SHRINK(1); break; @@ -3225,21 +3230,22 @@ PyObject *flag; flag = stack_pointer[-1]; if (Py_IsTrue(flag)) { - pc = oparg; + next_uop = current_executor->trace + oparg; } STACK_SHRINK(1); break; } case _JUMP_TO_TOP: { - pc = 0; + next_uop = current_executor->trace; CHECK_EVAL_BREAKER(); break; } case _SET_IP: { TIER_TWO_ONLY - frame->instr_ptr = ip_offset + oparg; + // TODO: Put the code pointer in `operand` to avoid indirection via `frame` + frame->instr_ptr = _PyCode_CODE(_PyFrame_GetCode(frame)) + oparg; break; } @@ -3255,10 +3261,7 @@ case _EXIT_TRACE: { TIER_TWO_ONLY - _PyFrame_SetStackPointer(frame, stack_pointer); - Py_DECREF(self); - OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); - return frame; + GOTO_TIER_ONE(); break; } @@ -3270,3 +3273,5 @@ stack_pointer[-1 - oparg] = top; break; } + +#undef TIER_TWO |