mirror of
https://github.com/python/cpython.git
synced 2026-02-05 17:35:34 +00:00
gh-144007: Eliminate redundant refcounting in the JIT for BINARY_OP (GH-144011)
This commit is contained in:
parent
29f1e778fa
commit
4e10fa993a
11 changed files with 105 additions and 48 deletions
27
Python/generated_cases.c.h
generated
27
Python/generated_cases.c.h
generated
|
|
@ -32,6 +32,9 @@
|
|||
_PyStackRef lhs;
|
||||
_PyStackRef rhs;
|
||||
_PyStackRef res;
|
||||
_PyStackRef l;
|
||||
_PyStackRef r;
|
||||
_PyStackRef value;
|
||||
// _SPECIALIZE_BINARY_OP
|
||||
{
|
||||
rhs = stack_pointer[-1];
|
||||
|
|
@ -65,18 +68,26 @@
|
|||
JUMP_TO_LABEL(error);
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
l = lhs;
|
||||
r = rhs;
|
||||
}
|
||||
// _POP_TOP
|
||||
{
|
||||
value = r;
|
||||
stack_pointer[-2] = res;
|
||||
stack_pointer[-1] = l;
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
_PyStackRef tmp = lhs;
|
||||
lhs = res;
|
||||
stack_pointer[-2] = lhs;
|
||||
PyStackRef_CLOSE(tmp);
|
||||
tmp = rhs;
|
||||
rhs = PyStackRef_NULL;
|
||||
stack_pointer[-1] = rhs;
|
||||
PyStackRef_CLOSE(tmp);
|
||||
PyStackRef_XCLOSE(value);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
}
|
||||
// _POP_TOP
|
||||
{
|
||||
value = l;
|
||||
stack_pointer += -1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyStackRef_XCLOSE(value);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
}
|
||||
DISPATCH();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue