diff options
author | Sam Gross <colesbury@gmail.com> | 2024-02-01 20:29:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-01 20:29:19 (GMT) |
commit | 587d4802034749e2aace9c00b00bd73eccdae1e7 (patch) | |
tree | ba760dcffd508c28bb8ed42930bd7fba009dd38a /Include/object.h | |
parent | 500ede01178a8063bb2a3c664172dffa1b40d7c9 (diff) | |
download | cpython-587d4802034749e2aace9c00b00bd73eccdae1e7.zip cpython-587d4802034749e2aace9c00b00bd73eccdae1e7.tar.gz cpython-587d4802034749e2aace9c00b00bd73eccdae1e7.tar.bz2 |
gh-112529: Remove PyGC_Head from object pre-header in free-threaded build (#114564)
* gh-112529: Remove PyGC_Head from object pre-header in free-threaded build
This avoids allocating space for PyGC_Head in the free-threaded build.
The GC implementation for free-threaded CPython does not use the
PyGC_Head structure.
* The trashcan mechanism uses the `ob_tid` field instead of `_gc_prev`
in the free-threaded build.
* The GDB libpython.py file now determines the offset of the managed
dict field based on whether the running process is a free-threaded
build. Those are identified by the `ob_ref_local` field in PyObject.
* Fixes `_PySys_GetSizeOf()` which incorrectly incorrectly included the
size of `PyGC_Head` in the size of static `PyTypeObject`.
Diffstat (limited to 'Include/object.h')
-rw-r--r-- | Include/object.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Include/object.h b/Include/object.h index 568d315..05187fe 100644 --- a/Include/object.h +++ b/Include/object.h @@ -212,8 +212,9 @@ struct _object { struct _PyMutex { uint8_t v; }; struct _object { - // ob_tid stores the thread id (or zero). It is also used by the GC to - // store linked lists and the computed "gc_refs" refcount. + // ob_tid stores the thread id (or zero). It is also used by the GC and the + // trashcan mechanism as a linked list pointer and by the GC to store the + // computed "gc_refs" refcount. uintptr_t ob_tid; uint16_t _padding; struct _PyMutex ob_mutex; // per-object lock |