File tree 3 files changed +336
-22
lines changed
Misc/NEWS.d/next/Core_and_Builtins
3 files changed +336
-22
lines changed Original file line number Diff line number Diff line change @@ -45,12 +45,13 @@ static inline PyObject* _Py_FROM_GC(PyGC_Head *gc) {
45
45
* the per-object lock.
46
46
*/
47
47
#ifdef Py_GIL_DISABLED
48
- # define _PyGC_BITS_TRACKED (1) // Tracked by the GC
49
- # define _PyGC_BITS_FINALIZED (2) // tp_finalize was called
50
- # define _PyGC_BITS_UNREACHABLE (4)
51
- # define _PyGC_BITS_FROZEN (8)
52
- # define _PyGC_BITS_SHARED (16)
53
- # define _PyGC_BITS_DEFERRED (64) // Use deferred reference counting
48
+ # define _PyGC_BITS_TRACKED (1<<0) // Tracked by the GC
49
+ # define _PyGC_BITS_FINALIZED (1<<1) // tp_finalize was called
50
+ # define _PyGC_BITS_UNREACHABLE (1<<2)
51
+ # define _PyGC_BITS_FROZEN (1<<3)
52
+ # define _PyGC_BITS_SHARED (1<<4)
53
+ # define _PyGC_BITS_ALIVE (1<<5) // Reachable from a known root.
54
+ # define _PyGC_BITS_DEFERRED (1<<6) // Use deferred reference counting
54
55
#endif
55
56
56
57
#ifdef Py_GIL_DISABLED
@@ -330,6 +331,9 @@ struct _gc_runtime_state {
330
331
collections, and are awaiting to undergo a full collection for
331
332
the first time. */
332
333
Py_ssize_t long_lived_pending ;
334
+
335
+ /* True if gc.freeze() has been used. */
336
+ int freeze_active ;
333
337
#endif
334
338
};
335
339
Original file line number Diff line number Diff line change
1
+ Add a marking phase to the free-threaded GC. This is similar to what was
2
+ done in GH-126491. Since the free-threaded GC does not have generations and
3
+ is not incremental, the marking phase looks for all objects reachable from
4
+ known roots. The roots are objects known to not be garbage, like the module
5
+ dictionary for :mod: `sys `. For most programs, this marking phase should
6
+ make the GC a bit faster since typically less work is done per object.
You can’t perform that action at this time.
0 commit comments