summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-02-08 04:03:22 (GMT)
committerGitHub <noreply@github.com>2023-02-08 04:03:22 (GMT)
commita9f01448a99c6a2ae34d448806176f2df3a5b323 (patch)
tree5447310b44439cb0bf297a39d37ada56d22ea7ff /Python/generated_cases.c.h
parent790ff6bc6a56b4bd6e403aa43a984b99f7171dd7 (diff)
downloadcpython-a9f01448a99c6a2ae34d448806176f2df3a5b323.zip
cpython-a9f01448a99c6a2ae34d448806176f2df3a5b323.tar.gz
cpython-a9f01448a99c6a2ae34d448806176f2df3a5b323.tar.bz2
gh-98831: Modernize CALL_FUNCTION_EX (#101627)
New generator feature: Move CHECK_EVAL_BREAKER() call to just before DISPATCH().
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 3ef8086..f382864 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -3587,24 +3587,24 @@
TARGET(CALL_FUNCTION_EX) {
PREDICTED(CALL_FUNCTION_EX);
- PyObject *func, *callargs, *kwargs = NULL, *result;
- if (oparg & 0x01) {
- kwargs = POP();
+ PyObject *kwargs = (oparg & 1) ? PEEK(((oparg & 1) ? 1 : 0)) : NULL;
+ PyObject *callargs = PEEK(1 + ((oparg & 1) ? 1 : 0));
+ PyObject *func = PEEK(2 + ((oparg & 1) ? 1 : 0));
+ PyObject *result;
+ if (oparg & 1) {
// DICT_MERGE is called before this opcode if there are kwargs.
// It converts all dict subtypes in kwargs into regular dicts.
assert(PyDict_CheckExact(kwargs));
}
- callargs = POP();
- func = TOP();
if (!PyTuple_CheckExact(callargs)) {
if (check_args_iterable(tstate, func, callargs) < 0) {
- Py_DECREF(callargs);
goto error;
}
- Py_SETREF(callargs, PySequence_Tuple(callargs));
- if (callargs == NULL) {
+ PyObject *tuple = PySequence_Tuple(callargs);
+ if (tuple == NULL) {
goto error;
}
+ Py_SETREF(callargs, tuple);
}
assert(PyTuple_CheckExact(callargs));
@@ -3613,12 +3613,11 @@
Py_DECREF(callargs);
Py_XDECREF(kwargs);
- STACK_SHRINK(1);
- assert(TOP() == NULL);
- SET_TOP(result);
- if (result == NULL) {
- goto error;
- }
+ assert(PEEK(3 + (oparg & 1)) == NULL);
+ if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; }
+ STACK_SHRINK(((oparg & 1) ? 1 : 0));
+ STACK_SHRINK(2);
+ POKE(1, result);
CHECK_EVAL_BREAKER();
DISPATCH();
}