mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
* Factor shared interpreter stop-the-world guard Move the existing collector barrier into the VM without changing its stop, restart or ownership behavior, preparing reuse by fork. Assisted-by: dot:GPT-6.1 * Add interpreter-bound operation section primitive Prepare attached-only ownership acquisition and detached observer parking with private per-interpreter scope stacks. Lifecycle wiring follows separately; no profiler consumer is enabled by this commit. Assisted-by: dot:GPT-6.1 * Suspend operation sections at VM lifecycle boundaries Integrate detach, stop-the-world, shutdown and interpreter-switch boundaries. Reuse the all-interpreter barrier for fork repair and add focused native ownership invariants. Assisted-by: dot:GPT-6.1 * Replace operation sections with PyMutex critical sections Add PyMutex with the lock.c protocol: LOCKED/HAS_PARKED bits, a bounded spin, direct handoff to waiters parked longer than 1 ms, and detaching while parked. Rebuild critical sections on PyMutex with the stack kept as a tagged pointer in ThreadSlot: single and two-mutex sections, recursive top-most skipping, locking skipped while the world is stopped, SuspendAll on detach/suspend/shutdown and Resume of the top-most section on attach. Fork carries the stacks into the replacement slots. Assisted-by: Claude Code:claude-opus-5-5 * Check attachment around critical-section suspension Assert that a thread entering a critical section is attached, and suspend sections in do_suspend only while the slot is still ATTACHED. Assisted-by: Claude Code:claude-opus-5-5 --------- Co-authored-by: Jeong YunWon <jeong@youknowone.org>