aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-03-15 17:16:30 +0000
committerGitHub <noreply@github.com>2024-03-15 17:16:30 +0000
commit950667ed0737144666ea8e1ec1a7e9de2e49a628 (patch)
tree5203e103d34aa5d2e5f55c3dfff519dd8551ebb4 /Python/executor_cases.c.h
parent280de3661b42af9b3fe792764d0b09f403df5223 (diff)
downloadcpython-950667ed0737144666ea8e1ec1a7e9de2e49a628.tar.gz
cpython-950667ed0737144666ea8e1ec1a7e9de2e49a628.zip
GH-115802: Reduce the size of _INIT_CALL_PY_EXACT_ARGS. (GH-116856)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h84
1 files changed, 36 insertions, 48 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index bdc9c0b1501..a55daa2c344 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -2893,16 +2893,14 @@
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
- int argcount = oparg;
- if (self_or_null != NULL) {
- args--;
- argcount++;
- }
+ int has_self = (self_or_null != NULL);
STAT_INC(CALL, hit);
PyFunctionObject *func = (PyFunctionObject *)callable;
- new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
- for (int i = 0; i < argcount; i++) {
- new_frame->localsplus[i] = args[i];
+ new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
+ PyObject **first_non_self_local = new_frame->localsplus + has_self;
+ new_frame->localsplus[0] = self_or_null;
+ for (int i = 0; i < oparg; i++) {
+ first_non_self_local[i] = args[i];
}
stack_pointer[-2 - oparg] = (PyObject *)new_frame;
stack_pointer += -1 - oparg;
@@ -2919,16 +2917,14 @@
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
- int argcount = oparg;
- if (self_or_null != NULL) {
- args--;
- argcount++;
- }
+ int has_self = (self_or_null != NULL);
STAT_INC(CALL, hit);
PyFunctionObject *func = (PyFunctionObject *)callable;
- new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
- for (int i = 0; i < argcount; i++) {
- new_frame->localsplus[i] = args[i];
+ new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
+ PyObject **first_non_self_local = new_frame->localsplus + has_self;
+ new_frame->localsplus[0] = self_or_null;
+ for (int i = 0; i < oparg; i++) {
+ first_non_self_local[i] = args[i];
}
stack_pointer[-2 - oparg] = (PyObject *)new_frame;
stack_pointer += -1 - oparg;
@@ -2945,16 +2941,14 @@
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
- int argcount = oparg;
- if (self_or_null != NULL) {
- args--;
- argcount++;
- }
+ int has_self = (self_or_null != NULL);
STAT_INC(CALL, hit);
PyFunctionObject *func = (PyFunctionObject *)callable;
- new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
- for (int i = 0; i < argcount; i++) {
- new_frame->localsplus[i] = args[i];
+ new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
+ PyObject **first_non_self_local = new_frame->localsplus + has_self;
+ new_frame->localsplus[0] = self_or_null;
+ for (int i = 0; i < oparg; i++) {
+ first_non_self_local[i] = args[i];
}
stack_pointer[-2 - oparg] = (PyObject *)new_frame;
stack_pointer += -1 - oparg;
@@ -2971,16 +2965,14 @@
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
- int argcount = oparg;
- if (self_or_null != NULL) {
- args--;
- argcount++;
- }
+ int has_self = (self_or_null != NULL);
STAT_INC(CALL, hit);
PyFunctionObject *func = (PyFunctionObject *)callable;
- new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
- for (int i = 0; i < argcount; i++) {
- new_frame->localsplus[i] = args[i];
+ new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
+ PyObject **first_non_self_local = new_frame->localsplus + has_self;
+ new_frame->localsplus[0] = self_or_null;
+ for (int i = 0; i < oparg; i++) {
+ first_non_self_local[i] = args[i];
}
stack_pointer[-2 - oparg] = (PyObject *)new_frame;
stack_pointer += -1 - oparg;
@@ -2997,16 +2989,14 @@
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
- int argcount = oparg;
- if (self_or_null != NULL) {
- args--;
- argcount++;
- }
+ int has_self = (self_or_null != NULL);
STAT_INC(CALL, hit);
PyFunctionObject *func = (PyFunctionObject *)callable;
- new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
- for (int i = 0; i < argcount; i++) {
- new_frame->localsplus[i] = args[i];
+ new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
+ PyObject **first_non_self_local = new_frame->localsplus + has_self;
+ new_frame->localsplus[0] = self_or_null;
+ for (int i = 0; i < oparg; i++) {
+ first_non_self_local[i] = args[i];
}
stack_pointer[-2 - oparg] = (PyObject *)new_frame;
stack_pointer += -1 - oparg;
@@ -3022,16 +3012,14 @@
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
- int argcount = oparg;
- if (self_or_null != NULL) {
- args--;
- argcount++;
- }
+ int has_self = (self_or_null != NULL);
STAT_INC(CALL, hit);
PyFunctionObject *func = (PyFunctionObject *)callable;
- new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
- for (int i = 0; i < argcount; i++) {
- new_frame->localsplus[i] = args[i];
+ new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
+ PyObject **first_non_self_local = new_frame->localsplus + has_self;
+ new_frame->localsplus[0] = self_or_null;
+ for (int i = 0; i < oparg; i++) {
+ first_non_self_local[i] = args[i];
}
stack_pointer[-2 - oparg] = (PyObject *)new_frame;
stack_pointer += -1 - oparg;