Skip to content

Commit 474fed8

Browse files
committed
Address code review
1 parent c966005 commit 474fed8

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎Objects/object.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3307,7 +3307,7 @@ To avoid that, if the C stack is nearing its limit, instead of calling
33073307
dealloc on the object, it is added to a queue to be freed later when the
33083308
stack is shallower */
33093309
static Py_NO_INLINE void
3310-
dealloc_general(PyObject *op)
3310+
py_dealloc(PyObject *op)
33113311
{
33123312
PyTypeObject *type = Py_TYPE(op);
33133313
unsigned long gc_flag = type->tp_flags & Py_TPFLAGS_HAVE_GC;
@@ -3372,11 +3372,16 @@ dealloc_general(PyObject *op)
33723372
}
33733373
}
33743374

3375+
/*
3376+
* gh-130706: Keep the GC/reftracer path in the non-inlined py_dealloc().
3377+
* Inlining it makes the compiler save callee-saved registers at entry,
3378+
* so the non-GC objects path would have unnecessary register spills.
3379+
*/
33753380
void
33763381
_Py_Dealloc(PyObject *op)
33773382
{
33783383
#if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS)
3379-
// gh-130706: Remove unnecessary stack frame for non-GC objects.
3384+
// gh-130706: Avoid unnecessary register spills for non-GC objects.
33803385
PyTypeObject *type = Py_TYPE(op);
33813386
if (_PyRuntime.ref_tracer.tracer_func == NULL
33823387
&& !(type->tp_flags & Py_TPFLAGS_HAVE_GC))
@@ -3386,7 +3391,7 @@ _Py_Dealloc(PyObject *op)
33863391
}
33873392
#endif
33883393
// GC objects (trashcan), reftracer set, or debug builds.
3389-
dealloc_general(op);
3394+
py_dealloc(op);
33903395
}
33913396

33923397

0 commit comments

Comments
 (0)