Commit Graph

18 Commits

Author SHA1 Message Date
Neil Schemenauer fbbbc10055
gh-127266: avoid data races when updating type slots (gh-133177)
In the free-threaded build, avoid data races caused by updating type
slots or type flags after the type was initially created.  For those
(typically rare) cases, use the stop-the-world mechanism.  Remove the
use of atomics when reading or writing type flags.
2025-05-27 18:27:41 -07:00
Neil Schemenauer eecafc3380
Revert gh-127266: avoid data races when updating type slots (gh-131174) (gh-133129)
This is triggering deadlocks in test_opcache.  See GH-133130 for stack trace.
2025-04-28 23:38:29 -07:00
Neil Schemenauer e414a2d81c
gh-127266: avoid data races when updating type slots (gh-131174)
In the free-threaded build, avoid data races caused by updating type slots
or type flags after the type was initially created.  For those (typically
rare) cases, use the stop-the-world mechanism.  Remove the use of atomics
when reading or writing type flags.  The use of atomics is not sufficient to
avoid races (since flags are sometimes read without a lock and without
atomics) and are no longer required.
2025-04-28 20:28:44 +00:00
Mark Shannon fd545d735d
GH-127705: Move mortal decrefs to internal header and make sure _PyReftracerTrack is called 2025-03-17 17:23:50 +00:00
Mark Shannon 9881fc5483
GH-125174: Make immortality "sticky" (GH-131355)
* Use a higher threshold for immortality for INCREF than DECREF
2025-03-17 17:22:35 +00:00
Mark Shannon 67af96c61c
GH-127705: Handle trace refs in specialized decref (GH-131198)
This is missing `_PyReftracerTrack` calls, see gh-131238.
Merging as-is for the 3.14.0a6 release.
2025-03-14 13:02:09 +01:00
Mark Shannon 2250ab6a13
GH-125174 Revert: Make immortality "sticky" (GH-131184)" (#131230)
Revert "GH-125174: Make immortality "sticky" (GH-131184)"

This reverts commit 3a91ee9724.
2025-03-14 13:13:47 +02:00
Mark Shannon 3a91ee9724
GH-125174: Make immortality "sticky" (GH-131184) 2025-03-13 16:10:13 +00:00
Mark Shannon f30376c650
GH-127705: Fix _Py_RefcntAdd to handle objects becoming immortal (GH-131140) 2025-03-12 16:54:10 +00:00
Mark Shannon 6e5b9f3d00
GH-127705: Check for immortality in refcount accounting (#131072)
Check for immortality in refcount accounting
2025-03-11 11:53:07 +00:00
Mark Shannon 2bef8ea8ea
GH-127705: Use `_PyStackRef`s in the default build. (GH-127875) 2025-03-10 14:06:56 +00:00
Justine Krejcha 31ef8fd8e2
Fix a typo in `Py_DECREF` comment (#128387) 2025-02-25 11:10:40 +01:00
Mark Shannon 9b4bbf4401
GH-125174: Don't use `UINT32_MAX` in header file (GH-127863) 2024-12-13 10:54:59 +01:00
Mark Shannon bc262de06b
GH-125174: Mark objects as statically allocated. (#127797)
* Set a bit in the unused part of the refcount on 64 bit machines and the free-threaded build.

* Use the top of the refcount range on 32 bit machines
2024-12-11 17:37:38 +00:00
Mark Shannon c9014374c5
GH-125174: Make immortal objects more robust, following design from PEP 683 (GH-125251) 2024-10-10 18:19:08 +01:00
Victor Stinner 9d344fafc4
gh-124127: Make Py_REFCNT() opaque in limited C API 3.14 (#124128) 2024-09-24 08:42:58 +02:00
Mark Shannon c87b0e4a46
GH-124284: Add stats for refcount operations on immortal objects (GH-124288) 2024-09-23 19:10:55 +01:00
Victor Stinner 891c1e36f4
gh-119853: Add Include/refcount.h file (#119854) 2024-05-31 16:49:26 +02:00