Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Aug 12, 2024

  • 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
Contributor Author

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

@DinoV DinoV left a comment

Choose a reason for hiding this comment

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

LGTM!

int
_PyGC_VisitFrameStack(_PyInterpreterFrame *frame, visitproc visit, void *arg)
{
_PyStackRef *ref = frame->localsplus;
Copy link
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?

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

🤖 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-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Aug 13, 2024
@colesbury colesbury enabled auto-merge (squash) August 15, 2024 16:08
@colesbury colesbury merged commit e001027 into python:main Aug 15, 2024
35 checks passed
@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 free to 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