Skip to content

Commit 8ba53c3

Browse files
committed
Unpack args array into separate stack variables
1 parent 6f49dca commit 8ba53c3

File tree

7 files changed

+48
-42
lines changed

7 files changed

+48
-42
lines changed

Include/internal/pycore_opcode_metadata.h

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

Include/internal/pycore_uop_metadata.h

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

Python/bytecodes.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4353,26 +4353,25 @@ dummy_func(
43534353
res = PyStackRef_FromPyObjectSteal(res_o);
43544354
}
43554355

4356-
op(_GUARD_CALLABLE_ISINSTANCE, (callable, unused, unused[oparg] -- callable, unused, unused[oparg])) {
4356+
op(_GUARD_CALLABLE_ISINSTANCE, (callable, unused, unused, unused -- callable, unused, unused, unused)) {
43574357
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
43584358
PyInterpreterState *interp = tstate->interp;
43594359
DEOPT_IF(callable_o != interp->callable_cache.isinstance);
43604360
}
43614361

4362-
op(_CALL_ISINSTANCE, (callable, null, args[oparg] -- res)) {
4362+
op(_CALL_ISINSTANCE, (callable, null, inst_, cls -- res)) {
43634363
/* isinstance(o, o2) */
4364-
assert(oparg == 2);
43654364
STAT_INC(CALL, hit);
4366-
PyObject *inst = PyStackRef_AsPyObjectBorrow(args[0]);
4367-
PyObject *cls = PyStackRef_AsPyObjectBorrow(args[1]);
4368-
int retval = PyObject_IsInstance(inst, cls);
4365+
PyObject *inst_o = PyStackRef_AsPyObjectBorrow(inst_);
4366+
PyObject *cls_o = PyStackRef_AsPyObjectBorrow(cls);
4367+
int retval = PyObject_IsInstance(inst_o, cls_o);
43694368
if (retval < 0) {
43704369
ERROR_NO_POP();
43714370
}
43724371
(void)null; // Silence compiler warnings about unused variables
4372+
PyStackRef_CLOSE(cls);
4373+
PyStackRef_CLOSE(inst_);
43734374
DEAD(null);
4374-
PyStackRef_CLOSE(args[0]);
4375-
PyStackRef_CLOSE(args[1]);
43764375
PyStackRef_CLOSE(callable);
43774376
res = retval ? PyStackRef_True : PyStackRef_False;
43784377
assert((!PyStackRef_IsNull(res)) ^ (_PyErr_Occurred(tstate) != NULL));

Python/executor_cases.c.h

Lines changed: 17 additions & 14 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: 15 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ dummy_func(void) {
10951095
res = sym_new_type(ctx, &PyLong_Type);
10961096
}
10971097

1098-
op(_GUARD_CALLABLE_ISINSTANCE, (callable, unused, unused[oparg] -- callable, unused, unused[oparg])) {
1098+
op(_GUARD_CALLABLE_ISINSTANCE, (callable, unused, unused, unused -- callable, unused, unused, unused)) {
10991099
PyObject *isinstance = _PyInterpreterState_GET()->callable_cache.isinstance;
11001100
if (sym_get_const(ctx, callable) == isinstance) {
11011101
REPLACE_OP(this_instr, _NOP, 0, 0);

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)