Repository navigation
Per-interpreter runtime state and a process-wide GC stop-the-world #8517
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
Merged
youknowone
merged 27 commits into
RustPython:main
from
youknowone:subinterpreter-foundation
Aug 16, 2026
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
5c341d2
vm: add per-interpreter runtime state and interpreter registry
youknowone 43f4b23
gc: stop every interpreter while collecting
youknowone ffd3d1e
vm: scope the interpreter registry per thread without threading
youknowone 0079994
vm: keep the interpreter registry usable across bootstrap, drop and fork
youknowone 8f108ff
vm: attach and detach thread slots when switching interpreters
youknowone 696a8c1
vm: list only the current interpreter's subclasses
youknowone 562b657
gc: give each interpreter its own collector state
youknowone 30e2020
_queue, _thread: detach before taking locks held across waits
youknowone 5ce062e
_io, _winapi: detach on the remaining stopped-holdable lock takes
youknowone 87b6c68
gc: size the interpreter owner tag to the header padding
youknowone fd27902
vm: reuse cleared frame blocks and shorten interpreter hot paths
youknowone c3fcc70
gc, vm: address review notes on owner tags and interpreter docs
youknowone 57428cd
vm: gate interpreter registration on stop-the-world admission
youknowone 8d07831
gc: keep the tracking counters off the barrier path
youknowone 4e518d3
dict: settle lookups and iteration steps under one read guard
youknowone eb94daf
vm: build a call's argument vector once
youknowone f70db35
vm: reach an instance dict without cloning it
youknowone 4a76424
vm: shorten the per-instruction safepoint and the call preamble
youknowone b0f0dcc
vm: give KwArgs a zero-sized hasher
youknowone f9bbc6d
vm: promote borrowed stack refs before a yield
youknowone b4bb43c
vm: run the exact-args vectorcall on a heap frame again
youknowone 98d2410
vm: release a tail call's function at the callee's return
youknowone 08bd522
vm: stop copying a running frame's locals when it materializes
youknowone c7c1452
vm: key data stack frame reuse on the exact frame size
youknowone 2d58fc8
vm: store the frame object payload address in the cross-thread slot
youknowone e24d831
vm: copy a foreign thread's frames instead of linking them
youknowone 5d0d9be
vm: resolve the two rustdoc links this branch added
youknowone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
vm: add per-interpreter runtime state and interpreter registry
- vm/runtime.rs: process-global interpreter registry (monotonic ids, weak entries), InterpreterWhence/InterpreterInfo, process main id recording via main_interpreter_id(), a threading-gated owner map (store_owned_interpreter/ take_owned_interpreter/is_owned_interpreter/owned_interpreter_count), and the SUPPORTS_ISOLATED_INTERPRETERS constant. - PyGlobalState gains interpreter_id/whence/is_main and is_main_interpreter(); PyConfig/Settings derive Clone so a subinterpreter can clone parent config. - Interpreter: id()/whence()/is_main()/is_process_main(), create_subinterpreter() and create_owned_subinterpreter(); unregister on Drop. - thread.rs: per-interpreter thread slots (INTERP_THREAD_SLOTS), slot swap when switching interpreters on one OS thread, cleanup keyed by interpreter id. - Install signal handlers and init the main-thread ident only on the main interpreter; _thread._is_main_interpreter reflects the current interpreter. - sys.implementation.supports_isolated_interpreters reads the constant. - Guard the registry static for non-threading builds where rc::Weak is !Send. Assisted-by: Claude Code:claude-opus-4-8
- Loading branch information
commit 5c341d263e9b14263fa2b77046c2d46a2bd44f2c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳