Skip to content

Commit 3524b4f

Browse files
markshannondiegorusso
authored andcommitted
pythonGH-115802: Reduce the size of _INIT_CALL_PY_EXACT_ARGS. (pythonGH-116856)
1 parent 3667548 commit 3524b4f

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy