summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_object.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-11-18 14:31:26 (GMT)
committerGitHub <noreply@github.com>2024-11-18 14:31:26 (GMT)
commitb0fcc2c47a34a69c35c1a8031cd0589d3747c1af (patch)
treeaa9d4bfaf49dca8d3ce47aa18a03cf2d5374a8e2 /Include/internal/pycore_object.h
parenta1d9c8aa800dd7c9eb634f89646be10e9cfc9c8d (diff)
downloadcpython-b0fcc2c47a34a69c35c1a8031cd0589d3747c1af.zip
cpython-b0fcc2c47a34a69c35c1a8031cd0589d3747c1af.tar.gz
cpython-b0fcc2c47a34a69c35c1a8031cd0589d3747c1af.tar.bz2
GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-126502)
* Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Remove lazy dict tracking * Update docs * Clearer calculation of work to do.
Diffstat (limited to 'Include/internal/pycore_object.h')
-rw-r--r--Include/internal/pycore_object.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index c7af720..0cba7bc 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -466,8 +466,8 @@ static inline void _PyObject_GC_TRACK(
PyGC_Head *last = (PyGC_Head*)(generation0->_gc_prev);
_PyGCHead_SET_NEXT(last, gc);
_PyGCHead_SET_PREV(gc, last);
- /* Young objects will be moved into the visited space during GC, so set the bit here */
- gc->_gc_next = ((uintptr_t)generation0) | (uintptr_t)interp->gc.visited_space;
+ uintptr_t not_visited = 1 ^ interp->gc.visited_space;
+ gc->_gc_next = ((uintptr_t)generation0) | not_visited;
generation0->_gc_prev = (uintptr_t)gc;
#endif
}