mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
GH-102300: Reuse objects with refcount == 1 in float specialized binary ops. (GH-102301)
This commit is contained in:
parent
78e4e6c3d7
commit
233e32f936
4 changed files with 27 additions and 24 deletions
15
Python/generated_cases.c.h
generated
15
Python/generated_cases.c.h
generated
|
@ -263,10 +263,7 @@
|
|||
STAT_INC(BINARY_OP, hit);
|
||||
double dprod = ((PyFloatObject *)left)->ob_fval *
|
||||
((PyFloatObject *)right)->ob_fval;
|
||||
prod = PyFloat_FromDouble(dprod);
|
||||
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
|
||||
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
|
||||
if (prod == NULL) goto pop_2_error;
|
||||
DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dprod, prod);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = prod;
|
||||
next_instr += 1;
|
||||
|
@ -300,10 +297,7 @@
|
|||
DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP);
|
||||
STAT_INC(BINARY_OP, hit);
|
||||
double dsub = ((PyFloatObject *)left)->ob_fval - ((PyFloatObject *)right)->ob_fval;
|
||||
sub = PyFloat_FromDouble(dsub);
|
||||
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
|
||||
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
|
||||
if (sub == NULL) goto pop_2_error;
|
||||
DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dsub, sub);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = sub;
|
||||
next_instr += 1;
|
||||
|
@ -372,10 +366,7 @@
|
|||
STAT_INC(BINARY_OP, hit);
|
||||
double dsum = ((PyFloatObject *)left)->ob_fval +
|
||||
((PyFloatObject *)right)->ob_fval;
|
||||
sum = PyFloat_FromDouble(dsum);
|
||||
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
|
||||
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
|
||||
if (sum == NULL) goto pop_2_error;
|
||||
DECREF_INPUTS_AND_REUSE_FLOAT(left, right, dsum, sum);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = sum;
|
||||
next_instr += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue