mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-122417: Implement per-thread heap type refcounts (#122418)
The free-threaded build partially stores heap type reference counts in distributed manner in per-thread arrays. This avoids reference count contention when creating or destroying instances. Co-authored-by: Ken Jin <kenjin@python.org>
This commit is contained in:
parent
1429651a06
commit
dc09301067
18 changed files with 427 additions and 69 deletions
|
@ -35,6 +35,7 @@ extern "C" {
|
|||
#include "pycore_qsbr.h" // struct _qsbr_state
|
||||
#include "pycore_tstate.h" // _PyThreadStateImpl
|
||||
#include "pycore_tuple.h" // struct _Py_tuple_state
|
||||
#include "pycore_typeid.h" // struct _Py_type_id_pool
|
||||
#include "pycore_typeobject.h" // struct types_state
|
||||
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
|
||||
#include "pycore_warnings.h" // struct _warnings_runtime_state
|
||||
|
@ -220,6 +221,7 @@ struct _is {
|
|||
#if defined(Py_GIL_DISABLED)
|
||||
struct _mimalloc_interp_state mimalloc;
|
||||
struct _brc_state brc; // biased reference counting state
|
||||
struct _Py_type_id_pool type_ids;
|
||||
PyMutex weakref_locks[NUM_WEAKREF_LIST_LOCKS];
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue