mirror of
https://github.com/python/cpython.git
synced 2026-04-18 18:01:02 +00:00
gh-134584: JIT: Remove redundant refcounting for UNARY_{INVERT|NEGATIVE} (GH-143704)
This commit is contained in:
parent
9d13ca97c1
commit
548526bbbe
10 changed files with 976 additions and 899 deletions
30
Python/executor_cases.c.h
generated
30
Python/executor_cases.c.h
generated
|
|
@ -2631,11 +2631,12 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _UNARY_NEGATIVE_r11: {
|
||||
case _UNARY_NEGATIVE_r12: {
|
||||
CHECK_CURRENT_CACHED_VALUES(1);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef value;
|
||||
_PyStackRef res;
|
||||
_PyStackRef v;
|
||||
_PyStackRef _stack_item_0 = _tos_cache0;
|
||||
value = _stack_item_0;
|
||||
stack_pointer[0] = value;
|
||||
|
|
@ -2644,20 +2645,18 @@
|
|||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = PyNumber_Negative(PyStackRef_AsPyObjectBorrow(value));
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
stack_pointer += -1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyStackRef_CLOSE(value);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
if (res_o == NULL) {
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
v = value;
|
||||
_tos_cache1 = v;
|
||||
_tos_cache0 = res;
|
||||
_tos_cache1 = PyStackRef_ZERO_BITS;
|
||||
_tos_cache2 = PyStackRef_ZERO_BITS;
|
||||
SET_CURRENT_CACHED_VALUES(1);
|
||||
SET_CURRENT_CACHED_VALUES(2);
|
||||
stack_pointer += -1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
|
@ -3667,11 +3666,12 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _UNARY_INVERT_r11: {
|
||||
case _UNARY_INVERT_r12: {
|
||||
CHECK_CURRENT_CACHED_VALUES(1);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef value;
|
||||
_PyStackRef res;
|
||||
_PyStackRef v;
|
||||
_PyStackRef _stack_item_0 = _tos_cache0;
|
||||
value = _stack_item_0;
|
||||
stack_pointer[0] = value;
|
||||
|
|
@ -3680,20 +3680,18 @@
|
|||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = PyNumber_Invert(PyStackRef_AsPyObjectBorrow(value));
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
stack_pointer += -1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyStackRef_CLOSE(value);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
if (res_o == NULL) {
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
v = value;
|
||||
_tos_cache1 = v;
|
||||
_tos_cache0 = res;
|
||||
_tos_cache1 = PyStackRef_ZERO_BITS;
|
||||
_tos_cache2 = PyStackRef_ZERO_BITS;
|
||||
SET_CURRENT_CACHED_VALUES(1);
|
||||
SET_CURRENT_CACHED_VALUES(2);
|
||||
stack_pointer += -1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue