From 5ac9e6eee5ed18172d70d28cf438df0be4e3b83d Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Tue, 10 Jul 2018 17:19:53 +0900 Subject: bpo-33597: Reduce PyGC_Head size (GH-7043) --- Objects/object.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Objects') diff --git a/Objects/object.c b/Objects/object.c index 3eb4810bd9..2471f6b058 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -284,8 +284,9 @@ PyObject_CallFinalizer(PyObject *self) return; tp->tp_finalize(self); - if (PyType_IS_GC(tp)) - _PyGC_SET_FINALIZED(self, 1); + if (PyType_IS_GC(tp)) { + _PyGC_SET_FINALIZED(self); + } } int @@ -2095,7 +2096,7 @@ _PyTrash_deposit_object(PyObject *op) assert(PyObject_IS_GC(op)); assert(!_PyObject_GC_IS_TRACKED(op)); assert(op->ob_refcnt == 0); - _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyRuntime.gc.trash_delete_later; + _PyGCHead_SET_PREV(_Py_AS_GC(op), _PyRuntime.gc.trash_delete_later); _PyRuntime.gc.trash_delete_later = op; } @@ -2107,7 +2108,7 @@ _PyTrash_thread_deposit_object(PyObject *op) assert(PyObject_IS_GC(op)); assert(!_PyObject_GC_IS_TRACKED(op)); assert(op->ob_refcnt == 0); - _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *) tstate->trash_delete_later; + _PyGCHead_SET_PREV(_Py_AS_GC(op), tstate->trash_delete_later); tstate->trash_delete_later = op; } @@ -2122,7 +2123,7 @@ _PyTrash_destroy_chain(void) destructor dealloc = Py_TYPE(op)->tp_dealloc; _PyRuntime.gc.trash_delete_later = - (PyObject*) _Py_AS_GC(op)->gc.gc_prev; + (PyObject*) _PyGCHead_PREV(_Py_AS_GC(op)); /* Call the deallocator directly. This used to try to * fool Py_DECREF into calling it indirectly, but @@ -2160,7 +2161,7 @@ _PyTrash_thread_destroy_chain(void) destructor dealloc = Py_TYPE(op)->tp_dealloc; tstate->trash_delete_later = - (PyObject*) _Py_AS_GC(op)->gc.gc_prev; + (PyObject*) _PyGCHead_PREV(_Py_AS_GC(op)); /* Call the deallocator directly. This used to try to * fool Py_DECREF into calling it indirectly, but -- cgit v1.2.1