Skip to content

Commit dc3ba9d

Browse files
markshannonvstinner
authored andcommitted
pythonGH-115802: Reduce the size of _INIT_CALL_PY_EXACT_ARGS. (pythonGH-116856)
1 parent 97e5790 commit dc3ba9d

File tree

3 files changed

+54
-72
lines changed

3 files changed

+54
-72
lines changed

Python/bytecodes.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3150,16 +3150,14 @@ dummy_func(
31503150
}
31513151

31523152
replicate(5) pure op(_INIT_CALL_PY_EXACT_ARGS, (callable, self_or_null, args[oparg] -- new_frame: _PyInterpreterFrame*)) {
3153-
int argcount = oparg;
3154-
if (self_or_null != NULL) {
3155-
args--;
3156-
argcount++;
3157-
}
3153+
int has_self = (self_or_null != NULL);
31583154
STAT_INC(CALL, hit);
31593155
PyFunctionObject *func = (PyFunctionObject *)callable;
3160-
new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
3161-
for (int i = 0; i < argcount; i++) {
3162-
new_frame->localsplus[i] = args[i];
3156+
new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self);
3157+
PyObject **first_non_self_local = new_frame->localsplus + has_self;
3158+
new_frame->localsplus[0] = self_or_null;
3159+
for (int i = 0; i < oparg; i++) {
3160+
first_non_self_local[i] = args[i];
31633161
}
31643162
}
31653163

Python/executor_cases.c.h

Lines changed: 36 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 12 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)