mirror of https://github.com/python/cpython
gh-117657: use relaxed loads for checking dict keys immortality (#118067)
Use relaxed load to check if dictkeys are immortal
This commit is contained in:
parent
8d4a244f15
commit
1e4a4c4897
|
@ -441,7 +441,7 @@ static void free_keys_object(PyDictKeysObject *keys, bool use_qsbr);
|
||||||
static inline void
|
static inline void
|
||||||
dictkeys_incref(PyDictKeysObject *dk)
|
dictkeys_incref(PyDictKeysObject *dk)
|
||||||
{
|
{
|
||||||
if (dk->dk_refcnt == _Py_IMMORTAL_REFCNT) {
|
if (FT_ATOMIC_LOAD_SSIZE_RELAXED(dk->dk_refcnt) == _Py_IMMORTAL_REFCNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef Py_REF_DEBUG
|
#ifdef Py_REF_DEBUG
|
||||||
|
@ -453,7 +453,7 @@ dictkeys_incref(PyDictKeysObject *dk)
|
||||||
static inline void
|
static inline void
|
||||||
dictkeys_decref(PyInterpreterState *interp, PyDictKeysObject *dk, bool use_qsbr)
|
dictkeys_decref(PyInterpreterState *interp, PyDictKeysObject *dk, bool use_qsbr)
|
||||||
{
|
{
|
||||||
if (dk->dk_refcnt == _Py_IMMORTAL_REFCNT) {
|
if (FT_ATOMIC_LOAD_SSIZE_RELAXED(dk->dk_refcnt) == _Py_IMMORTAL_REFCNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(dk->dk_refcnt > 0);
|
assert(dk->dk_refcnt > 0);
|
||||||
|
|
|
@ -29,8 +29,6 @@ race:_PyType_HasFeature
|
||||||
race:assign_version_tag
|
race:assign_version_tag
|
||||||
race:compare_unicode_unicode
|
race:compare_unicode_unicode
|
||||||
race:delitem_common
|
race:delitem_common
|
||||||
race:dictkeys_decref
|
|
||||||
race:dictkeys_incref
|
|
||||||
race:dictresize
|
race:dictresize
|
||||||
race:gc_collect_main
|
race:gc_collect_main
|
||||||
race:gc_restore_tid
|
race:gc_restore_tid
|
||||||
|
|
Loading…
Reference in New Issue