summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-03 20:28:27 (GMT)
committerGitHub <noreply@github.com>2023-07-03 20:28:27 (GMT)
commite5862113dde7a66b08f1ece542a3cfaf0a3d9080 (patch)
tree1085ca157fffe2548dcdc6227515f19329a6ef8d /Python
parent7f4c8121db62a9f72f00f2d9f73381e82f289581 (diff)
downloadcpython-e5862113dde7a66b08f1ece542a3cfaf0a3d9080.zip
cpython-e5862113dde7a66b08f1ece542a3cfaf0a3d9080.tar.gz
cpython-e5862113dde7a66b08f1ece542a3cfaf0a3d9080.tar.bz2
GH-104584: Fix ENTER_EXECUTOR (GH-106141)
* Check eval-breaker in ENTER_EXECUTOR. * Make sure that frame->prev_instr is set before entering executor.
Diffstat (limited to 'Python')
-rw-r--r--Python/bytecodes.c19
-rw-r--r--Python/ceval.c70
-rw-r--r--Python/ceval_gil.c61
-rw-r--r--Python/ceval_macros.h4
-rw-r--r--Python/executor_cases.c.h44
-rw-r--r--Python/generated_cases.c.h339
-rw-r--r--Python/opcode_metadata.h2
7 files changed, 270 insertions, 269 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 8aab7eb..f69ac2b 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -141,8 +141,8 @@ dummy_func(
ERROR_IF(err, error);
next_instr--;
}
- else if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) {
- goto handle_eval_breaker;
+ else if (oparg < 2) {
+ CHECK_EVAL_BREAKER();
}
}
@@ -158,6 +158,9 @@ dummy_func(
next_instr--;
}
else {
+ if (oparg < 2) {
+ CHECK_EVAL_BREAKER();
+ }
_PyFrame_SetStackPointer(frame, stack_pointer);
int err = _Py_call_instrumentation(
tstate, oparg > 0, frame, next_instr-1);
@@ -168,9 +171,6 @@ dummy_func(
next_instr = frame->prev_instr;
DISPATCH();
}
- if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) {
- goto handle_eval_breaker;
- }
}
}
@@ -2223,6 +2223,7 @@ dummy_func(
}
inst(JUMP_BACKWARD, (--)) {
+ CHECK_EVAL_BREAKER();
_Py_CODEUNIT *here = next_instr - 1;
assert(oparg <= INSTR_OFFSET());
JUMPBY(1-oparg);
@@ -2240,7 +2241,6 @@ dummy_func(
goto resume_frame;
}
#endif /* ENABLE_SPECIALIZATION */
- CHECK_EVAL_BREAKER();
}
pseudo(JUMP) = {
@@ -2254,8 +2254,13 @@ dummy_func(
};
inst(ENTER_EXECUTOR, (--)) {
+ CHECK_EVAL_BREAKER();
+
PyCodeObject *code = _PyFrame_GetCode(frame);
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
+ int original_oparg = executor->vm_data.oparg | (oparg & 0xfffff00);
+ JUMPBY(1-original_oparg);
+ frame->prev_instr = next_instr - 1;
Py_INCREF(executor);
frame = executor->execute(executor, frame, stack_pointer);
if (frame == NULL) {
@@ -3570,8 +3575,8 @@ dummy_func(
}
inst(INSTRUMENTED_JUMP_BACKWARD, ( -- )) {
- INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP);
CHECK_EVAL_BREAKER();
+ INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP);
}
inst(INSTRUMENTED_POP_JUMP_IF_TRUE, ( -- )) {
diff --git a/Python/ceval.c b/Python/ceval.c
index 6ce1a6a..9bcb83f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -763,68 +763,6 @@ resume_frame:
DISPATCH();
-handle_eval_breaker:
-
- /* Do periodic things, like check for signals and async I/0.
- * We need to do reasonably frequently, but not too frequently.
- * All loops should include a check of the eval breaker.
- * We also check on return from any builtin function.
- *
- * ## More Details ###
- *
- * The eval loop (this function) normally executes the instructions
- * of a code object sequentially. However, the runtime supports a
- * number of out-of-band execution scenarios that may pause that
- * sequential execution long enough to do that out-of-band work
- * in the current thread using the current PyThreadState.
- *
- * The scenarios include:
- *
- * - cyclic garbage collection
- * - GIL drop requests
- * - "async" exceptions
- * - "pending calls" (some only in the main thread)
- * - signal handling (only in the main thread)
- *
- * When the need for one of the above is detected, the eval loop
- * pauses long enough to handle the detected case. Then, if doing
- * so didn't trigger an exception, the eval loop resumes executing
- * the sequential instructions.
- *
- * To make this work, the eval loop periodically checks if any
- * of the above needs to happen. The individual checks can be
- * expensive if computed each time, so a while back we switched
- * to using pre-computed, per-interpreter variables for the checks,
- * and later consolidated that to a single "eval breaker" variable
- * (now a PyInterpreterState field).
- *
- * For the longest time, the eval breaker check would happen
- * frequently, every 5 or so times through the loop, regardless
- * of what instruction ran last or what would run next. Then, in
- * early 2021 (gh-18334, commit 4958f5d), we switched to checking
- * the eval breaker less frequently, by hard-coding the check to
- * specific places in the eval loop (e.g. certain instructions).
- * The intent then was to check after returning from calls
- * and on the back edges of loops.
- *
- * In addition to being more efficient, that approach keeps
- * the eval loop from running arbitrary code between instructions
- * that don't handle that well. (See gh-74174.)
- *
- * Currently, the eval breaker check happens here at the
- * "handle_eval_breaker" label. Some instructions come here
- * explicitly (goto) and some indirectly. Notably, the check
- * happens on back edges in the control flow graph, which
- * pretty much applies to all loops and most calls.
- * (See bytecodes.c for exact information.)
- *
- * One consequence of this approach is that it might not be obvious
- * how to force any specific thread to pick up the eval breaker,
- * or for any specific thread to not pick it up. Mostly this
- * involves judicious uses of locks and careful ordering of code,
- * while avoiding code that might trigger the eval breaker
- * until so desired.
- */
if (_Py_HandlePending(tstate) != 0) {
goto error;
}
@@ -2796,13 +2734,7 @@ _PyUopExecute(_PyExecutorObject *executor, _PyInterpreterFrame *frame, PyObject
PyThreadState *tstate = _PyThreadState_GET();
_PyUOpExecutorObject *self = (_PyUOpExecutorObject *)executor;
- // Equivalent to CHECK_EVAL_BREAKER()
- _Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY();
- if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker)) {
- if (_Py_HandlePending(tstate) != 0) {
- goto error;
- }
- }
+ CHECK_EVAL_BREAKER();
OBJECT_STAT_INC(optimization_traces_executed);
_Py_CODEUNIT *ip_offset = (_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive;
diff --git a/Python/ceval_gil.c b/Python/ceval_gil.c
index c6b1f9e..7c9ad07 100644
--- a/Python/ceval_gil.c
+++ b/Python/ceval_gil.c
@@ -1052,8 +1052,65 @@ _PyEval_FiniState(struct _ceval_state *ceval)
}
}
-/* Handle signals, pending calls, GIL drop request
- and asynchronous exception */
+
+/* Do periodic things, like check for signals and async I/0.
+* We need to do reasonably frequently, but not too frequently.
+* All loops should include a check of the eval breaker.
+* We also check on return from any builtin function.
+*
+* ## More Details ###
+*
+* The eval loop (this function) normally executes the instructions
+* of a code object sequentially. However, the runtime supports a
+* number of out-of-band execution scenarios that may pause that
+* sequential execution long enough to do that out-of-band work
+* in the current thread using the current PyThreadState.
+*
+* The scenarios include:
+*
+* - cyclic garbage collection
+* - GIL drop requests
+* - "async" exceptions
+* - "pending calls" (some only in the main thread)
+* - signal handling (only in the main thread)
+*
+* When the need for one of the above is detected, the eval loop
+* pauses long enough to handle the detected case. Then, if doing
+* so didn't trigger an exception, the eval loop resumes executing
+* the sequential instructions.
+*
+* To make this work, the eval loop periodically checks if any
+* of the above needs to happen. The individual checks can be
+* expensive if computed each time, so a while back we switched
+* to using pre-computed, per-interpreter variables for the checks,
+* and later consolidated that to a single "eval breaker" variable
+* (now a PyInterpreterState field).
+*
+* For the longest time, the eval breaker check would happen
+* frequently, every 5 or so times through the loop, regardless
+* of what instruction ran last or what would run next. Then, in
+* early 2021 (gh-18334, commit 4958f5d), we switched to checking
+* the eval breaker less frequently, by hard-coding the check to
+* specific places in the eval loop (e.g. certain instructions).
+* The intent then was to check after returning from calls
+* and on the back edges of loops.
+*
+* In addition to being more efficient, that approach keeps
+* the eval loop from running arbitrary code between instructions
+* that don't handle that well. (See gh-74174.)
+*
+* Currently, the eval breaker check happens on back edges in
+* the control flow graph, which pretty much applies to all loops,
+* and most calls.
+* (See bytecodes.c for exact information.)
+*
+* One consequence of this approach is that it might not be obvious
+* how to force any specific thread to pick up the eval breaker,
+* or for any specific thread to not pick it up. Mostly this
+* involves judicious uses of locks and careful ordering of code,
+* while avoiding code that might trigger the eval breaker
+* until so desired.
+*/
int
_Py_HandlePending(PyThreadState *tstate)
{
diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h
index 0d41ef5..72800aa 100644
--- a/Python/ceval_macros.h
+++ b/Python/ceval_macros.h
@@ -117,7 +117,9 @@
#define CHECK_EVAL_BREAKER() \
_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY(); \
if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker)) { \
- goto handle_eval_breaker; \
+ if (_Py_HandlePending(tstate) != 0) { \
+ goto error; \
+ } \
}
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index d1e0443..39a4490 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1629,7 +1629,7 @@
case GET_LEN: {
PyObject *obj = stack_pointer[-1];
PyObject *len_o;
- #line 2304 "Python/bytecodes.c"
+ #line 2309 "Python/bytecodes.c"
// PUSH(len(TOS))
Py_ssize_t len_i = PyObject_Length(obj);
if (len_i < 0) goto error;
@@ -1646,7 +1646,7 @@
PyObject *type = stack_pointer[-2];
PyObject *subject = stack_pointer[-3];
PyObject *attrs;
- #line 2312 "Python/bytecodes.c"
+ #line 2317 "Python/bytecodes.c"
// Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or
// None on failure.
assert(PyTuple_CheckExact(names));
@@ -1655,7 +1655,7 @@
Py_DECREF(subject);
Py_DECREF(type);
Py_DECREF(names);
- #line 2317 "Python/bytecodes.c"
+ #line 2322 "Python/bytecodes.c"
if (attrs) {
assert(PyTuple_CheckExact(attrs)); // Success!
}
@@ -1672,7 +1672,7 @@
case MATCH_MAPPING: {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2327 "Python/bytecodes.c"
+ #line 2332 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
res = match ? Py_True : Py_False;
#line 1679 "Python/executor_cases.c.h"
@@ -1684,7 +1684,7 @@
case MATCH_SEQUENCE: {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2332 "Python/bytecodes.c"
+ #line 2337 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
res = match ? Py_True : Py_False;
#line 1691 "Python/executor_cases.c.h"
@@ -1697,7 +1697,7 @@
PyObject *keys = stack_pointer[-1];
PyObject *subject = stack_pointer[-2];
PyObject *values_or_none;
- #line 2337 "Python/bytecodes.c"
+ #line 2342 "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;
@@ -1710,12 +1710,12 @@
case GET_ITER: {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2343 "Python/bytecodes.c"
+ #line 2348 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
iter = PyObject_GetIter(iterable);
#line 1717 "Python/executor_cases.c.h"
Py_DECREF(iterable);
- #line 2346 "Python/bytecodes.c"
+ #line 2351 "Python/bytecodes.c"
if (iter == NULL) goto pop_1_error;
#line 1721 "Python/executor_cases.c.h"
stack_pointer[-1] = iter;
@@ -1725,7 +1725,7 @@
case GET_YIELD_FROM_ITER: {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2350 "Python/bytecodes.c"
+ #line 2355 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
if (PyCoro_CheckExact(iterable)) {
/* `iterable` is a coroutine */
@@ -1750,7 +1750,7 @@
}
#line 1752 "Python/executor_cases.c.h"
Py_DECREF(iterable);
- #line 2373 "Python/bytecodes.c"
+ #line 2378 "Python/bytecodes.c"
}
#line 1756 "Python/executor_cases.c.h"
stack_pointer[-1] = iter;
@@ -1762,7 +1762,7 @@
PyObject *lasti = stack_pointer[-3];
PyObject *exit_func = stack_pointer[-4];
PyObject *res;
- #line 2605 "Python/bytecodes.c"
+ #line 2610 "Python/bytecodes.c"
/* At the top of the stack are 4 values:
- val: TOP = exc_info()
- unused: SECOND = previous exception
@@ -1792,7 +1792,7 @@
case PUSH_EXC_INFO: {
PyObject *new_exc = stack_pointer[-1];
PyObject *prev_exc;
- #line 2644 "Python/bytecodes.c"
+ #line 2649 "Python/bytecodes.c"
_PyErr_StackItem *exc_info = tstate->exc_info;
if (exc_info->exc_value != NULL) {
prev_exc = exc_info->exc_value;
@@ -1811,7 +1811,7 @@
case EXIT_INIT_CHECK: {
PyObject *should_be_none = stack_pointer[-1];
- #line 3013 "Python/bytecodes.c"
+ #line 3018 "Python/bytecodes.c"
assert(STACK_LEVEL() == 2);
if (should_be_none != Py_None) {
PyErr_Format(PyExc_TypeError,
@@ -1827,7 +1827,7 @@
case MAKE_FUNCTION: {
PyObject *codeobj = stack_pointer[-1];
PyObject *func;
- #line 3427 "Python/bytecodes.c"
+ #line 3432 "Python/bytecodes.c"
PyFunctionObject *func_obj = (PyFunctionObject *)
PyFunction_New(codeobj, GLOBALS());
@@ -1847,7 +1847,7 @@
case SET_FUNCTION_ATTRIBUTE: {
PyObject *func = stack_pointer[-1];
PyObject *attr = stack_pointer[-2];
- #line 3441 "Python/bytecodes.c"
+ #line 3446 "Python/bytecodes.c"
assert(PyFunction_Check(func));
PyFunctionObject *func_obj = (PyFunctionObject *)func;
switch(oparg) {
@@ -1883,13 +1883,13 @@
PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
PyObject *slice;
- #line 3491 "Python/bytecodes.c"
+ #line 3496 "Python/bytecodes.c"
slice = PySlice_New(start, stop, step);
#line 1889 "Python/executor_cases.c.h"
Py_DECREF(start);
Py_DECREF(stop);
Py_XDECREF(step);
- #line 3493 "Python/bytecodes.c"
+ #line 3498 "Python/bytecodes.c"
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
#line 1895 "Python/executor_cases.c.h"
STACK_SHRINK(((oparg == 3) ? 1 : 0));
@@ -1901,7 +1901,7 @@
case CONVERT_VALUE: {
PyObject *value = stack_pointer[-1];
PyObject *result;
- #line 3497 "Python/bytecodes.c"
+ #line 3502 "Python/bytecodes.c"
convertion_func_ptr conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
conv_fn = CONVERSION_FUNCTIONS[oparg];
@@ -1916,7 +1916,7 @@
case FORMAT_SIMPLE: {
PyObject *value = stack_pointer[-1];
PyObject *res;
- #line 3506 "Python/bytecodes.c"
+ #line 3511 "Python/bytecodes.c"
/* If value is a unicode object, then we know the result
* of format(value) is value itself. */
if (!PyUnicode_CheckExact(value)) {
@@ -1936,7 +1936,7 @@
PyObject *fmt_spec = stack_pointer[-1];
PyObject *value = stack_pointer[-2];
PyObject *res;
- #line 3519 "Python/bytecodes.c"
+ #line 3524 "Python/bytecodes.c"
res = PyObject_Format(value, fmt_spec);
Py_DECREF(value);
Py_DECREF(fmt_spec);
@@ -1950,7 +1950,7 @@
case COPY: {
PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
PyObject *top;
- #line 3526 "Python/bytecodes.c"
+ #line 3531 "Python/bytecodes.c"
assert(oparg > 0);
top = Py_NewRef(bottom);
#line 1957 "Python/executor_cases.c.h"
@@ -1962,7 +1962,7 @@
case SWAP: {
PyObject *top = stack_pointer[-1];
PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
- #line 3551 "Python/bytecodes.c"
+ #line 3556 "Python/bytecodes.c"
assert(oparg >= 2);
#line 1968 "Python/executor_cases.c.h"
stack_pointer[-1] = bottom;
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 21cd2d0..eb24229 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -17,8 +17,8 @@
if (err) goto error;
next_instr--;
}
- else if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) {
- goto handle_eval_breaker;
+ else if (oparg < 2) {
+ CHECK_EVAL_BREAKER();
}
#line 24 "Python/generated_cases.c.h"
DISPATCH();
@@ -37,6 +37,9 @@
next_instr--;
}
else {
+ if (oparg < 2) {
+ CHECK_EVAL_BREAKER();
+ }
_PyFrame_SetStackPointer(frame, stack_pointer);
int err = _Py_call_instrumentation(
tstate, oparg > 0, frame, next_instr-1);
@@ -47,9 +50,6 @@
next_instr = frame->prev_instr;
DISPATCH();
}
- if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) {
- goto handle_eval_breaker;
- }
}
#line 55 "Python/generated_cases.c.h"
DISPATCH();
@@ -3182,6 +3182,7 @@
TARGET(JUMP_BACKWARD) {
#line 2226 "Python/bytecodes.c"
+ CHECK_EVAL_BREAKER();
_Py_CODEUNIT *here = next_instr - 1;
assert(oparg <= INSTR_OFFSET());
JUMPBY(1-oparg);
@@ -3199,15 +3200,19 @@
goto resume_frame;
}
#endif /* ENABLE_SPECIALIZATION */
- #line 3203 "Python/generated_cases.c.h"
- CHECK_EVAL_BREAKER();
+ #line 3204 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(ENTER_EXECUTOR) {
#line 2257 "Python/bytecodes.c"
+ CHECK_EVAL_BREAKER();
+
PyCodeObject *code = _PyFrame_GetCode(frame);
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
+ int original_oparg = executor->vm_data.oparg | (oparg & 0xfffff00);
+ JUMPBY(1-original_oparg);
+ frame->prev_instr = next_instr - 1;
Py_INCREF(executor);
frame = executor->execute(executor, frame, stack_pointer);
if (frame == NULL) {
@@ -3215,81 +3220,81 @@
goto resume_with_error;
}
goto resume_frame;
- #line 3219 "Python/generated_cases.c.h"
+ #line 3224 "Python/generated_cases.c.h"
}
TARGET(POP_JUMP_IF_FALSE) {
PyObject *cond = stack_pointer[-1];
- #line 2269 "Python/bytecodes.c"
+ #line 2274 "Python/bytecodes.c"
assert(PyBool_Check(cond));
JUMPBY(oparg * Py_IsFalse(cond));
- #line 3227 "Python/generated_cases.c.h"
+ #line 3232 "Python/generated_cases.c.h"
STACK_SHRINK(1);
DISPATCH();
}
TARGET(POP_JUMP_IF_TRUE) {
PyObject *cond = stack_pointer[-1];
- #line 2274 "Python/bytecodes.c"
+ #line 2279 "Python/bytecodes.c"
assert(PyBool_Check(cond));
JUMPBY(oparg * Py_IsTrue(cond));
- #line 3237 "Python/generated_cases.c.h"
+ #line 3242 "Python/generated_cases.c.h"
STACK_SHRINK(1);
DISPATCH();
}
TARGET(POP_JUMP_IF_NOT_NONE) {
PyObject *value = stack_pointer[-1];
- #line 2279 "Python/bytecodes.c"
+ #line 2284 "Python/bytecodes.c"
if (!Py_IsNone(value)) {
- #line 3246 "Python/generated_cases.c.h"
+ #line 3251 "Python/generated_cases.c.h"
Py_DECREF(value);
- #line 2281 "Python/bytecodes.c"
+ #line 2286 "Python/bytecodes.c"
JUMPBY(oparg);
}
- #line 3251 "Python/generated_cases.c.h"
+ #line 3256 "Python/generated_cases.c.h"
STACK_SHRINK(1);
DISPATCH();
}
TARGET(POP_JUMP_IF_NONE) {
PyObject *value = stack_pointer[-1];
- #line 2286 "Python/bytecodes.c"
+ #line 2291 "Python/bytecodes.c"
if (Py_IsNone(value)) {
JUMPBY(oparg);
}
else {
- #line 3263 "Python/generated_cases.c.h"
+ #line 3268 "Python/generated_cases.c.h"
Py_DECREF(value);
- #line 2291 "Python/bytecodes.c"
+ #line 2296 "Python/bytecodes.c"
}
- #line 3267 "Python/generated_cases.c.h"
+ #line 3272 "Python/generated_cases.c.h"
STACK_SHRINK(1);
DISPATCH();
}
TARGET(JUMP_BACKWARD_NO_INTERRUPT) {
- #line 2295 "Python/bytecodes.c"
+ #line 2300 "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 3280 "Python/generated_cases.c.h"
+ #line 3285 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(GET_LEN) {
PyObject *obj = stack_pointer[-1];
PyObject *len_o;
- #line 2304 "Python/bytecodes.c"
+ #line 2309 "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 3293 "Python/generated_cases.c.h"
+ #line 3298 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = len_o;
DISPATCH();
@@ -3300,16 +3305,16 @@
PyObject *type = stack_pointer[-2];
PyObject *subject = stack_pointer[-3];
PyObject *attrs;
- #line 2312 "Python/bytecodes.c"
+ #line 2317 "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 3309 "Python/generated_cases.c.h"
+ #line 3314 "Python/generated_cases.c.h"
Py_DECREF(subject);
Py_DECREF(type);
Py_DECREF(names);
- #line 2317 "Python/bytecodes.c"
+ #line 2322 "Python/bytecodes.c"
if (attrs) {
assert(PyTuple_CheckExact(attrs)); // Success!
}
@@ -3317,7 +3322,7 @@
if (_PyErr_Occurred(tstate)) goto pop_3_error;
attrs = Py_None; // Failure!
}
- #line 3321 "Python/generated_cases.c.h"
+ #line 3326 "Python/generated_cases.c.h"
STACK_SHRINK(2);
stack_pointer[-1] = attrs;
DISPATCH();
@@ -3326,10 +3331,10 @@
TARGET(MATCH_MAPPING) {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2327 "Python/bytecodes.c"
+ #line 2332 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
res = match ? Py_True : Py_False;
- #line 3333 "Python/generated_cases.c.h"
+ #line 3338 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
DISPATCH();
@@ -3338,10 +3343,10 @@
TARGET(MATCH_SEQUENCE) {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2332 "Python/bytecodes.c"
+ #line 2337 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
res = match ? Py_True : Py_False;
- #line 3345 "Python/generated_cases.c.h"
+ #line 3350 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
DISPATCH();
@@ -3351,11 +3356,11 @@
PyObject *keys = stack_pointer[-1];
PyObject *subject = stack_pointer[-2];
PyObject *values_or_none;
- #line 2337 "Python/bytecodes.c"
+ #line 2342 "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 3359 "Python/generated_cases.c.h"
+ #line 3364 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = values_or_none;
DISPATCH();
@@ -3364,14 +3369,14 @@
TARGET(GET_ITER) {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2343 "Python/bytecodes.c"
+ #line 2348 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
iter = PyObject_GetIter(iterable);
- #line 3371 "Python/generated_cases.c.h"
+ #line 3376 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 2346 "Python/bytecodes.c"
+ #line 2351 "Python/bytecodes.c"
if (iter == NULL) goto pop_1_error;
- #line 3375 "Python/generated_cases.c.h"
+ #line 3380 "Python/generated_cases.c.h"
stack_pointer[-1] = iter;
DISPATCH();
}
@@ -3379,7 +3384,7 @@
TARGET(GET_YIELD_FROM_ITER) {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2350 "Python/bytecodes.c"
+ #line 2355 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
if (PyCoro_CheckExact(iterable)) {
/* `iterable` is a coroutine */
@@ -3402,11 +3407,11 @@
if (iter == NULL) {
goto error;
}
- #line 3406 "Python/generated_cases.c.h"
+ #line 3411 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 2373 "Python/bytecodes.c"
+ #line 2378 "Python/bytecodes.c"
}
- #line 3410 "Python/generated_cases.c.h"
+ #line 3415 "Python/generated_cases.c.h"
stack_pointer[-1] = iter;
DISPATCH();
}
@@ -3416,7 +3421,7 @@
static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size");
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2391 "Python/bytecodes.c"
+ #line 2396 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyForIterCache *cache = (_PyForIterCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -3448,7 +3453,7 @@
DISPATCH();
}
// Common case: no jump, leave it to the code generator
- #line 3452 "Python/generated_cases.c.h"
+ #line 3457 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3456,7 +3461,7 @@
}
TARGET(INSTRUMENTED_FOR_ITER) {
- #line 2425 "Python/bytecodes.c"
+ #line 2430 "Python/bytecodes.c"
_Py_CODEUNIT *here = next_instr-1;
_Py_CODEUNIT *target;
PyObject *iter = TOP();
@@ -3482,14 +3487,14 @@
target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1;
}
INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH);
- #line 3486 "Python/generated_cases.c.h"
+ #line 3491 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(FOR_ITER_LIST) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2453 "Python/bytecodes.c"
+ #line 2458 "Python/bytecodes.c"
DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER);
_PyListIterObject *it = (_PyListIterObject *)iter;
STAT_INC(FOR_ITER, hit);
@@ -3510,7 +3515,7 @@
DISPATCH();
end_for_iter_list:
// Common case: no jump, leave it to the code generator
- #line 3514 "Python/generated_cases.c.h"
+ #line 3519 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3520,7 +3525,7 @@
TARGET(FOR_ITER_TUPLE) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2476 "Python/bytecodes.c"
+ #line 2481 "Python/bytecodes.c"
_PyTupleIterObject *it = (_PyTupleIterObject *)iter;
DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER);
STAT_INC(FOR_ITER, hit);
@@ -3541,7 +3546,7 @@
DISPATCH();
end_for_iter_tuple:
// Common case: no jump, leave it to the code generator
- #line 3545 "Python/generated_cases.c.h"
+ #line 3550 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3551,7 +3556,7 @@
TARGET(FOR_ITER_RANGE) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2499 "Python/bytecodes.c"
+ #line 2504 "Python/bytecodes.c"
_PyRangeIterObject *r = (_PyRangeIterObject *)iter;
DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER);
STAT_INC(FOR_ITER, hit);
@@ -3570,7 +3575,7 @@
if (next == NULL) {
goto error;
}
- #line 3574 "Python/generated_cases.c.h"
+ #line 3579 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3579,7 +3584,7 @@
TARGET(FOR_ITER_GEN) {
PyObject *iter = stack_pointer[-1];
- #line 2520 "Python/bytecodes.c"
+ #line 2525 "Python/bytecodes.c"
DEOPT_IF(tstate->interp->eval_frame, FOR_ITER);
PyGenObject *gen = (PyGenObject *)iter;
DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER);
@@ -3595,14 +3600,14 @@
assert(next_instr[oparg].op.code == END_FOR ||
next_instr[oparg].op.code == INSTRUMENTED_END_FOR);
DISPATCH_INLINED(gen_frame);
- #line 3599 "Python/generated_cases.c.h"
+ #line 3604 "Python/generated_cases.c.h"
}
TARGET(BEFORE_ASYNC_WITH) {
PyObject *mgr = stack_pointer[-1];
PyObject *exit;
PyObject *res;
- #line 2538 "Python/bytecodes.c"
+ #line 2543 "Python/bytecodes.c"
PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__));
if (enter == NULL) {
if (!_PyErr_Occurred(tstate)) {
@@ -3625,16 +3630,16 @@
Py_DECREF(enter);
goto error;
}
- #line 3629 "Python/generated_cases.c.h"
+ #line 3634 "Python/generated_cases.c.h"
Py_DECREF(mgr);
- #line 2561 "Python/bytecodes.c"
+ #line 2566 "Python/bytecodes.c"
res = _PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
if (true) goto pop_1_error;
}
- #line 3638 "Python/generated_cases.c.h"
+ #line 3643 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
stack_pointer[-2] = exit;
@@ -3645,7 +3650,7 @@
PyObject *mgr = stack_pointer[-1];
PyObject *exit;
PyObject *res;
- #line 2570 "Python/bytecodes.c"
+ #line 2575 "Python/bytecodes.c"
/* pop the context manager, push its __exit__ and the
* value returned from calling its __enter__
*/
@@ -3671,16 +3676,16 @@
Py_DECREF(enter);
goto error;
}
- #line 3675 "Python/generated_cases.c.h"
+ #line 3680 "Python/generated_cases.c.h"
Py_DECREF(mgr);
- #line 2596 "Python/bytecodes.c"
+ #line 2601 "Python/bytecodes.c"
res = _PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
Py_DECREF(exit);
if (true) goto pop_1_error;
}
- #line 3684 "Python/generated_cases.c.h"
+ #line 3689 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
stack_pointer[-2] = exit;
@@ -3692,7 +3697,7 @@
PyObject *lasti = stack_pointer[-3];
PyObject *exit_func = stack_pointer[-4];
PyObject *res;
- #line 2605 "Python/bytecodes.c"
+ #line 2610 "Python/bytecodes.c"
/* At the top of the stack are 4 values:
- val: TOP = exc_info()
- unused: SECOND = previous exception
@@ -3713,7 +3718,7 @@
res = PyObject_Vectorcall(exit_func, stack + 1,
3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
if (res == NULL) goto error;
- #line 3717 "Python/generated_cases.c.h"
+ #line 3722 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
DISPATCH();
@@ -3722,7 +3727,7 @@
TARGET(PUSH_EXC_INFO) {
PyObject *new_exc = stack_pointer[-1];
PyObject *prev_exc;
- #line 2644 "Python/bytecodes.c"
+ #line 2649 "Python/bytecodes.c"
_PyErr_StackItem *exc_info = tstate->exc_info;
if (exc_info->exc_value != NULL) {
prev_exc = exc_info->exc_value;
@@ -3732,7 +3737,7 @@
}
assert(PyExceptionInstance_Check(new_exc));
exc_info->exc_value = Py_NewRef(new_exc);
- #line 3736 "Python/generated_cases.c.h"
+ #line 3741 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = new_exc;
stack_pointer[-2] = prev_exc;
@@ -3746,7 +3751,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 2656 "Python/bytecodes.c"
+ #line 2661 "Python/bytecodes.c"
/* Cached method object */
PyTypeObject *self_cls = Py_TYPE(self);
assert(type_version != 0);
@@ -3763,7 +3768,7 @@
assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR));
res = self;
assert(oparg & 1);
- #line 3767 "Python/generated_cases.c.h"
+ #line 3772 "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; }
@@ -3777,7 +3782,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 2675 "Python/bytecodes.c"
+ #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);
@@ -3787,7 +3792,7 @@
res2 = Py_NewRef(descr);
res = self;
assert(oparg & 1);
- #line 3791 "Python/generated_cases.c.h"
+ #line 3796 "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; }
@@ -3801,7 +3806,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 2687 "Python/bytecodes.c"
+ #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;
@@ -3815,7 +3820,7 @@
res2 = Py_NewRef(descr);
res = self;
assert(oparg & 1);
- #line 3819 "Python/generated_cases.c.h"
+ #line 3824 "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; }
@@ -3824,16 +3829,16 @@
}
TARGET(KW_NAMES) {
- #line 2703 "Python/bytecodes.c"
+ #line 2708 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS));
kwnames = GETITEM(FRAME_CO_CONSTS, oparg);
- #line 3832 "Python/generated_cases.c.h"
+ #line 3837 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_CALL) {
- #line 2709 "Python/bytecodes.c"
+ #line 2714 "Python/bytecodes.c"
int is_meth = PEEK(oparg+2) != NULL;
int total_args = oparg + is_meth;
PyObject *function = PEEK(total_args + 1);
@@ -3846,7 +3851,7 @@
_PyCallCache *cache = (_PyCallCache *)next_instr;
INCREMENT_ADAPTIVE_COUNTER(cache->counter);
GO_TO_INSTRUCTION(CALL);
- #line 3850 "Python/generated_cases.c.h"
+ #line 3855 "Python/generated_cases.c.h"
}
TARGET(CALL) {
@@ -3856,7 +3861,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2755 "Python/bytecodes.c"
+ #line 2760 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -3938,7 +3943,7 @@
Py_DECREF(args[i]);
}
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3942 "Python/generated_cases.c.h"
+ #line 3947 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3950,7 +3955,7 @@
TARGET(CALL_BOUND_METHOD_EXACT_ARGS) {
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
- #line 2843 "Python/bytecodes.c"
+ #line 2848 "Python/bytecodes.c"
DEOPT_IF(method != NULL, CALL);
DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL);
STAT_INC(CALL, hit);
@@ -3960,7 +3965,7 @@
PEEK(oparg + 2) = Py_NewRef(meth); // method
Py_DECREF(callable);
GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS);
- #line 3964 "Python/generated_cases.c.h"
+ #line 3969 "Python/generated_cases.c.h"
}
TARGET(CALL_PY_EXACT_ARGS) {
@@ -3969,7 +3974,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
uint32_t func_version = read_u32(&next_instr[1].cache);
- #line 2855 "Python/bytecodes.c"
+ #line 2860 "Python/bytecodes.c"
assert(kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);
int is_meth = method != NULL;
@@ -3995,7 +4000,7 @@
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 3999 "Python/generated_cases.c.h"
+ #line 4004 "Python/generated_cases.c.h"
}
TARGET(CALL_PY_WITH_DEFAULTS) {
@@ -4003,7 +4008,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
uint32_t func_version = read_u32(&next_instr[1].cache);
- #line 2883 "Python/bytecodes.c"
+ #line 2888 "Python/bytecodes.c"
assert(kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);
int is_meth = method != NULL;
@@ -4039,7 +4044,7 @@
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 4043 "Python/generated_cases.c.h"
+ #line 4048 "Python/generated_cases.c.h"
}
TARGET(CALL_NO_KW_TYPE_1) {
@@ -4047,7 +4052,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2921 "Python/bytecodes.c"
+ #line 2926 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -4057,7 +4062,7 @@
res = Py_NewRef(Py_TYPE(obj));
Py_DECREF(obj);
Py_DECREF(&PyType_Type); // I.e., callable
- #line 4061 "Python/generated_cases.c.h"
+ #line 4066 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4070,7 +4075,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2933 "Python/bytecodes.c"
+ #line 2938 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -4081,7 +4086,7 @@
Py_DECREF(arg);
Py_DECREF(&PyUnicode_Type); // I.e., callable
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4085 "Python/generated_cases.c.h"
+ #line 4090 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4095,7 +4100,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2947 "Python/bytecodes.c"
+ #line 2952 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -4106,7 +4111,7 @@
Py_DECREF(arg);
Py_DECREF(&PyTuple_Type); // I.e., tuple
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4110 "Python/generated_cases.c.h"
+ #line 4115 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4119,7 +4124,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
- #line 2961 "Python/bytecodes.c"
+ #line 2966 "Python/bytecodes.c"
/* This instruction does the following:
* 1. Creates the object (by calling ``object.__new__``)
* 2. Pushes a shim frame to the frame stack (to cleanup after ``__init__``)
@@ -4169,12 +4174,12 @@
frame = cframe.current_frame = init_frame;
CALL_STAT_INC(inlined_py_calls);
goto start_frame;
- #line 4173 "Python/generated_cases.c.h"
+ #line 4178 "Python/generated_cases.c.h"
}
TARGET(EXIT_INIT_CHECK) {
PyObject *should_be_none = stack_pointer[-1];
- #line 3013 "Python/bytecodes.c"
+ #line 3018 "Python/bytecodes.c"
assert(STACK_LEVEL() == 2);
if (should_be_none != Py_None) {
PyErr_Format(PyExc_TypeError,
@@ -4182,7 +4187,7 @@
Py_TYPE(should_be_none)->tp_name);
goto error;
}
- #line 4186 "Python/generated_cases.c.h"
+ #line 4191 "Python/generated_cases.c.h"
STACK_SHRINK(1);
DISPATCH();
}
@@ -4192,7 +4197,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3023 "Python/bytecodes.c"
+ #line 3028 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -4214,7 +4219,7 @@
}
Py_DECREF(tp);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4218 "Python/generated_cases.c.h"
+ #line 4223 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4228,7 +4233,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3048 "Python/bytecodes.c"
+ #line 3053 "Python/bytecodes.c"
/* Builtin METH_O functions */
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -4256,7 +4261,7 @@
Py_DECREF(arg);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4260 "Python/generated_cases.c.h"
+ #line 4265 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4270,7 +4275,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3079 "Python/bytecodes.c"
+ #line 3084 "Python/bytecodes.c"
/* Builtin METH_FASTCALL functions, without keywords */
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -4302,7 +4307,7 @@
'invalid'). In those cases an exception is set, so we must
handle it.
*/
- #line 4306 "Python/generated_cases.c.h"
+ #line 4311 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4316,7 +4321,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3114 "Python/bytecodes.c"
+ #line 3119 "Python/bytecodes.c"
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
int is_meth = method != NULL;
int total_args = oparg;
@@ -4348,7 +4353,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4352 "Python/generated_cases.c.h"
+ #line 4357 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4362,7 +4367,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3149 "Python/bytecodes.c"
+ #line 3154 "Python/bytecodes.c"
assert(kwnames == NULL);
/* len(o) */
int is_meth = method != NULL;
@@ -4387,7 +4392,7 @@
Py_DECREF(callable);
Py_DECREF(arg);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4391 "Python/generated_cases.c.h"
+ #line 4396 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4400,7 +4405,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3176 "Python/bytecodes.c"
+ #line 3181 "Python/bytecodes.c"
assert(kwnames == NULL);
/* isinstance(o, o2) */
int is_meth = method != NULL;
@@ -4427,7 +4432,7 @@
Py_DECREF(cls);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4431 "Python/generated_cases.c.h"
+ #line 4436 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4439,7 +4444,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *self = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
- #line 3206 "Python/bytecodes.c"
+ #line 3211 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
assert(method != NULL);
@@ -4457,14 +4462,14 @@
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1);
assert(next_instr[-1].op.code == POP_TOP);
DISPATCH();
- #line 4461 "Python/generated_cases.c.h"
+ #line 4466 "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 3226 "Python/bytecodes.c"
+ #line 3231 "Python/bytecodes.c"
assert(kwnames == NULL);
int is_meth = method != NULL;
int total_args = oparg;
@@ -4495,7 +4500,7 @@
Py_DECREF(arg);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4499 "Python/generated_cases.c.h"
+ #line 4504 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4508,7 +4513,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3260 "Python/bytecodes.c"
+ #line 3265 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -4537,7 +4542,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4541 "Python/generated_cases.c.h"
+ #line 4546 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4550,7 +4555,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3292 "Python/bytecodes.c"
+ #line 3297 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 0 || oparg == 1);
int is_meth = method != NULL;
@@ -4579,7 +4584,7 @@
Py_DECREF(self);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4583 "Python/generated_cases.c.h"
+ #line 4588 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4592,7 +4597,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3324 "Python/bytecodes.c"
+ #line 3329 "Python/bytecodes.c"
assert(kwnames == NULL);
int is_meth = method != NULL;
int total_args = oparg;
@@ -4620,7 +4625,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4624 "Python/generated_cases.c.h"
+ #line 4629 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4630,9 +4635,9 @@
}
TARGET(INSTRUMENTED_CALL_FUNCTION_EX) {
- #line 3355 "Python/bytecodes.c"
+ #line 3360 "Python/bytecodes.c"
GO_TO_INSTRUCTION(CALL_FUNCTION_EX);
- #line 4636 "Python/generated_cases.c.h"
+ #line 4641 "Python/generated_cases.c.h"
}
TARGET(CALL_FUNCTION_EX) {
@@ -4641,7 +4646,7 @@
PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))];
PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))];
PyObject *result;
- #line 3359 "Python/bytecodes.c"
+ #line 3364 "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));
@@ -4703,14 +4708,14 @@
}
result = PyObject_Call(func, callargs, kwargs);
}
- #line 4707 "Python/generated_cases.c.h"
+ #line 4712 "Python/generated_cases.c.h"
Py_DECREF(func);
Py_DECREF(callargs);
Py_XDECREF(kwargs);
- #line 3421 "Python/bytecodes.c"
+ #line 3426 "Python/bytecodes.c"
assert(PEEK(3 + (oparg & 1)) == NULL);
if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; }
- #line 4714 "Python/generated_cases.c.h"
+ #line 4719 "Python/generated_cases.c.h"
STACK_SHRINK(((oparg & 1) ? 1 : 0));
STACK_SHRINK(2);
stack_pointer[-1] = result;
@@ -4721,7 +4726,7 @@
TARGET(MAKE_FUNCTION) {
PyObject *codeobj = stack_pointer[-1];
PyObject *func;
- #line 3427 "Python/bytecodes.c"
+ #line 3432 "Python/bytecodes.c"
PyFunctionObject *func_obj = (PyFunctionObject *)
PyFunction_New(codeobj, GLOBALS());
@@ -4733,7 +4738,7 @@
func_obj->func_version = ((PyCodeObject *)codeobj)->co_version;
func = (PyObject *)func_obj;
- #line 4737 "Python/generated_cases.c.h"
+ #line 4742 "Python/generated_cases.c.h"
stack_pointer[-1] = func;
DISPATCH();
}
@@ -4741,7 +4746,7 @@
TARGET(SET_FUNCTION_ATTRIBUTE) {
PyObject *func = stack_pointer[-1];
PyObject *attr = stack_pointer[-2];
- #line 3441 "Python/bytecodes.c"
+ #line 3446 "Python/bytecodes.c"
assert(PyFunction_Check(func));
PyFunctionObject *func_obj = (PyFunctionObject *)func;
switch(oparg) {
@@ -4766,14 +4771,14 @@
default:
Py_UNREACHABLE();
}
- #line 4770 "Python/generated_cases.c.h"
+ #line 4775 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = func;
DISPATCH();
}
TARGET(RETURN_GENERATOR) {
- #line 3468 "Python/bytecodes.c"
+ #line 3473 "Python/bytecodes.c"
assert(PyFunction_Check(frame->f_funcobj));
PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj;
PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
@@ -4794,7 +4799,7 @@
frame = cframe.current_frame = prev;
_PyFrame_StackPush(frame, (PyObject *)gen);
goto resume_frame;
- #line 4798 "Python/generated_cases.c.h"
+ #line 4803 "Python/generated_cases.c.h"
}
TARGET(BUILD_SLICE) {
@@ -4802,15 +4807,15 @@
PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
PyObject *slice;
- #line 3491 "Python/bytecodes.c"
+ #line 3496 "Python/bytecodes.c"
slice = PySlice_New(start, stop, step);
- #line 4808 "Python/generated_cases.c.h"
+ #line 4813 "Python/generated_cases.c.h"
Py_DECREF(start);
Py_DECREF(stop);
Py_XDECREF(step);
- #line 3493 "Python/bytecodes.c"
+ #line 3498 "Python/bytecodes.c"
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
- #line 4814 "Python/generated_cases.c.h"
+ #line 4819 "Python/generated_cases.c.h"
STACK_SHRINK(((oparg == 3) ? 1 : 0));
STACK_SHRINK(1);
stack_pointer[-1] = slice;
@@ -4820,14 +4825,14 @@
TARGET(CONVERT_VALUE) {
PyObject *value = stack_pointer[-1];
PyObject *result;
- #line 3497 "Python/bytecodes.c"
+ #line 3502 "Python/bytecodes.c"
convertion_func_ptr conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
conv_fn = CONVERSION_FUNCTIONS[oparg];
result = conv_fn(value);
Py_DECREF(value);
if (result == NULL) goto pop_1_error;
- #line 4831 "Python/generated_cases.c.h"
+ #line 4836 "Python/generated_cases.c.h"
stack_pointer[-1] = result;
DISPATCH();
}
@@ -4835,7 +4840,7 @@
TARGET(FORMAT_SIMPLE) {
PyObject *value = stack_pointer[-1];
PyObject *res;
- #line 3506 "Python/bytecodes.c"
+ #line 3511 "Python/bytecodes.c"
/* If value is a unicode object, then we know the result
* of format(value) is value itself. */
if (!PyUnicode_CheckExact(value)) {
@@ -4846,7 +4851,7 @@
else {
res = value;
}
- #line 4850 "Python/generated_cases.c.h"
+ #line 4855 "Python/generated_cases.c.h"
stack_pointer[-1] = res;
DISPATCH();
}
@@ -4855,12 +4860,12 @@
PyObject *fmt_spec = stack_pointer[-1];
PyObject *value = stack_pointer[-2];
PyObject *res;
- #line 3519 "Python/bytecodes.c"
+ #line 3524 "Python/bytecodes.c"
res = PyObject_Format(value, fmt_spec);
Py_DECREF(value);
Py_DECREF(fmt_spec);
if (res == NULL) goto pop_2_error;
- #line 4864 "Python/generated_cases.c.h"
+ #line 4869 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
DISPATCH();
@@ -4869,10 +4874,10 @@
TARGET(COPY) {
PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
PyObject *top;
- #line 3526 "Python/bytecodes.c"
+ #line 3531 "Python/bytecodes.c"
assert(oparg > 0);
top = Py_NewRef(bottom);
- #line 4876 "Python/generated_cases.c.h"
+ #line 4881 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = top;
DISPATCH();
@@ -4884,7 +4889,7 @@
PyObject *rhs = stack_pointer[-1];
PyObject *lhs = stack_pointer[-2];
PyObject *res;
- #line 3531 "Python/bytecodes.c"
+ #line 3536 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -4899,12 +4904,12 @@
assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops));
assert(binary_ops[oparg]);
res = binary_ops[oparg](lhs, rhs);
- #line 4903 "Python/generated_cases.c.h"
+ #line 4908 "Python/generated_cases.c.h"
Py_DECREF(lhs);
Py_DECREF(rhs);
- #line 3546 "Python/bytecodes.c"
+ #line 3551 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
- #line 4908 "Python/generated_cases.c.h"
+ #line 4913 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
next_instr += 1;
@@ -4914,16 +4919,16 @@
TARGET(SWAP) {
PyObject *top = stack_pointer[-1];
PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
- #line 3551 "Python/bytecodes.c"
+ #line 3556 "Python/bytecodes.c"
assert(oparg >= 2);
- #line 4920 "Python/generated_cases.c.h"
+ #line 4925 "Python/generated_cases.c.h"
stack_pointer[-1] = bottom;
stack_pointer[-(2 + (oparg-2))] = top;
DISPATCH();
}
TARGET(INSTRUMENTED_INSTRUCTION) {
- #line 3555 "Python/bytecodes.c"
+ #line 3560 "Python/bytecodes.c"
int next_opcode = _Py_call_instrumentation_instruction(
tstate, frame, next_instr-1);
if (next_opcode < 0) goto error;
@@ -4935,48 +4940,48 @@
assert(next_opcode > 0 && next_opcode < 256);
opcode = next_opcode;
DISPATCH_GOTO();
- #line 4939 "Python/generated_cases.c.h"
+ #line 4944 "Python/generated_cases.c.h"
}
TARGET(INSTRUMENTED_JUMP_FORWARD) {
- #line 3569 "Python/bytecodes.c"
+ #line 3574 "Python/bytecodes.c"
INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP);
- #line 4945 "Python/generated_cases.c.h"
+ #line 4950 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
- #line 3573 "Python/bytecodes.c"
- INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP);
- #line 4952 "Python/generated_cases.c.h"
+ #line 3578 "Python/bytecodes.c"
CHECK_EVAL_BREAKER();
+ INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP);
+ #line 4958 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
- #line 3578 "Python/bytecodes.c"
+ #line 3583 "Python/bytecodes.c"
PyObject *cond = POP();
assert(PyBool_Check(cond));
_Py_CODEUNIT *here = next_instr - 1;
int offset = Py_IsTrue(cond) * oparg;
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4964 "Python/generated_cases.c.h"
+ #line 4969 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
- #line 3586 "Python/bytecodes.c"
+ #line 3591 "Python/bytecodes.c"
PyObject *cond = POP();
assert(PyBool_Check(cond));
_Py_CODEUNIT *here = next_instr - 1;
int offset = Py_IsFalse(cond) * oparg;
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4975 "Python/generated_cases.c.h"
+ #line 4980 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
- #line 3594 "Python/bytecodes.c"
+ #line 3599 "Python/bytecodes.c"
PyObject *value = POP();
_Py_CODEUNIT *here = next_instr-1;
int offset;
@@ -4988,12 +4993,12 @@
offset = 0;
}
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4992 "Python/generated_cases.c.h"
+ #line 4997 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
- #line 3608 "Python/bytecodes.c"
+ #line 3613 "Python/bytecodes.c"
PyObject *value = POP();
_Py_CODEUNIT *here = next_instr-1;
int offset;
@@ -5005,30 +5010,30 @@
offset = oparg;
}
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 5009 "Python/generated_cases.c.h"
+ #line 5014 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(EXTENDED_ARG) {
- #line 3622 "Python/bytecodes.c"
+ #line 3627 "Python/bytecodes.c"
assert(oparg);
opcode = next_instr->op.code;
oparg = oparg << 8 | next_instr->op.arg;
PRE_DISPATCH_GOTO();
DISPATCH_GOTO();
- #line 5020 "Python/generated_cases.c.h"
+ #line 5025 "Python/generated_cases.c.h"
}
TARGET(CACHE) {
- #line 3630 "Python/bytecodes.c"
+ #line 3635 "Python/bytecodes.c"
assert(0 && "Executing a cache.");
Py_UNREACHABLE();
- #line 5027 "Python/generated_cases.c.h"
+ #line 5032 "Python/generated_cases.c.h"
}
TARGET(RESERVED) {
- #line 3635 "Python/bytecodes.c"
+ #line 3640 "Python/bytecodes.c"
assert(0 && "Executing RESERVED instruction.");
Py_UNREACHABLE();
- #line 5034 "Python/generated_cases.c.h"
+ #line 5039 "Python/generated_cases.c.h"
}
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index ac3d800..82c9823 100644
--- a/Python/opcode_metadata.h
+++ b/Python/opcode_metadata.h
@@ -1087,7 +1087,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[512] = {
[JUMP_BACKWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[JUMP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[JUMP_NO_INTERRUPT] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },