diff options
author | Sam Gross <colesbury@gmail.com> | 2023-10-30 16:06:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-30 16:06:09 (GMT) |
commit | 6dfb8fe0236718e9afc8136ff2b58dcfbc182022 (patch) | |
tree | 1b5ad337bc68ebc2ff1325c0b695807c48640d30 /Python | |
parent | 05f2f0ac92afa560315eb66fd6576683c7f69e2d (diff) | |
download | cpython-6dfb8fe0236718e9afc8136ff2b58dcfbc182022.zip cpython-6dfb8fe0236718e9afc8136ff2b58dcfbc182022.tar.gz cpython-6dfb8fe0236718e9afc8136ff2b58dcfbc182022.tar.bz2 |
gh-110481: Implement biased reference counting (gh-110764)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 3 | ||||
-rw-r--r-- | Python/instrumentation.c | 12 | ||||
-rw-r--r-- | Python/specialize.c | 2 |
3 files changed, 5 insertions, 12 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index e3a7c5f..6f8584c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -46,12 +46,13 @@ # error "ceval.c must be build with Py_BUILD_CORE define for best performance" #endif -#if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) +#if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_NOGIL) // GH-89279: The MSVC compiler does not inline these static inline functions // in PGO build in _PyEval_EvalFrameDefault(), because this function is over // the limit of PGO, and that limit cannot be configured. // Define them as macros to make sure that they are always inlined by the // preprocessor. +// TODO: implement Py_DECREF macro for Py_NOGIL #undef Py_DECREF #define Py_DECREF(arg) \ diff --git a/Python/instrumentation.c b/Python/instrumentation.c index 5fd65d5..9ee1158 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -19,17 +19,9 @@ /* Uncomment this to dump debugging output when assertions fail */ // #define INSTRUMENT_DEBUG 1 -PyObject _PyInstrumentation_DISABLE = -{ - .ob_refcnt = _Py_IMMORTAL_REFCNT, - .ob_type = &PyBaseObject_Type -}; +PyObject _PyInstrumentation_DISABLE = _PyObject_HEAD_INIT(&PyBaseObject_Type); -PyObject _PyInstrumentation_MISSING = -{ - .ob_refcnt = _Py_IMMORTAL_REFCNT, - .ob_type = &PyBaseObject_Type -}; +PyObject _PyInstrumentation_MISSING = _PyObject_HEAD_INIT(&PyBaseObject_Type); static const int8_t EVENT_FOR_OPCODE[256] = { [RETURN_CONST] = PY_MONITORING_EVENT_PY_RETURN, diff --git a/Python/specialize.c b/Python/specialize.c index 07fd93d..d74c4c5 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -2525,7 +2525,7 @@ static const PyBytesObject no_location = { }; const struct _PyCode_DEF(8) _Py_InitCleanup = { - _PyVarObject_HEAD_INIT(&PyCode_Type, 3) + _PyVarObject_HEAD_INIT(&PyCode_Type, 3), .co_consts = (PyObject *)&_Py_SINGLETON(tuple_empty), .co_names = (PyObject *)&_Py_SINGLETON(tuple_empty), .co_exceptiontable = (PyObject *)&_Py_SINGLETON(bytes_empty), |