mirror of
https://github.com/python/cpython.git
synced 2026-01-03 14:02:21 +00:00
gh-134584: Eliminate redundant refcounting from _BINARY_OP_SUBSCR_TUPLE_INT (GH-143094)
This commit is contained in:
parent
cbe0cb779a
commit
cc48bf0fde
9 changed files with 65 additions and 34 deletions
21
Python/generated_cases.c.h
generated
21
Python/generated_cases.c.h
generated
|
|
@ -1024,6 +1024,8 @@
|
|||
_PyStackRef tuple_st;
|
||||
_PyStackRef sub_st;
|
||||
_PyStackRef res;
|
||||
_PyStackRef ts;
|
||||
_PyStackRef ss;
|
||||
// _GUARD_TOS_INT
|
||||
{
|
||||
value = stack_pointer[-1];
|
||||
|
|
@ -1067,15 +1069,24 @@
|
|||
STAT_INC(BINARY_OP, hit);
|
||||
PyObject *res_o = PyTuple_GET_ITEM(tuple, index);
|
||||
assert(res_o != NULL);
|
||||
PyStackRef_CLOSE_SPECIALIZED(sub_st, _PyLong_ExactDealloc);
|
||||
res = PyStackRef_FromPyObjectNew(res_o);
|
||||
ts = tuple_st;
|
||||
ss = sub_st;
|
||||
}
|
||||
// _POP_TOP_INT
|
||||
{
|
||||
value = ss;
|
||||
assert(PyLong_CheckExact(PyStackRef_AsPyObjectBorrow(value)));
|
||||
PyStackRef_CLOSE_SPECIALIZED(value, _PyLong_ExactDealloc);
|
||||
}
|
||||
// _POP_TOP
|
||||
{
|
||||
value = ts;
|
||||
stack_pointer[-2] = res;
|
||||
stack_pointer += -1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
_PyStackRef tmp = tuple_st;
|
||||
tuple_st = res;
|
||||
stack_pointer[-1] = tuple_st;
|
||||
PyStackRef_CLOSE(tmp);
|
||||
PyStackRef_XCLOSE(value);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
}
|
||||
DISPATCH();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue