Skip to content

gh-117139: Garbage collector support for deferred refcounting - #122956

Merged
colesbury merged 3 commits into
python:mainfrom
colesbury:gh-117139-deferred-gc
Aug 15, 2024
Merged

gh-117139: Garbage collector support for deferred refcounting#122956
colesbury merged 3 commits into
python:mainfrom
colesbury:gh-117139-deferred-gc

Conversation

@colesbury

@colesburycolesbury commented Aug 12, 2024

Copy link
Copy Markdown
Contributor
  • The free-threaded GC now visits interpreter stacks to keep objects that use deferred reference counting alive.

  • Interpreter frames are zero initialized in the free-threaded GC so that the GC doesn't see garbage data. This is a temporary measure until stack spilling around escaping calls is implemented.

* The free-threaded GC now visits interpreter stacks to keep objects
that use deferred reference counting alive.
* Interpreter frames are zero initialized in the free-threaded GC so
that the GC doesn't see garbage data. This is a temporary measure
until stack spilling around escaping calls is implemented.
Co-authored-by: Ken Jin <kenjin@python.org>
@colesbury

Copy link
Copy Markdown
ContributorAuthor

@colesbury
colesbury marked this pull request as ready for review August 12, 2024 20:42

@DinoVDinoV left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment threadPython/gc_free_threading.c Outdated
int
_PyGC_VisitFrameStack(_PyInterpreterFrame *frame, visitproc visit, void *arg)
{
_PyStackRef *ref = frame->localsplus;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use _PyFrame_GetLocalsArray like the GIL version just to be consistent?

@colesburycolesbury added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Aug 13, 2024
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @colesbury for commit 5b9176b 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Aug 13, 2024
Comment threadInclude/internal/pycore_gc.h
Comment threadPython/gc_free_threading.c
@colesbury
colesbury enabled auto-merge (squash) August 15, 2024 16:08
@colesbury
colesbury merged commit e001027 into python:mainAug 15, 2024
@colesbury
colesbury deleted the gh-117139-deferred-gc branch August 15, 2024 16:10
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
…ython#122956)
The free-threaded GC now visits interpreter stacks to keep objects
that use deferred reference counting alive.
Interpreter frames are zero initialized in the free-threaded GC so
that the GC doesn't see garbage data. This is a temporary measure
until stack spilling around escaping calls is implemented.
Co-authored-by: Ken Jin <kenjin@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@colesbury@bedevere-bot@DinoV@kumaraditya303