File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ static inline void _PyObject_GC_SET_SHARED(PyObject *op) {
133133*/
134134#define _PyGC_NEXT_MASK_OLD_SPACE_1 1
135135
136- #define _PyGC_PREV_SHIFT _PyObject_ALIGNMENT_SHIFT
136+ #define _PyGC_PREV_SHIFT 2
137137#define _PyGC_PREV_MASK (((uintptr_t) -1) << _PyGC_PREV_SHIFT)
138138
139139/* set for debugging information */
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ struct atexit_state {
159159typedef struct {
160160 // Tagged pointer to next object in the list.
161161 // 0 means the object is not tracked
162- _Py_ALIGNED_DEF (1 << _PyObject_ALIGNMENT_SHIFT , uintptr_t ) _gc_next ;
162+ _Py_ALIGNED_DEF (_PyObject_MIN_ALIGNMENT , uintptr_t ) _gc_next ;
163163
164164 // Tagged pointer to previous object in the list.
165165 // Lowest two bits are used for flags documented later.
Original file line number Diff line number Diff line change @@ -103,8 +103,9 @@ whose size is determined when the object is allocated.
103103
104104/* PyObjects are given a minimum alignment so that the least significant bits
105105 * of an object pointer become available for other purposes.
106+ * This must be an integer literal with the value (1 << _PyGC_PREV_SHIFT)
106107 */
107- #define _PyObject_ALIGNMENT_SHIFT 2
108+ #define _PyObject_MIN_ALIGNMENT 4
108109
109110/* Nothing is actually declared to be a PyObject, but every pointer to
110111 * a Python object can be cast to a PyObject*. This is inheritance built
@@ -141,7 +142,7 @@ struct _object {
141142#else
142143 Py_ssize_t ob_refcnt ;
143144#endif
144- _Py_ALIGNED_DEF (1 << _PyObject_ALIGNMENT_SHIFT , char ) _aligner ;
145+ _Py_ALIGNED_DEF (_PyObject_MIN_ALIGNMENT , char ) _aligner ;
145146 };
146147#ifdef _MSC_VER
147148 __pragma (warning (pop ))
@@ -159,7 +160,7 @@ struct _object {
159160 // ob_tid stores the thread id (or zero). It is also used by the GC and the
160161 // trashcan mechanism as a linked list pointer and by the GC to store the
161162 // computed "gc_refs" refcount.
162- _Py_ALIGNED_DEF (1 << _PyObject_ALIGNMENT_SHIFT , uintptr_t ) ob_tid ;
163+ _Py_ALIGNED_DEF (_PyObject_MIN_ALIGNMENT , uintptr_t ) ob_tid ;
163164 uint16_t ob_flags ;
164165 PyMutex ob_mutex ; // per-object lock
165166 uint8_t ob_gc_bits ; // gc-related state
You can’t perform that action at this time.
0 commit comments