Skip to content

Commit af1172a

Browse files
committed
eliminate refcount from _CALL_TUPLE_1
1 parent bda1218 commit af1172a

File tree

6 files changed

+30
-33
lines changed

6 files changed

+30
-33
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4083,17 +4083,14 @@ dummy_func(
40834083
DEOPT_IF(callable_o != (PyObject *)&PyTuple_Type);
40844084
}
40854085

4086-
op(_CALL_TUPLE_1, (callable, null, arg -- res)) {
4086+
op(_CALL_TUPLE_1, (callable, null, arg -- res, a)) {
40874087
PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);
40884088

40894089
assert(oparg == 1);
40904090
STAT_INC(CALL, hit);
4091+
INPUTS_DEAD();
40914092
PyObject *res_o = PySequence_Tuple(arg_o);
4092-
DEAD(null);
4093-
DEAD(callable);
4094-
(void)callable; // Silence compiler warnings about unused variables
4095-
(void)null;
4096-
PyStackRef_CLOSE(arg);
4093+
a = arg;
40974094
ERROR_IF(res_o == NULL);
40984095
res = PyStackRef_FromPyObjectSteal(res_o);
40994096
}
@@ -4104,6 +4101,7 @@ dummy_func(
41044101
_GUARD_NOS_NULL +
41054102
_GUARD_CALLABLE_TUPLE_1 +
41064103
_CALL_TUPLE_1 +
4104+
POP_TOP +
41074105
_CHECK_PERIODIC;
41084106

41094107
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {

Python/executor_cases.c.h

Lines changed: 5 additions & 11 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: 14 additions & 13 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,14 +1127,15 @@ dummy_func(void) {
11271127
}
11281128
}
11291129

1130-
op(_CALL_TUPLE_1, (callable, null, arg -- res)) {
1130+
op(_CALL_TUPLE_1, (callable, null, arg -- res, a)) {
11311131
if (sym_matches_type(arg, &PyTuple_Type)) {
11321132
// e.g. tuple((1, 2)) or tuple(foo) where foo is known to be a tuple
11331133
res = arg;
11341134
}
11351135
else {
11361136
res = sym_new_type(ctx, &PyTuple_Type);
11371137
}
1138+
a = arg;
11381139
}
11391140

11401141
op(_GUARD_TOS_LIST, (tos -- tos)) {

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)