summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-09-23 18:10:55 (GMT)
committerGitHub <noreply@github.com>2024-09-23 18:10:55 (GMT)
commitc87b0e4a462f98c418f750c6c95d4d8715c38332 (patch)
treedb3da84964d8494fb12937c4ffcafe85001cd962 /Include/internal
parent6203ef35dd4ee9dd59759ce83eace8eacac69685 (diff)
downloadcpython-c87b0e4a462f98c418f750c6c95d4d8715c38332.zip
cpython-c87b0e4a462f98c418f750c6c95d4d8715c38332.tar.gz
cpython-c87b0e4a462f98c418f750c6c95d4d8715c38332.tar.bz2
GH-124284: Add stats for refcount operations on immortal objects (GH-124288)
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_object.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index ad92a74..0d885b4 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -214,6 +214,7 @@ static inline void
_Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct)
{
if (_Py_IsImmortal(op)) {
+ _Py_DECREF_IMMORTAL_STAT_INC();
return;
}
_Py_DECREF_STAT_INC();
@@ -235,6 +236,7 @@ static inline void
_Py_DECREF_NO_DEALLOC(PyObject *op)
{
if (_Py_IsImmortal(op)) {
+ _Py_DECREF_IMMORTAL_STAT_INC();
return;
}
_Py_DECREF_STAT_INC();
@@ -315,6 +317,7 @@ _Py_INCREF_TYPE(PyTypeObject *type)
{
if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
assert(_Py_IsImmortalLoose(type));
+ _Py_INCREF_IMMORTAL_STAT_INC();
return;
}
@@ -355,6 +358,7 @@ _Py_DECREF_TYPE(PyTypeObject *type)
{
if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
assert(_Py_IsImmortalLoose(type));
+ _Py_DECREF_IMMORTAL_STAT_INC();
return;
}
@@ -511,6 +515,7 @@ _Py_TryIncrefFast(PyObject *op) {
local += 1;
if (local == 0) {
// immortal
+ _Py_INCREF_IMMORTAL_STAT_INC();
return 1;
}
if (_Py_IsOwnedByCurrentThread(op)) {