From 36a1893673eb3d2c5361b1f019f34f47a35f3072 Mon Sep 17 00:00:00 2001 From: Aniket Panse Date: Mon, 15 Jul 2024 17:28:50 -0700 Subject: [PATCH] Port over gh-91048 for awaiter support in Meta Python 3.12 Summary: Context: We are deciding to stick with the old "bpf" way of doing async stack walking for Meta Python 3.12, and maybe 3.13. This involves continuing support for the awaiter pointer which is why we need this port. Ideally we get the python stack from the runtime and there is expected to be an internal implementation of this for Meta Python 3.13 or 3.14 latest. This is essentially a copy-paste port of https://github.com/python/cpython/pull/103976/files from last year. The main change of this diff from the PR is that gi_awaiter is renamed to gi_ci_awaiter Reviewed By: jbower-fb Differential Revision: D57072594 fbshipit-source-id: ca0d2ee0ffca2a72e16d479ca395555ed13498af --- Include/cpython/genobject.h | 11 + Include/cpython/object.h | 2 + .../pycore_global_objects_fini_generated.h | 1 + Include/internal/pycore_global_strings.h | 1 + .../internal/pycore_runtime_init_generated.h | 1 + .../internal/pycore_unicodeobject_generated.h | 3 + Include/typeslots.h | 4 + Lib/asyncio/tasks.py | 63 +++ Lib/test/test_asyncgen.py | 34 ++ Lib/test/test_asyncio/test_tasks.py | 86 +++ Lib/test/test_coroutines.py | 69 +++ Lib/test/test_sys.py | 4 +- Misc/ACKS | 1 + Modules/_asynciomodule.c | 19 + Objects/genobject.c | 57 ++ Objects/iterobject.c | 1 + Objects/typeobject.c | 36 ++ Objects/typeslots.inc | 1 + Python/bytecodes.c | 14 + Python/generated_cases.c.h | 518 ++++++++++++++++++ 20 files changed, 924 insertions(+), 2 deletions(-) diff --git a/Include/cpython/genobject.h b/Include/cpython/genobject.h index f902d3d75f9..895647bfbc5 100644 --- a/Include/cpython/genobject.h +++ b/Include/cpython/genobject.h @@ -7,6 +7,17 @@ extern "C" { #endif +static inline int +_PyAwaitable_SetAwaiter(PyObject *receiver, PyObject *awaiter) +{ + PyTypeObject *ty = Py_TYPE(receiver); + PyAsyncMethods *am = (PyAsyncMethods *) ty->tp_as_async; + if ((am != NULL) && (am->am_set_awaiter != NULL)) { + return am->am_set_awaiter(receiver, awaiter); + } + return 0; +} + /* --- Generators --------------------------------------------------------- */ /* _PyGenObject_HEAD defines the initial segment of generator diff --git a/Include/cpython/object.h b/Include/cpython/object.h index ae7f780a931..4a7916fbdcc 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -124,12 +124,14 @@ typedef struct { } PyMappingMethods; typedef PySendResult (*sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +typedef int (*setawaiterfunc)(PyObject *iter, PyObject *awaiter); typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; sendfunc am_send; + setawaiterfunc am_set_awaiter; } PyAsyncMethods; typedef struct { diff --git a/Include/internal/pycore_global_objects_fini_generated.h b/Include/internal/pycore_global_objects_fini_generated.h index a985c6405e5..bf0a7d580a9 100644 --- a/Include/internal/pycore_global_objects_fini_generated.h +++ b/Include/internal/pycore_global_objects_fini_generated.h @@ -717,6 +717,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) { _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__rtruediv__)); _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__rxor__)); _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__set__)); + _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__set_awaiter__)); _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__set_name__)); _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__setattr__)); _PyStaticObject_CheckRefcnt((PyObject *)&_Py_ID(__setitem__)); diff --git a/Include/internal/pycore_global_strings.h b/Include/internal/pycore_global_strings.h index b251fc387b5..fafef65e770 100644 --- a/Include/internal/pycore_global_strings.h +++ b/Include/internal/pycore_global_strings.h @@ -206,6 +206,7 @@ struct _Py_global_strings { STRUCT_FOR_ID(__rtruediv__) STRUCT_FOR_ID(__rxor__) STRUCT_FOR_ID(__set__) + STRUCT_FOR_ID(__set_awaiter__) STRUCT_FOR_ID(__set_name__) STRUCT_FOR_ID(__setattr__) STRUCT_FOR_ID(__setitem__) diff --git a/Include/internal/pycore_runtime_init_generated.h b/Include/internal/pycore_runtime_init_generated.h index 743f666dcd5..828625be4b9 100644 --- a/Include/internal/pycore_runtime_init_generated.h +++ b/Include/internal/pycore_runtime_init_generated.h @@ -712,6 +712,7 @@ extern "C" { INIT_ID(__rtruediv__), \ INIT_ID(__rxor__), \ INIT_ID(__set__), \ + INIT_ID(__set_awaiter__), \ INIT_ID(__set_name__), \ INIT_ID(__setattr__), \ INIT_ID(__setitem__), \ diff --git a/Include/internal/pycore_unicodeobject_generated.h b/Include/internal/pycore_unicodeobject_generated.h index bd4a895a63a..b2345168896 100644 --- a/Include/internal/pycore_unicodeobject_generated.h +++ b/Include/internal/pycore_unicodeobject_generated.h @@ -459,6 +459,9 @@ _PyUnicode_InitStaticStrings(PyInterpreterState *interp) { string = &_Py_ID(__set__); assert(_PyUnicode_CheckConsistency(string, 1)); _PyUnicode_InternInPlace(interp, &string); + string = &_Py_ID(__set_awaiter__); + assert(_PyUnicode_CheckConsistency(string, 1)); + _PyUnicode_InternInPlace(interp, &string); string = &_Py_ID(__set_name__); assert(_PyUnicode_CheckConsistency(string, 1)); _PyUnicode_InternInPlace(interp, &string); diff --git a/Include/typeslots.h b/Include/typeslots.h index 506b05580de..01994d28223 100644 --- a/Include/typeslots.h +++ b/Include/typeslots.h @@ -86,3 +86,7 @@ /* New in 3.10 */ #define Py_am_send 81 #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030C0000 +/* New in 3.12 */ +#define Py_am_set_awaiter 82 +#endif diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 881637f660e..9a852a3d5e5 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -8,6 +8,7 @@ 'current_task', 'all_tasks', 'create_eager_task_factory', 'eager_task_factory', '_register_task', '_unregister_task', '_enter_task', '_leave_task', + 'get_async_stack', ) import concurrent.futures @@ -16,6 +17,7 @@ import inspect import itertools import types +import sys import warnings import weakref from types import GenericAlias @@ -732,6 +734,11 @@ def cancel(self, msg=None): self._cancel_requested = True return ret + def __set_awaiter__(self, awaiter): + for child in self._children: + if hasattr(child, "__set_awaiter__"): + child.__set_awaiter__(awaiter) + def gather(*coros_or_futures, return_exceptions=False): """Return a future aggregating results from the given coroutines/futures. @@ -956,6 +963,62 @@ def callback(): return future +def get_async_stack(): + """Return the async call stack for the currently executing task as a list of + frames, with the most recent frame last. + The async call stack consists of the call stack for the currently executing + task, if any, plus the call stack formed by the transitive set of coroutines/async + generators awaiting the current task. + Consider the following example, where T represents a task, C represents + a coroutine, and A '->' B indicates A is awaiting B. + T0 +---> T1 + | | | + C0 | C2 + | | | + v | v + C1 | C3 + | | + +-----| + The await stack from C3 would be C3, C2, C1, C0. In contrast, the + synchronous call stack while C3 is executing is only C3, C2. + """ + if not hasattr(sys, "_getframe"): + return [] + + task = current_task() + coro = task.get_coro() + coro_frame = coro.cr_frame + + # Get the active portion of the stack + stack = [] + frame = sys._getframe().f_back + while frame is not None: + stack.append(frame) + if frame is coro_frame: + break + frame = frame.f_back + assert frame is coro_frame + + # Get the suspended portion of the stack + awaiter = coro.cr_awaiter + while awaiter is not None: + if hasattr(awaiter, "cr_frame"): + stack.append(awaiter.cr_frame) + awaiter = awaiter.cr_awaiter + elif hasattr(awaiter, "ag_frame"): + stack.append(awaiter.ag_frame) + awaiter = awaiter.ag_awaiter + else: + raise ValueError(f"Unexpected awaiter {awaiter}") + + stack.reverse() + return stack + + +# WeakSet containing all alive tasks. +_all_tasks = weakref.WeakSet() + + def create_eager_task_factory(custom_task_constructor): """Create a function suitable for use as a task factory on an event-loop. diff --git a/Lib/test/test_asyncgen.py b/Lib/test/test_asyncgen.py index 9e199806da6..0e37b3b858f 100644 --- a/Lib/test/test_asyncgen.py +++ b/Lib/test/test_asyncgen.py @@ -1903,5 +1903,39 @@ async def run(): self.loop.run_until_complete(run()) +class AsyncGeneratorAwaiterTest(unittest.TestCase): + def setUp(self): + self.loop = asyncio.new_event_loop() + asyncio.set_event_loop(None) + + def tearDown(self): + self.loop.close() + self.loop = None + asyncio.set_event_loop_policy(None) + + def test_basic_await(self): + async def async_gen(): + self.assertIs(agen_obj.ag_awaiter, awaiter_obj) + yield 10 + + async def awaiter(agen): + async for x in agen: + pass + + agen_obj = async_gen() + awaiter_obj = awaiter(agen_obj) + self.assertIsNone(agen_obj.ag_awaiter) + self.loop.run_until_complete(awaiter_obj) + + def test_set_invalid_awaiter(self): + async def async_gen(): + yield "hi" + + agen_obj = async_gen() + msg = "awaiter must be None, a coroutine, or an async generator" + with self.assertRaisesRegex(TypeError, msg): + agen_obj.__set_awaiter__("testing 123") + + if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 72dc2195547..16d899ef4aa 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2489,6 +2489,24 @@ def test_get_context(self): finally: loop.close() + def test_get_awaiter(self): + ctask = getattr(tasks, '_CTask', None) + if ctask is None or not issubclass(self.Task, ctask): + self.skipTest("Only subclasses of _CTask set cr_awaiter on wrapped coroutines") + + async def coro(): + self.assertIs(coro_obj.cr_awaiter, awaiter_obj) + return "ok" + + async def awaiter(coro): + task = self.loop.create_task(coro) + return await task + + coro_obj = coro() + awaiter_obj = awaiter(coro_obj) + self.assertIsNone(coro_obj.cr_awaiter) + self.assertEqual(self.loop.run_until_complete(awaiter_obj), "ok") + self.assertIsNone(coro_obj.cr_awaiter) def add_subclass_tests(cls): BaseTask = cls.Task @@ -3237,6 +3255,22 @@ async def coro(s): # NameError should not happen: self.one_loop.call_exception_handler.assert_not_called() + def test_propagate_awaiter(self): + async def coro(idx): + self.assertIs(coro_objs[idx].cr_awaiter, awaiter_obj) + return "ok" + + async def awaiter(coros): + tasks = [self.one_loop.create_task(c) for c in coros] + return await asyncio.gather(*tasks) + + coro_objs = [coro(0), coro(1)] + awaiter_obj = awaiter(coro_objs) + self.assertIsNone(coro_objs[0].cr_awaiter) + self.assertIsNone(coro_objs[1].cr_awaiter) + self.assertEqual(self.one_loop.run_until_complete(awaiter_obj), ["ok", "ok"]) + self.assertIsNone(coro_objs[0].cr_awaiter) + self.assertIsNone(coro_objs[1].cr_awaiter) class RunCoroutineThreadsafeTests(test_utils.TestCase): """Test case for asyncio.run_coroutine_threadsafe.""" @@ -3449,5 +3483,57 @@ def tearDown(self): super().tearDown() + +class GetAsyncStackTests(test_utils.TestCase): + def setUp(self): + self.loop = asyncio.new_event_loop() + asyncio.set_event_loop(None) + + def tearDown(self): + self.loop.close() + self.loop = None + asyncio.set_event_loop_policy(None) + + def check_stack(self, frames, expected_funcs): + given = [f.f_code for f in frames] + expected = [f.__code__ for f in expected_funcs] + self.assertEqual(given, expected) + + def test_single_task(self): + async def coro(): + await coro2() + + async def coro2(): + stack = asyncio.get_async_stack() + self.check_stack(stack, [coro, coro2]) + + self.loop.run_until_complete(coro()) + + def test_cross_tasks(self): + async def coro(): + t = asyncio.ensure_future(coro2()) + await t + + async def coro2(): + t = asyncio.ensure_future(coro3()) + await t + + async def coro3(): + stack = asyncio.get_async_stack() + self.check_stack(stack, [coro, coro2, coro3]) + + self.loop.run_until_complete(coro()) + + def test_cross_gather(self): + async def coro(): + await asyncio.gather(coro2(), coro2()) + + async def coro2(): + stack = asyncio.get_async_stack() + self.check_stack(stack, [coro, coro2]) + + self.loop.run_until_complete(coro()) + + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index d848bfbd46c..3d0fd9322d9 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -2474,5 +2474,74 @@ async def foo(): self.assertEqual(foo().send(None), 1) + +class CoroutineAwaiterTest(unittest.TestCase): + def test_basic_await(self): + async def coro(): + self.assertIs(coro_obj.cr_awaiter, awaiter_obj) + return "success" + + async def awaiter(): + return await coro_obj + + coro_obj = coro() + awaiter_obj = awaiter() + self.assertIsNone(coro_obj.cr_awaiter) + self.assertEqual(run_async(awaiter_obj), ([], "success")) + + class FakeFuture: + def __await__(self): + return iter(["future"]) + + def test_coro_outlives_awaiter(self): + async def coro(): + await self.FakeFuture() + + async def awaiter(cr): + await cr + + coro_obj = coro() + self.assertIsNone(coro_obj.cr_awaiter) + awaiter_obj = awaiter(coro_obj) + self.assertIsNone(coro_obj.cr_awaiter) + + v1 = awaiter_obj.send(None) + self.assertEqual(v1, "future") + self.assertIs(coro_obj.cr_awaiter, awaiter_obj) + + awaiter_id = id(awaiter_obj) + del awaiter_obj + self.assertEqual(id(coro_obj.cr_awaiter), awaiter_id) + + def test_async_gen_awaiter(self): + async def coro(): + self.assertIs(coro_obj.cr_awaiter, agen) + await self.FakeFuture() + + async def async_gen(cr): + await cr + yield "hi" + + coro_obj = coro() + self.assertIsNone(coro_obj.cr_awaiter) + agen = async_gen(coro_obj) + self.assertIsNone(coro_obj.cr_awaiter) + + v1 = agen.asend(None).send(None) + self.assertEqual(v1, "future") + + def test_set_invalid_awaiter(self): + async def coro(): + return True + + coro_obj = coro() + msg = "awaiter must be None, a coroutine, or an async generator" + with self.assertRaisesRegex(TypeError, msg): + coro_obj.__set_awaiter__("testing 123") + run_async(coro_obj) + + + + if __name__=="__main__": unittest.main() diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 5aad99d50a1..5b95a9b8f10 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -1504,7 +1504,7 @@ def bar(cls): check(bar, size('PP')) # generator def get_gen(): yield 1 - check(get_gen(), size('PP5P4c7P2ic??2P')) + check(get_gen(), size('P4P3cPc7P2ic??2P')) # iterator check(iter('abc'), size('lP')) # callable-iterator @@ -1592,7 +1592,7 @@ def delx(self): del self.__x check(int, s) # class s = vsize(fmt + # PyTypeObject - '4P' # PyAsyncMethods + '5P' # PyAsyncMethods '36P' # PyNumberMethods '3P' # PyMappingMethods '10P' # PySequenceMethods diff --git a/Misc/ACKS b/Misc/ACKS index 88bac0a8749..4bb3349a7f2 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1356,6 +1356,7 @@ Noah Oxer Joonas Paalasmaa Yaroslav Pankovych Martin Packman +Matt Page Elisha Paine Shriphani Palakodety Julien Palard diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 2bafa04d4df..0c133fbaefb 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1657,6 +1657,14 @@ FutureIter_am_send(futureiterobject *it, return PYGEN_ERROR; } +static int +FutureIter_set_awaiter(futureiterobject *it, PyObject *awaiter) { + if (it->future != NULL) { + _PyAwaitable_SetAwaiter((PyObject *)it->future, awaiter); + } + return 0; +} + static PyObject * FutureIter_iternext(futureiterobject *it) { @@ -1798,6 +1806,7 @@ static PyType_Slot FutureIter_slots[] = { // async methods {Py_am_send, (sendfunc)FutureIter_am_send}, + {Py_am_set_awaiter, (setawaiterfunc) FutureIter_set_awaiter}, {0, NULL}, }; @@ -2665,6 +2674,15 @@ TaskObj_finalize(TaskObj *task) static void TaskObj_dealloc(PyObject *); /* Needs Task_CheckExact */ +static int +TaskObj_set_awaiter(TaskObj *task, PyObject *awaiter) +{ + if (task->task_coro == NULL) { + return 0; + } + return _PyAwaitable_SetAwaiter(task->task_coro, awaiter); +} + static PyMethodDef TaskType_methods[] = { _ASYNCIO_FUTURE_RESULT_METHODDEF _ASYNCIO_FUTURE_EXCEPTION_METHODDEF @@ -2723,6 +2741,7 @@ static PyType_Slot Task_slots[] = { // async slots {Py_am_await, (unaryfunc)future_new_iter}, + {Py_am_set_awaiter, (setawaiterfunc) TaskObj_set_awaiter}, {0, NULL}, }; diff --git a/Objects/genobject.c b/Objects/genobject.c index 9908da9002b..e7a8f9bdab4 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -61,6 +61,7 @@ gen_traverse(PyGenObject *gen, visitproc visit, void *arg) return err; } } + Py_VISIT(gen->gi_ci_awaiter); /* No need to visit cr_origin, because it's just tuples/str/int, so can't participate in a reference cycle. */ return exc_state_traverse(&gen->gi_exc_state, visit, arg); @@ -76,6 +77,16 @@ _PyGen_Finalize(PyObject *self) return; } + if (PyCoro_CheckExact(self)) { + /* If we're suspended in an `await`, remove us as the awaiter of the + * target awaitable. */ + PyObject *yf = _PyGen_yf(gen); + if (yf) { + _PyAwaitable_SetAwaiter(yf, NULL); + Py_DECREF(yf); + } + } + if (PyAsyncGen_CheckExact(self)) { PyAsyncGenObject *agen = (PyAsyncGenObject*)self; PyObject *finalizer = agen->ag_origin_or_finalizer; @@ -157,6 +168,7 @@ gen_dealloc(PyGenObject *gen) Py_CLEAR(gen->gi_name); Py_CLEAR(gen->gi_qualname); _PyErr_ClearExcState(&gen->gi_exc_state); + Py_CLEAR(gen->gi_ci_awaiter); PyObject_GC_Del(gen); } @@ -252,6 +264,10 @@ gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult, !PyErr_ExceptionMatches(PyExc_StopAsyncIteration)); } + /* Avoid holding on to the reference to the awaiter any longer than + necessary */ + Py_CLEAR(gen->gi_ci_awaiter); + /* generator can't be rerun, so release the frame */ /* first clean reference cycle through stored exception traceback */ _PyErr_ClearExcState(&gen->gi_exc_state); @@ -823,6 +839,7 @@ static PyAsyncMethods gen_as_async = { 0, /* am_aiter */ 0, /* am_anext */ (sendfunc)PyGen_am_send, /* am_send */ + 0, /* am_set_awaiter */ }; @@ -897,6 +914,7 @@ make_gen(PyTypeObject *type, PyFunctionObject *func) gen->gi_name = Py_NewRef(func->func_name); assert(func->func_qualname != NULL); gen->gi_qualname = Py_NewRef(func->func_qualname); + gen->gi_ci_awaiter = NULL; _PyObject_GC_TRACK(gen); return (PyObject *)gen; } @@ -1096,6 +1114,33 @@ coro_get_cr_await(PyCoroObject *coro, void *Py_UNUSED(ignored)) return yf; } +/* Awaiters are only set on coroutines or async generators */ +static PyObject * +get_awaiter(PyGenObject *gen, void *Py_UNUSED(ignored)) +{ + PyObject *awaiter = gen->gi_ci_awaiter; + if (awaiter == NULL) { + Py_RETURN_NONE; + } + Py_INCREF(awaiter); + return awaiter; +} + +static int +set_awaiter(PyGenObject *gen, PyObject *awaiter) +{ + // awaiter must be null, an async generator, a coroutine, or None + if ((awaiter != NULL) && !(PyAsyncGen_CheckExact(awaiter) || PyCoro_CheckExact(awaiter) || (awaiter == Py_None))) { + PyErr_Format(PyExc_TypeError, "awaiter must be None, a coroutine, or an async generator, not %R", Py_TYPE(awaiter)); + return -1; + } + if (gen->gi_frame_state < FRAME_COMPLETED) { + Py_XINCREF(awaiter); + Py_XSETREF(gen->gi_ci_awaiter, awaiter); + } + return 0; +} + static PyObject * cr_getsuspended(PyCoroObject *coro, void *Py_UNUSED(ignored)) { @@ -1138,6 +1183,8 @@ static PyGetSetDef coro_getsetlist[] = { {"cr_frame", (getter)cr_getframe, NULL, NULL}, {"cr_code", (getter)cr_getcode, NULL, NULL}, {"cr_suspended", (getter)cr_getsuspended, NULL, NULL}, + {"cr_ci_awaiter", (getter)get_awaiter, NULL, NULL}, + {"cr_awaiter", (getter)get_awaiter, NULL, NULL}, {NULL} /* Sentinel */ }; @@ -1176,6 +1223,7 @@ static PyAsyncMethods coro_as_async = { 0, /* am_aiter */ 0, /* am_anext */ (sendfunc)PyGen_am_send, /* am_send */ + (setawaiterfunc)set_awaiter, /* am_set_awaiter */ }; PyTypeObject PyCoro_Type = { @@ -1552,6 +1600,7 @@ static PyGetSetDef async_gen_getsetlist[] = { {"ag_frame", (getter)ag_getframe, NULL, NULL}, {"ag_code", (getter)ag_getcode, NULL, NULL}, {"ag_suspended", (getter)ag_getsuspended, NULL, NULL}, + {"ag_awaiter", (getter)get_awaiter, NULL, NULL}, {NULL} /* Sentinel */ }; @@ -1591,6 +1640,7 @@ static PyAsyncMethods async_gen_as_async = { PyObject_SelfIter, /* am_aiter */ (unaryfunc)async_gen_anext, /* am_anext */ (sendfunc)PyGen_am_send, /* am_send */ + (setawaiterfunc)set_awaiter, /* am_set_awaiter */ }; @@ -1872,12 +1922,18 @@ static PyMethodDef async_gen_asend_methods[] = { {NULL, NULL} /* Sentinel */ }; +static int +async_gen_asend_set_awaiter(PyAsyncGenASend *o, PyObject *awaiter) +{ + return set_awaiter((PyGenObject *) o->ags_gen, awaiter); +} static PyAsyncMethods async_gen_asend_as_async = { PyObject_SelfIter, /* am_await */ 0, /* am_aiter */ 0, /* am_anext */ 0, /* am_send */ + (setawaiterfunc)async_gen_asend_set_awaiter, /* am_set_awaiter */ }; @@ -2324,6 +2380,7 @@ static PyAsyncMethods async_gen_athrow_as_async = { 0, /* am_aiter */ 0, /* am_anext */ 0, /* am_send */ + 0, /* am_set_awaiter */ }; diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 7cb17a6ca4a..e041d7341d4 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -461,6 +461,7 @@ static PyAsyncMethods anextawaitable_as_async = { 0, /* am_aiter */ 0, /* am_anext */ 0, /* am_send */ + 0, /* am_set_awaiter */ }; PyTypeObject _PyAnextAwaitable_Type = { diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 4b63b20bc2c..966738a9f55 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6861,6 +6861,7 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base) COPYASYNC(am_await); COPYASYNC(am_aiter); COPYASYNC(am_anext); + COPYASYNC(am_set_awaiter); } if (type->tp_as_sequence != NULL && base->tp_as_sequence != NULL) { @@ -9367,6 +9368,39 @@ slot_am_anext(PyObject *self) return NULL; } +static PyObject * +wrap_setawaiterfunc(PyObject *self, PyObject *args, void *wrapped) +{ + setawaiterfunc func = (setawaiterfunc)wrapped; + PyObject *other; + + if (!check_num_args(args, 1)) + return NULL; + other = PyTuple_GET_ITEM(args, 0); + if ((*func)(self, other) < 0) { + return NULL; + } + Py_RETURN_NONE; +} + +static PyObject * +slot_am_set_awaiter(PyObject *self, PyObject *awaiter) +{ + int unbound; + PyObject *func = NULL, *res = NULL; + func = lookup_maybe_method(self, &_Py_ID(__set_awaiter__), &unbound); + if (func != NULL) { + PyObject *args[2] = {self, awaiter}; + res = vectorcall_unbound(_PyThreadState_GET(), unbound, func, args, 2); + Py_DECREF(func); + return res; + } + PyErr_Format(PyExc_AttributeError, + "object %.50s does not have __set_awaiter__ method", + Py_TYPE(self)->tp_name); + return NULL; +} + /* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper functions. @@ -9496,6 +9530,8 @@ static pytype_slotdef slotdefs[] = { "__aiter__($self, /)\n--\n\nReturn an awaitable, that resolves in asynchronous iterator."), AMSLOT(__anext__, am_anext, slot_am_anext, wrap_unaryfunc, "__anext__($self, /)\n--\n\nReturn a value or raise StopAsyncIteration."), + AMSLOT(__set_awaiter__, am_set_awaiter, slot_am_set_awaiter, wrap_setawaiterfunc, + "__set_awaiter__($self, awaiter)\n--\n\nSet or forward awaiter."), BINSLOT(__add__, nb_add, slot_nb_add, "+"), diff --git a/Objects/typeslots.inc b/Objects/typeslots.inc index 896daa7d806..2b6c6a9e98c 100644 --- a/Objects/typeslots.inc +++ b/Objects/typeslots.inc @@ -80,3 +80,4 @@ {offsetof(PyAsyncMethods, am_anext), offsetof(PyTypeObject, tp_as_async)}, {-1, offsetof(PyTypeObject, tp_finalize)}, {offsetof(PyAsyncMethods, am_send), offsetof(PyTypeObject, tp_as_async)}, +{offsetof(PyAsyncMethods, am_set_awaiter), offsetof(PyTypeObject, tp_as_async)}, diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 3a7bafeb416..77b38a746b0 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -836,6 +836,13 @@ dummy_func( DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ assert(frame != &entry_frame); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + int st = _PyAwaitable_SetAwaiter(receiver, (PyObject *) _PyFrame_GetGenerator(frame)); + if (st < 0) { + goto error; + } + } if ((tstate->interp->eval_frame == NULL) && (Py_TYPE(receiver) == &PyGen_Type || Py_TYPE(receiver) == &PyCoro_Type) && ((PyGenObject *)receiver)->gi_frame_state < FRAME_EXECUTING) @@ -880,6 +887,13 @@ dummy_func( Py_TYPE(gen) != &PyCoro_Type, SEND); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, SEND); STAT_INC(SEND, hit); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + int st = _PyAwaitable_SetAwaiter(receiver, (PyObject *)gen); + if (st < 0) { + goto error; + } + } _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; frame->return_offset = oparg; STACK_SHRINK(1); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 952fc553229..6ad65f2ba67 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -8,6 +8,7 @@ } TARGET(RESUME) { + #line 139 "Python/bytecodes.c" assert(tstate->cframe == &cframe); assert(frame == cframe.current_frame); /* Possibly combine this with eval breaker */ @@ -19,10 +20,12 @@ else if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) { goto handle_eval_breaker; } + #line 24 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_RESUME) { + #line 153 "Python/bytecodes.c" /* Possible performance enhancement: * We need to check the eval breaker anyway, can we * combine the instrument verison check and the eval breaker test? @@ -48,15 +51,18 @@ goto handle_eval_breaker; } } + #line 55 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_CLOSURE) { PyObject *value; + #line 181 "Python/bytecodes.c" /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */ value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; Py_INCREF(value); + #line 66 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -64,9 +70,11 @@ TARGET(LOAD_FAST_CHECK) { PyObject *value; + #line 188 "Python/bytecodes.c" value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; Py_INCREF(value); + #line 78 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -74,9 +82,11 @@ TARGET(LOAD_FAST) { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 90 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -84,9 +94,11 @@ TARGET(LOAD_FAST_AND_CLEAR) { PyObject *value; + #line 200 "Python/bytecodes.c" value = GETLOCAL(oparg); // do not use SETLOCAL here, it decrefs the old value GETLOCAL(oparg) = NULL; + #line 102 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -95,8 +107,10 @@ TARGET(LOAD_CONST) { PREDICTED(LOAD_CONST); PyObject *value; + #line 206 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); + #line 114 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -104,7 +118,9 @@ TARGET(STORE_FAST) { PyObject *value = stack_pointer[-1]; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 124 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -114,17 +130,21 @@ PyObject *_tmp_2; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 138 "Python/generated_cases.c.h" _tmp_2 = value; } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 148 "Python/generated_cases.c.h" _tmp_1 = value; } STACK_GROW(2); @@ -138,16 +158,20 @@ PyObject *_tmp_2; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 166 "Python/generated_cases.c.h" _tmp_2 = value; } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 206 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); + #line 175 "Python/generated_cases.c.h" _tmp_1 = value; } STACK_GROW(2); @@ -160,14 +184,18 @@ PyObject *_tmp_1 = stack_pointer[-1]; { PyObject *value = _tmp_1; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 190 "Python/generated_cases.c.h" } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 199 "Python/generated_cases.c.h" _tmp_1 = value; } stack_pointer[-1] = _tmp_1; @@ -179,12 +207,16 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 213 "Python/generated_cases.c.h" } oparg = (next_instr++)->op.arg; { PyObject *value = _tmp_2; + #line 211 "Python/bytecodes.c" SETLOCAL(oparg, value); + #line 220 "Python/generated_cases.c.h" } STACK_SHRINK(2); DISPATCH(); @@ -195,16 +227,20 @@ PyObject *_tmp_2; { PyObject *value; + #line 206 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); + #line 234 "Python/generated_cases.c.h" _tmp_2 = value; } oparg = (next_instr++)->op.arg; { PyObject *value; + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); + #line 244 "Python/generated_cases.c.h" _tmp_1 = value; } STACK_GROW(2); @@ -215,6 +251,8 @@ TARGET(POP_TOP) { PyObject *value = stack_pointer[-1]; + #line 221 "Python/bytecodes.c" + #line 256 "Python/generated_cases.c.h" Py_DECREF(value); STACK_SHRINK(1); DISPATCH(); @@ -222,7 +260,9 @@ TARGET(PUSH_NULL) { PyObject *res; + #line 225 "Python/bytecodes.c" res = NULL; + #line 266 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -233,10 +273,14 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; + #line 221 "Python/bytecodes.c" + #line 278 "Python/generated_cases.c.h" Py_DECREF(value); } { PyObject *value = _tmp_2; + #line 221 "Python/bytecodes.c" + #line 284 "Python/generated_cases.c.h" Py_DECREF(value); } STACK_SHRINK(2); @@ -246,6 +290,7 @@ TARGET(INSTRUMENTED_END_FOR) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 231 "Python/bytecodes.c" /* Need to create a fake StopIteration error here, * to conform to PEP 380 */ if (PyGen_Check(receiver)) { @@ -255,6 +300,7 @@ } PyErr_SetRaisedException(NULL); } + #line 304 "Python/generated_cases.c.h" Py_DECREF(receiver); Py_DECREF(value); STACK_SHRINK(2); @@ -264,7 +310,9 @@ TARGET(END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 244 "Python/bytecodes.c" Py_DECREF(receiver); + #line 316 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; DISPATCH(); @@ -273,6 +321,7 @@ TARGET(INSTRUMENTED_END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 248 "Python/bytecodes.c" if (PyGen_Check(receiver) || PyCoro_CheckExact(receiver)) { PyErr_SetObject(PyExc_StopIteration, value); if (monitor_stop_iteration(tstate, frame, next_instr-1)) { @@ -281,6 +330,7 @@ PyErr_SetRaisedException(NULL); } Py_DECREF(receiver); + #line 334 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; DISPATCH(); @@ -289,9 +339,13 @@ TARGET(UNARY_NEGATIVE) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 259 "Python/bytecodes.c" res = PyNumber_Negative(value); + #line 345 "Python/generated_cases.c.h" Py_DECREF(value); + #line 261 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; + #line 349 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -299,8 +353,11 @@ TARGET(UNARY_NOT) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 265 "Python/bytecodes.c" int err = PyObject_IsTrue(value); + #line 359 "Python/generated_cases.c.h" Py_DECREF(value); + #line 267 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { res = Py_True; @@ -308,6 +365,7 @@ else { res = Py_False; } + #line 369 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -315,9 +373,13 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 277 "Python/bytecodes.c" res = PyNumber_Invert(value); + #line 379 "Python/generated_cases.c.h" Py_DECREF(value); + #line 279 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; + #line 383 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -326,6 +388,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *prod; + #line 296 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -333,6 +396,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (prod == NULL) goto pop_2_error; + #line 400 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = prod; next_instr += 1; @@ -343,12 +407,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *prod; + #line 306 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); double dprod = ((PyFloatObject *)left)->ob_fval * ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dprod, prod); + #line 418 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = prod; next_instr += 1; @@ -359,6 +425,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sub; + #line 315 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -366,6 +433,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (sub == NULL) goto pop_2_error; + #line 437 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sub; next_instr += 1; @@ -376,11 +444,13 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sub; + #line 325 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); double dsub = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dsub, sub); + #line 454 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sub; next_instr += 1; @@ -391,6 +461,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 333 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -398,6 +469,7 @@ _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc); if (res == NULL) goto pop_2_error; + #line 473 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -407,6 +479,7 @@ TARGET(BINARY_OP_INPLACE_ADD_UNICODE) { PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; + #line 349 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; @@ -433,6 +506,7 @@ if (*target_local == NULL) goto pop_2_error; // The STORE_FAST is already done. JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1); + #line 510 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -441,12 +515,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sum; + #line 378 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); double dsum = ((PyFloatObject *)left)->ob_fval + ((PyFloatObject *)right)->ob_fval; DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dsum, sum); + #line 526 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sum; next_instr += 1; @@ -457,6 +533,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sum; + #line 387 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -464,6 +541,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); if (sum == NULL) goto pop_2_error; + #line 545 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = sum; next_instr += 1; @@ -476,6 +554,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; + #line 405 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -487,9 +566,12 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ res = PyObject_GetItem(container, sub); + #line 570 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); + #line 417 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 575 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -501,6 +583,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; + #line 421 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -513,6 +596,7 @@ } Py_DECREF(container); if (res == NULL) goto pop_3_error; + #line 600 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = res; DISPATCH(); @@ -523,6 +607,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; + #line 436 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -535,6 +620,7 @@ Py_DECREF(v); Py_DECREF(container); if (err) goto pop_4_error; + #line 624 "Python/generated_cases.c.h" STACK_SHRINK(4); DISPATCH(); } @@ -543,6 +629,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; + #line 451 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -556,6 +643,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); + #line 647 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -566,6 +654,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; + #line 467 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -579,6 +668,7 @@ Py_INCREF(res); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(tuple); + #line 672 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -589,6 +679,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; + #line 483 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -596,11 +687,14 @@ if (!_PyErr_Occurred(tstate)) { _PyErr_SetKeyError(sub); } + #line 691 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); + #line 491 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub + #line 698 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); STACK_SHRINK(1); @@ -612,6 +706,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; + #line 498 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -634,12 +729,15 @@ JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 733 "Python/generated_cases.c.h" } TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; + #line 523 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; + #line 741 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -648,9 +746,13 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; + #line 528 "Python/bytecodes.c" int err = PySet_Add(set, v); + #line 752 "Python/generated_cases.c.h" Py_DECREF(v); + #line 530 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 756 "Python/generated_cases.c.h" STACK_SHRINK(1); PREDICT(JUMP_BACKWARD); DISPATCH(); @@ -663,6 +765,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); + #line 541 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -677,10 +780,13 @@ #endif /* ENABLE_SPECIALIZATION */ /* container[sub] = v */ int err = PyObject_SetItem(container, sub, v); + #line 784 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); + #line 556 "Python/bytecodes.c" if (err) goto pop_3_error; + #line 790 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -690,6 +796,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; + #line 560 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -706,6 +813,7 @@ Py_DECREF(old_value); _Py_DECREF_SPECIALIZED(sub, (destructor)PyObject_Free); Py_DECREF(list); + #line 817 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -715,11 +823,13 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; + #line 579 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); Py_DECREF(dict); if (err) goto pop_3_error; + #line 833 "Python/generated_cases.c.h" STACK_SHRINK(3); next_instr += 1; DISPATCH(); @@ -728,11 +838,15 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; + #line 587 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); + #line 845 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); + #line 590 "Python/bytecodes.c" if (err) goto pop_2_error; + #line 850 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -740,10 +854,14 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; + #line 594 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); + #line 861 "Python/generated_cases.c.h" Py_DECREF(value); + #line 597 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; + #line 865 "Python/generated_cases.c.h" stack_pointer[-1] = res; DISPATCH(); } @@ -752,11 +870,15 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; + #line 601 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); + #line 877 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); + #line 604 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 882 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -764,6 +886,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); + #line 608 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -785,10 +908,12 @@ break; } if (true) { STACK_SHRINK(oparg); goto error; } + #line 912 "Python/generated_cases.c.h" } TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; + #line 632 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); STACK_SHRINK(1); // Since we're not going to DISPATCH() @@ -799,10 +924,12 @@ assert(!_PyErr_Occurred(tstate)); tstate->c_recursion_remaining += PY_EVAL_C_STACK_UNITS; return retval; + #line 928 "Python/generated_cases.c.h" } TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 645 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -815,10 +942,12 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 946 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 660 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -835,9 +964,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 968 "Python/generated_cases.c.h" } TARGET(RETURN_CONST) { + #line 679 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -851,9 +982,11 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 986 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_RETURN_CONST) { + #line 695 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -871,11 +1004,13 @@ frame->prev_instr += frame->return_offset; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 1008 "Python/generated_cases.c.h" } TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; + #line 715 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -888,12 +1023,16 @@ "'async for' requires an object with " "__aiter__ method, got %.100s", type->tp_name); + #line 1027 "Python/generated_cases.c.h" Py_DECREF(obj); + #line 728 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); + #line 1034 "Python/generated_cases.c.h" Py_DECREF(obj); + #line 733 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -906,6 +1045,7 @@ Py_DECREF(iter); if (true) goto pop_1_error; } + #line 1049 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -913,6 +1053,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; + #line 748 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -956,6 +1097,7 @@ } } + #line 1101 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = awaitable; PREDICT(LOAD_CONST); @@ -966,13 +1108,16 @@ PREDICTED(GET_AWAITABLE); PyObject *iterable = stack_pointer[-1]; PyObject *iter; + #line 795 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { format_awaitable_error(tstate, Py_TYPE(iterable), oparg); } + #line 1119 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 802 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -990,6 +1135,7 @@ if (iter == NULL) goto pop_1_error; + #line 1139 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -1001,6 +1147,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; + #line 828 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1012,6 +1159,13 @@ DECREMENT_ADAPTIVE_COUNTER(cache->counter); #endif /* ENABLE_SPECIALIZATION */ assert(frame != &entry_frame); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + int st = _PyAwaitable_SetAwaiter(receiver, (PyObject *) _PyFrame_GetGenerator(frame)); + if (st < 0) { + goto error; + } + } if ((tstate->interp->eval_frame == NULL) && (Py_TYPE(receiver) == &PyGen_Type || Py_TYPE(receiver) == &PyCoro_Type) && ((PyGenObject *)receiver)->gi_frame_state < FRAME_EXECUTING) @@ -1047,6 +1201,7 @@ } } Py_DECREF(v); + #line 1205 "Python/generated_cases.c.h" stack_pointer[-1] = retval; next_instr += 1; DISPATCH(); @@ -1055,12 +1210,20 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; + #line 884 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && Py_TYPE(gen) != &PyCoro_Type, SEND); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, SEND); STAT_INC(SEND, hit); + if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && + (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { + int st = _PyAwaitable_SetAwaiter(receiver, (PyObject *)gen); + if (st < 0) { + goto error; + } + } _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; frame->return_offset = oparg; STACK_SHRINK(1); @@ -1070,10 +1233,12 @@ tstate->exc_info = &gen->gi_exc_state; JUMPBY(INLINE_CACHE_ENTRIES_SEND); DISPATCH_INLINED(gen_frame); + #line 1237 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 909 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1090,10 +1255,12 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 1259 "Python/generated_cases.c.h" } TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; + #line 928 "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. @@ -1109,12 +1276,15 @@ gen_frame->previous = NULL; _PyFrame_StackPush(frame, retval); goto resume_frame; + #line 1280 "Python/generated_cases.c.h" } TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; + #line 946 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); + #line 1288 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1122,6 +1292,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); + #line 951 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1140,15 +1311,19 @@ _PyErr_SetRaisedException(tstate, exc); monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; + #line 1315 "Python/generated_cases.c.h" } TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; + #line 972 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { + #line 1324 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); + #line 975 "Python/bytecodes.c" } else { Py_INCREF(exc); @@ -1156,6 +1331,7 @@ monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; } + #line 1335 "Python/generated_cases.c.h" STACK_SHRINK(2); DISPATCH(); } @@ -1166,13 +1342,16 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; + #line 985 "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 1351 "Python/generated_cases.c.h" Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); + #line 990 "Python/bytecodes.c" none = Py_None; } else { @@ -1180,6 +1359,7 @@ monitor_reraise(tstate, frame, next_instr-1); goto exception_unwind; } + #line 1363 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = value; stack_pointer[-2] = none; @@ -1188,7 +1368,9 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; + #line 1000 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); + #line 1374 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1196,6 +1378,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; + #line 1004 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1217,6 +1400,7 @@ if (true) goto error; } } + #line 1404 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = bc; DISPATCH(); @@ -1224,26 +1408,33 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; + #line 1029 "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 1419 "Python/generated_cases.c.h" Py_DECREF(v); + #line 1036 "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 1428 "Python/generated_cases.c.h" Py_DECREF(v); + #line 1043 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 1432 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_NAME) { + #line 1047 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1260,6 +1451,7 @@ name); goto error; } + #line 1455 "Python/generated_cases.c.h" DISPATCH(); } @@ -1267,6 +1459,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; + #line 1073 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1279,8 +1472,11 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject **top = stack_pointer + oparg - 1; int res = unpack_iterable(tstate, seq, oparg, -1, top); + #line 1476 "Python/generated_cases.c.h" Py_DECREF(seq); + #line 1086 "Python/bytecodes.c" if (res == 0) goto pop_1_error; + #line 1480 "Python/generated_cases.c.h" STACK_SHRINK(1); STACK_GROW(oparg); next_instr += 1; @@ -1290,12 +1486,14 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); + #line 1090 "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 1497 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1306,6 +1504,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); + #line 1100 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1313,6 +1512,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } + #line 1516 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1323,6 +1523,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); + #line 1111 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1330,6 +1531,7 @@ for (int i = oparg; --i >= 0; ) { *values++ = Py_NewRef(items[i]); } + #line 1535 "Python/generated_cases.c.h" Py_DECREF(seq); STACK_SHRINK(1); STACK_GROW(oparg); @@ -1339,11 +1541,15 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; + #line 1122 "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 1549 "Python/generated_cases.c.h" Py_DECREF(seq); + #line 1126 "Python/bytecodes.c" if (res == 0) goto pop_1_error; + #line 1553 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); DISPATCH(); } @@ -1354,6 +1560,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); + #line 1137 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1369,9 +1576,12 @@ #endif /* ENABLE_SPECIALIZATION */ PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, v); + #line 1580 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); + #line 1153 "Python/bytecodes.c" if (err) goto pop_2_error; + #line 1585 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -1379,25 +1589,34 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; + #line 1157 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); + #line 1596 "Python/generated_cases.c.h" Py_DECREF(owner); + #line 1160 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 1600 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; + #line 1164 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); + #line 1610 "Python/generated_cases.c.h" Py_DECREF(v); + #line 1167 "Python/bytecodes.c" if (err) goto pop_1_error; + #line 1614 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(DELETE_GLOBAL) { + #line 1171 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1409,11 +1628,13 @@ } goto error; } + #line 1632 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_LOCALS) { PyObject *locals; + #line 1185 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1421,6 +1642,7 @@ if (true) goto error; } Py_INCREF(locals); + #line 1646 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = locals; DISPATCH(); @@ -1429,6 +1651,7 @@ TARGET(LOAD_FROM_DICT_OR_GLOBALS) { PyObject *mod_or_class_dict = stack_pointer[-1]; PyObject *v; + #line 1195 "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); @@ -1490,6 +1713,7 @@ } } } + #line 1717 "Python/generated_cases.c.h" Py_DECREF(mod_or_class_dict); stack_pointer[-1] = v; DISPATCH(); @@ -1497,6 +1721,7 @@ TARGET(LOAD_NAME) { PyObject *v; + #line 1260 "Python/bytecodes.c" PyObject *mod_or_class_dict = LOCALS(); if (mod_or_class_dict == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1556,6 +1781,7 @@ } } } + #line 1785 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = v; DISPATCH(); @@ -1566,6 +1792,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; + #line 1328 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1617,6 +1844,7 @@ } } null = NULL; + #line 1848 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = v; @@ -1630,6 +1858,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); + #line 1382 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1653,6 +1882,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; + #line 1886 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1667,6 +1897,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 1408 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1695,6 +1926,7 @@ Py_INCREF(res); STAT_INC(LOAD_GLOBAL, hit); null = NULL; + #line 1930 "Python/generated_cases.c.h" STACK_GROW(1); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -1704,13 +1936,16 @@ } TARGET(DELETE_FAST) { + #line 1439 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); + #line 1944 "Python/generated_cases.c.h" DISPATCH(); } TARGET(MAKE_CELL) { + #line 1445 "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); @@ -1719,10 +1954,12 @@ goto resume_with_error; } SETLOCAL(oparg, cell); + #line 1958 "Python/generated_cases.c.h" DISPATCH(); } TARGET(DELETE_DEREF) { + #line 1456 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1733,12 +1970,14 @@ } PyCell_SET(cell, NULL); Py_DECREF(oldobj); + #line 1974 "Python/generated_cases.c.h" DISPATCH(); } TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; + #line 1469 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -1771,12 +2010,14 @@ Py_INCREF(value); } Py_DECREF(class_dict); + #line 2014 "Python/generated_cases.c.h" stack_pointer[-1] = value; DISPATCH(); } TARGET(LOAD_DEREF) { PyObject *value; + #line 1504 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -1784,6 +2025,7 @@ if (true) goto error; } Py_INCREF(value); + #line 2029 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = value; DISPATCH(); @@ -1791,15 +2033,18 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; + #line 1514 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); Py_XDECREF(oldobj); + #line 2042 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(COPY_FREE_VARS) { + #line 1521 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -1810,17 +2055,22 @@ PyObject *o = PyTuple_GET_ITEM(closure, i); frame->localsplus[offset + i] = Py_NewRef(o); } + #line 2059 "Python/generated_cases.c.h" DISPATCH(); } TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; + #line 1534 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); + #line 2068 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } + #line 1536 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } + #line 2074 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = str; @@ -1830,8 +2080,10 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; + #line 1540 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } + #line 2087 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = tup; @@ -1841,8 +2093,10 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; + #line 1545 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } + #line 2100 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = list; @@ -1852,6 +2106,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; + #line 1550 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -1862,10 +2117,13 @@ "Value after * must be an iterable, not %.200s", Py_TYPE(iterable)->tp_name); } + #line 2121 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 1561 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); + #line 2127 "Python/generated_cases.c.h" Py_DECREF(iterable); STACK_SHRINK(1); DISPATCH(); @@ -1874,9 +2132,13 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; + #line 1568 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); + #line 2138 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 1570 "Python/bytecodes.c" if (err < 0) goto pop_1_error; + #line 2142 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } @@ -1884,6 +2146,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; + #line 1574 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -1898,6 +2161,7 @@ Py_DECREF(set); if (true) { STACK_SHRINK(oparg); goto error; } } + #line 2165 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_GROW(1); stack_pointer[-1] = set; @@ -1907,14 +2171,18 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; + #line 1591 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, oparg); + #line 2180 "Python/generated_cases.c.h" for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } + #line 1596 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } + #line 2186 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); STACK_GROW(1); stack_pointer[-1] = map; @@ -1922,6 +2190,7 @@ } TARGET(SETUP_ANNOTATIONS) { + #line 1600 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -1961,6 +2230,7 @@ Py_DECREF(ann_dict); } } + #line 2234 "Python/generated_cases.c.h" DISPATCH(); } @@ -1968,6 +2238,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; + #line 1642 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1977,11 +2248,14 @@ map = _PyDict_FromItems( &PyTuple_GET_ITEM(keys, 0), 1, values, 1, oparg); + #line 2252 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(values[_i]); } Py_DECREF(keys); + #line 1652 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } + #line 2259 "Python/generated_cases.c.h" STACK_SHRINK(oparg); stack_pointer[-1] = map; DISPATCH(); @@ -1989,6 +2263,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; + #line 1656 "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)) { @@ -1996,9 +2271,12 @@ "'%.200s' object is not a mapping", Py_TYPE(update)->tp_name); } + #line 2275 "Python/generated_cases.c.h" Py_DECREF(update); + #line 1664 "Python/bytecodes.c" if (true) goto pop_1_error; } + #line 2280 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); DISPATCH(); @@ -2006,13 +2284,17 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; + #line 1670 "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 2293 "Python/generated_cases.c.h" Py_DECREF(update); + #line 1675 "Python/bytecodes.c" if (true) goto pop_1_error; } + #line 2298 "Python/generated_cases.c.h" Py_DECREF(update); STACK_SHRINK(1); PREDICT(CALL_FUNCTION_EX); @@ -2022,22 +2304,26 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; + #line 1682 "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 2314 "Python/generated_cases.c.h" STACK_SHRINK(2); PREDICT(JUMP_BACKWARD); DISPATCH(); } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { + #line 1691 "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 2327 "Python/generated_cases.c.h" } TARGET(LOAD_SUPER_ATTR) { @@ -2048,6 +2334,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; + #line 1705 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2089,13 +2376,16 @@ } } } + #line 2380 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); + #line 1747 "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 2389 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2110,16 +2400,20 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; + #line 1754 "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 2411 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); + #line 1761 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; + #line 2417 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2134,6 +2428,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; + #line 1765 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2156,6 +2451,7 @@ res = res2; res2 = NULL; } + #line 2455 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; stack_pointer[-2] = res2; @@ -2169,6 +2465,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; + #line 1804 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2202,7 +2499,9 @@ NULL | meth | arg1 | ... | argN */ + #line 2503 "Python/generated_cases.c.h" Py_DECREF(owner); + #line 1838 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2211,9 +2510,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); + #line 2514 "Python/generated_cases.c.h" Py_DECREF(owner); + #line 1847 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } + #line 2519 "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; } @@ -2227,6 +2529,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1852 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2239,6 +2542,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2546 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2253,6 +2557,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1868 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2278,6 +2583,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2587 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2292,6 +2598,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1897 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2342,6 +2649,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2653 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2356,6 +2664,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); + #line 1951 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2365,6 +2674,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; + #line 2678 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2379,6 +2689,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); + #line 1964 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2390,6 +2701,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); + #line 2705 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2403,6 +2715,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 1979 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2426,6 +2739,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 2743 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2433,6 +2747,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 2005 "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); @@ -2458,6 +2773,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 2777 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2465,6 +2781,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 2033 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2482,6 +2799,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); + #line 2803 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2492,6 +2810,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 2053 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2530,6 +2849,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); + #line 2853 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2540,6 +2860,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 2094 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2549,6 +2870,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); + #line 2874 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2560,6 +2882,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2113 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2572,9 +2895,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); + #line 2899 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); + #line 2126 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 2904 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2585,6 +2911,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2130 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2595,6 +2922,7 @@ _Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc); _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; + #line 2926 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2605,6 +2933,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2144 "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); @@ -2619,6 +2948,7 @@ _Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; + #line 2952 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2629,6 +2959,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; + #line 2162 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2640,6 +2971,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 2975 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2650,10 +2982,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; + #line 2176 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; + #line 2988 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); + #line 2178 "Python/bytecodes.c" b = res ? Py_True : Py_False; + #line 2993 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2663,11 +2999,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; + #line 2182 "Python/bytecodes.c" int res = PySequence_Contains(right, left); + #line 3005 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); + #line 2184 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; + #line 3011 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2678,9 +3018,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; + #line 2189 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { + #line 3024 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); + #line 2191 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2688,8 +3031,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); + #line 3035 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); + #line 2199 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2698,6 +3043,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } + #line 3047 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2707,15 +3053,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; + #line 2210 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { + #line 3060 "Python/generated_cases.c.h" Py_DECREF(right); + #line 2213 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); + #line 3067 "Python/generated_cases.c.h" Py_DECREF(right); + #line 2218 "Python/bytecodes.c" b = res ? Py_True : Py_False; + #line 3071 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2724,12 +3076,16 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; + #line 2222 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = _PyImport_ImportName( tstate, BUILTINS(), GLOBALS(), LOCALS(), name, fromlist, level); + #line 3084 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); + #line 2226 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 3089 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2739,6 +3095,7 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; + #line 2230 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (_PyImport_IsLazyImportsActive(tstate)) { res = _PyImport_LazyImportName( @@ -2747,9 +3104,12 @@ res = _PyImport_ImportName( tstate, BUILTINS(), GLOBALS(), LOCALS(), name, fromlist, level); } + #line 3108 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); + #line 2239 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 3113 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2758,6 +3118,7 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; + #line 2243 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyLazyImport_CheckExact(from)) { res = _PyImport_LazyImportFrom(tstate, from, name); @@ -2765,20 +3126,25 @@ res = _PyImport_ImportFrom(tstate, from, name); } if (res == NULL) goto error; + #line 3130 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { + #line 2253 "Python/bytecodes.c" JUMPBY(oparg); + #line 3139 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); + #line 2257 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); + #line 3148 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2786,12 +3152,15 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; + #line 2263 "Python/bytecodes.c" if (Py_IsFalse(cond)) { JUMPBY(oparg); } else if (!Py_IsTrue(cond)) { int err = PyObject_IsTrue(cond); + #line 3162 "Python/generated_cases.c.h" Py_DECREF(cond); + #line 2269 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2799,18 +3168,22 @@ if (err < 0) goto pop_1_error; } } + #line 3172 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; + #line 2279 "Python/bytecodes.c" if (Py_IsTrue(cond)) { JUMPBY(oparg); } else if (!Py_IsFalse(cond)) { int err = PyObject_IsTrue(cond); + #line 3185 "Python/generated_cases.c.h" Py_DECREF(cond); + #line 2285 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2818,50 +3191,63 @@ if (err < 0) goto pop_1_error; } } + #line 3195 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; + #line 2295 "Python/bytecodes.c" if (!Py_IsNone(value)) { + #line 3204 "Python/generated_cases.c.h" Py_DECREF(value); + #line 2297 "Python/bytecodes.c" JUMPBY(oparg); } + #line 3209 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; + #line 2302 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { + #line 3221 "Python/generated_cases.c.h" Py_DECREF(value); + #line 2307 "Python/bytecodes.c" } + #line 3225 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { + #line 2311 "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 3238 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; + #line 2320 "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 3251 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2872,13 +3258,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; + #line 2328 "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 3267 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); + #line 2333 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2886,6 +3275,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_None; // Failure! } + #line 3279 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2894,8 +3284,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; + #line 2343 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; + #line 3291 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2905,8 +3297,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; + #line 2349 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; + #line 3304 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2917,9 +3311,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; + #line 2355 "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 3319 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -2928,10 +3324,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; + #line 2361 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); + #line 3331 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 2364 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; + #line 3335 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -2939,6 +3339,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; + #line 2368 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -2961,8 +3362,11 @@ if (iter == NULL) { goto error; } + #line 3366 "Python/generated_cases.c.h" Py_DECREF(iterable); + #line 2391 "Python/bytecodes.c" } + #line 3370 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -2973,6 +3377,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2410 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3003,6 +3408,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator + #line 3412 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3010,6 +3416,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { + #line 2443 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3035,12 +3442,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); + #line 3446 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2471 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3060,6 +3469,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator + #line 3473 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3069,6 +3479,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2493 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3088,6 +3499,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator + #line 3503 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3097,6 +3509,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; + #line 2515 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3114,6 +3527,7 @@ if (next == NULL) { goto error; } + #line 3531 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3122,6 +3536,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; + #line 2535 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3137,12 +3552,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); + #line 3556 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; + #line 2553 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3165,13 +3582,16 @@ Py_DECREF(enter); goto error; } + #line 3586 "Python/generated_cases.c.h" Py_DECREF(mgr); + #line 2576 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } + #line 3595 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3183,6 +3603,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; + #line 2586 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3208,13 +3629,16 @@ Py_DECREF(enter); goto error; } + #line 3633 "Python/generated_cases.c.h" Py_DECREF(mgr); + #line 2612 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } + #line 3642 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3226,6 +3650,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; + #line 2621 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3251,6 +3676,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; + #line 3680 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3259,6 +3685,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; + #line 2649 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3268,6 +3695,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); + #line 3699 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3281,6 +3709,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 2661 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3297,6 +3726,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); + #line 3730 "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; } @@ -3310,6 +3740,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); + #line 2680 "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); @@ -3319,6 +3750,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); + #line 3754 "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; } @@ -3332,6 +3764,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); + #line 2692 "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; @@ -3345,6 +3778,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); + #line 3782 "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; } @@ -3353,13 +3787,16 @@ } TARGET(KW_NAMES) { + #line 2708 "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 3795 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { + #line 2714 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3372,6 +3809,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); + #line 3813 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3381,6 +3819,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2759 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3462,6 +3901,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 3905 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3473,6 +3913,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; + #line 2847 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3482,6 +3923,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); + #line 3927 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3490,6 +3932,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); + #line 2859 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3515,6 +3958,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 3962 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3522,6 +3966,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); + #line 2887 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3557,6 +4002,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); + #line 4006 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3564,6 +4010,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2925 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3573,6 +4020,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable + #line 4024 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3585,6 +4033,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2937 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3595,6 +4044,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4048 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3608,6 +4058,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2951 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3618,6 +4069,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4073 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3631,6 +4083,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2965 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3652,6 +4105,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4109 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3665,6 +4119,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 2990 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3692,6 +4147,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4151 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3705,6 +4161,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3021 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3736,6 +4193,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ + #line 4197 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3749,6 +4207,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3056 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3780,6 +4239,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4243 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3793,6 +4253,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3091 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3817,6 +4278,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4282 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3829,6 +4291,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3118 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -3855,6 +4318,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4322 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3866,6 +4330,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; + #line 3148 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); PyInterpreterState *interp = _PyInterpreterState_GET(); @@ -3883,12 +4348,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); + #line 4352 "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 3168 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -3919,6 +4386,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4390 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3931,6 +4399,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3202 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3959,6 +4428,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4432 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3971,6 +4441,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3234 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -3999,6 +4470,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4474 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4011,6 +4483,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; + #line 3266 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4038,6 +4511,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } + #line 4515 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4047,7 +4521,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { + #line 3297 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); + #line 4527 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4056,6 +4532,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; + #line 3301 "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)); @@ -4117,11 +4594,14 @@ } result = PyObject_Call(func, callargs, kwargs); } + #line 4598 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); + #line 3363 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } + #line 4605 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4136,6 +4616,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; + #line 3373 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4164,12 +4645,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; + #line 4649 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { + #line 3404 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4190,6 +4673,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; + #line 4677 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4197,11 +4681,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; + #line 3427 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); + #line 4687 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); + #line 3429 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } + #line 4693 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4212,6 +4700,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 3433 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4246,6 +4735,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 4739 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4254,8 +4744,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; + #line 3470 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); + #line 4751 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4267,6 +4759,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; + #line 3475 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4281,9 +4774,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); + #line 4778 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); + #line 3490 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; + #line 4783 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4293,13 +4789,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; + #line 3495 "Python/bytecodes.c" assert(oparg >= 2); + #line 4795 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { + #line 3499 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4311,20 +4810,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); + #line 4814 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { + #line 3513 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); + #line 4820 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { + #line 3517 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); + #line 4827 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { + #line 3522 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4333,10 +4838,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4842 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { + #line 3533 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4345,10 +4852,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4856 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { + #line 3544 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4360,10 +4869,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4873 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { + #line 3558 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4375,23 +4886,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); + #line 4890 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { + #line 3572 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); + #line 4901 "Python/generated_cases.c.h" } TARGET(CACHE) { + #line 3580 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); + #line 4908 "Python/generated_cases.c.h" } TARGET(RESERVED) { + #line 3585 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); + #line 4915 "Python/generated_cases.c.h" }