Use _PyInterpreterFrame.stackpointer
in free threaded GC when traversing threads' stacks
#129236
Labels
_PyInterpreterFrame.stackpointer
in free threaded GC when traversing threads' stacks
#129236
Feature or enhancement
The free threading GC traverses the active frames of threads in two places:
GC_MARK_ALIVE_STACKS
during the marking phase (see Add marking phase to free-threaded cyclic GC #128807)deduce_unreachable_heap
to ensure that deferred reference counted objects are kept alive.Previously, the frame's stackpointer was frequently not set during GC. To avoid missing some deferred references, we looked at the frame up to the maximum size (
co->co_stacksize
). That behavior isn't great:Now that the frame's stackpointer is nearly always set during GC, we should only look at the frame up to
f->stackpointer
. There are still some cases where the stackpointer isn't set currently; we'll (temporarily) need some fallback for those cases. Once the stackpointer is always valid during GC (ideally before the 3.14 release), we can remove the fallback and assert thatf->stackpointer
is notNULL
.cc @nascheme
Linked PRs
stackpointer
in free threaded GC #129240The text was updated successfully, but these errors were encountered: