| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -151,7 +151,7 @@ struct _ts { | |||
| 151 | 151 | ||
| 152 | 152 | /* Tagged pointer to top-most critical section, or zero if there is no | |
| 153 | 153 | * active critical section. Critical sections are only used in | |
| 154 | - * `--disable-gil` builds (i.e., when Py_NOGIL is defined to 1). In the | ||
| 154 | + * `--disable-gil` builds (i.e., when Py_GIL_DISABLED is defined to 1). In the | ||
| 155 | 155 | * default build, this field is always zero. | |
| 156 | 156 | */ | |
| 157 | 157 | uintptr_t critical_section; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,7 +86,7 @@ extern "C" { | |||
| 86 | 86 | #define _Py_CRITICAL_SECTION_TWO_MUTEXES 0x2 | |
| 87 | 87 | #define _Py_CRITICAL_SECTION_MASK 0x3 | |
| 88 | 88 | ||
| 89 | - #ifdef Py_NOGIL | ||
| 89 | + #ifdef Py_GIL_DISABLED | ||
| 90 | 90 | # define Py_BEGIN_CRITICAL_SECTION(op) \ | |
| 91 | 91 | { \ | |
| 92 | 92 | _PyCriticalSection _cs; \ | |
@@ -104,13 +104,13 @@ extern "C" { | |||
| 104 | 104 | # define Py_END_CRITICAL_SECTION2() \ | |
| 105 | 105 | _PyCriticalSection2_End(&_cs2); \ | |
| 106 | 106 | } | |
| 107 | - #else /* !Py_NOGIL */ | ||
| 107 | + #else /* !Py_GIL_DISABLED */ | ||
| 108 | 108 | // The critical section APIs are no-ops with the GIL. | |
| 109 | 109 | # define Py_BEGIN_CRITICAL_SECTION(op) | |
| 110 | 110 | # define Py_END_CRITICAL_SECTION() | |
| 111 | 111 | # define Py_BEGIN_CRITICAL_SECTION2(a, b) | |
| 112 | 112 | # define Py_END_CRITICAL_SECTION2() | |
| 113 | - #endif /* !Py_NOGIL */ | ||
| 113 | + #endif /* !Py_GIL_DISABLED */ | ||
| 114 | 114 | ||
| 115 | 115 | typedef struct { | |
| 116 | 116 | // Tagged pointer to an outer active critical section (or 0). | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,7 @@ typedef FARPROC dl_funcptr; | |||
| 31 | 31 | # define PYD_DEBUG_SUFFIX "" | |
| 32 | 32 | #endif | |
| 33 | 33 | ||
| 34 | - #ifdef Py_NOGIL | ||
| 34 | + #ifdef Py_GIL_DISABLED | ||
| 35 | 35 | # define PYD_THREADING_TAG "t" | |
| 36 | 36 | #else | |
| 37 | 37 | # define PYD_THREADING_TAG "" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,11 +33,11 @@ extern "C" { | |||
| 33 | 33 | // ... | |
| 34 | 34 | // PyMutex_Unlock(&m); | |
| 35 | 35 | ||
| 36 | - // NOTE: In Py_NOGIL builds, `struct _PyMutex` is defined in Include/object.h. | ||
| 37 | - // The Py_NOGIL builds need the definition in Include/object.h for the | ||
| 36 | + // NOTE: In Py_GIL_DISABLED builds, `struct _PyMutex` is defined in Include/object.h. | ||
| 37 | + // The Py_GIL_DISABLED builds need the definition in Include/object.h for the | ||
| 38 | 38 | // `ob_mutex` field in PyObject. For the default (non-free-threaded) build, | |
| 39 | 39 | // we define the struct here to avoid exposing it in the public API. | |
| 40 | - #ifndef Py_NOGIL | ||
| 40 | + #ifndef Py_GIL_DISABLED | ||
| 41 | 41 | struct _PyMutex { uint8_t v; }; | |
| 42 | 42 | #endif | |
| 43 | 43 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,7 @@ PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *); | |||
| 54 | 54 | Furthermore, we can't use designated initializers in Extensions since these | |
| 55 | 55 | are not supported pre-C++20. Thus, keeping an internal copy here is the most | |
| 56 | 56 | backwards compatible solution */ | |
| 57 | - #if defined(Py_NOGIL) | ||
| 57 | + #if defined(Py_GIL_DISABLED) | ||
| 58 | 58 | #define _PyObject_HEAD_INIT(type) \ | |
| 59 | 59 | { \ | |
| 60 | 60 | .ob_ref_local = _Py_IMMORTAL_REFCNT_LOCAL, \ | |
@@ -103,7 +103,7 @@ static inline void _Py_RefcntAdd(PyObject* op, Py_ssize_t n) | |||
| 103 | 103 | #ifdef Py_REF_DEBUG | |
| 104 | 104 | _Py_AddRefTotal(_PyInterpreterState_GET(), n); | |
| 105 | 105 | #endif | |
| 106 | - #if !defined(Py_NOGIL) | ||
| 106 | + #if !defined(Py_GIL_DISABLED) | ||
| 107 | 107 | op->ob_refcnt += n; | |
| 108 | 108 | #else | |
| 109 | 109 | if (_Py_IsOwnedByCurrentThread(op)) { | |
@@ -128,7 +128,7 @@ static inline void _Py_RefcntAdd(PyObject* op, Py_ssize_t n) | |||
| 128 | 128 | static inline void _Py_SetImmortal(PyObject *op) | |
| 129 | 129 | { | |
| 130 | 130 | if (op) { | |
| 131 | - #ifdef Py_NOGIL | ||
| 131 | + #ifdef Py_GIL_DISABLED | ||
| 132 | 132 | op->ob_tid = _Py_UNOWNED_TID; | |
| 133 | 133 | op->ob_ref_local = _Py_IMMORTAL_REFCNT_LOCAL; | |
| 134 | 134 | op->ob_ref_shared = 0; | |
@@ -145,7 +145,7 @@ static inline void _Py_SetMortal(PyObject *op, Py_ssize_t refcnt) | |||
| 145 | 145 | { | |
| 146 | 146 | if (op) { | |
| 147 | 147 | assert(_Py_IsImmortal(op)); | |
| 148 | - #ifdef Py_NOGIL | ||
| 148 | + #ifdef Py_GIL_DISABLED | ||
| 149 | 149 | op->ob_tid = _Py_UNOWNED_TID; | |
| 150 | 150 | op->ob_ref_local = 0; | |
| 151 | 151 | op->ob_ref_shared = _Py_REF_SHARED(refcnt, _Py_REF_MERGED); | |
@@ -169,7 +169,7 @@ static inline void _Py_ClearImmortal(PyObject *op) | |||
| 169 | 169 | op = NULL; \ | |
| 170 | 170 | } while (0) | |
| 171 | 171 | ||
| 172 | - #if !defined(Py_NOGIL) | ||
| 172 | + #if !defined(Py_GIL_DISABLED) | ||
| 173 | 173 | static inline void | |
| 174 | 174 | _Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct) | |
| 175 | 175 | { | |
@@ -210,7 +210,7 @@ _Py_DECREF_NO_DEALLOC(PyObject *op) | |||
| 210 | 210 | } | |
| 211 | 211 | ||
| 212 | 212 | #else | |
| 213 | - // TODO: implement Py_DECREF specializations for Py_NOGIL build | ||
| 213 | + // TODO: implement Py_DECREF specializations for Py_GIL_DISABLED build | ||
| 214 | 214 | static inline void | |
| 215 | 215 | _Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct) | |
| 216 | 216 | { | |
@@ -238,7 +238,7 @@ _Py_REF_IS_QUEUED(Py_ssize_t ob_ref_shared) | |||
| 238 | 238 | // Merge the local and shared reference count fields and add `extra` to the | |
| 239 | 239 | // refcount when merging. | |
| 240 | 240 | Py_ssize_t _Py_ExplicitMergeRefcount(PyObject *op, Py_ssize_t extra); | |
| 241 | - #endif // !defined(Py_NOGIL) | ||
| 241 | + #endif // !defined(Py_GIL_DISABLED) | ||
| 242 | 242 | ||
| 243 | 243 | #ifdef Py_REF_DEBUG | |
| 244 | 244 | # undef _Py_DEC_REFTOTAL | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,9 +106,9 @@ check by comparing the reference count field to the immortality reference count. | |||
| 106 | 106 | #define _Py_IMMORTAL_REFCNT (UINT_MAX >> 2) | |
| 107 | 107 | #endif | |
| 108 | 108 | ||
| 109 | - // Py_NOGIL builds indicate immortal objects using `ob_ref_local`, which is | ||
| 109 | + // Py_GIL_DISABLED builds indicate immortal objects using `ob_ref_local`, which is | ||
| 110 | 110 | // always 32-bits. | |
| 111 | - #ifdef Py_NOGIL | ||
| 111 | + #ifdef Py_GIL_DISABLED | ||
| 112 | 112 | #define _Py_IMMORTAL_REFCNT_LOCAL UINT32_MAX | |
| 113 | 113 | #endif | |
| 114 | 114 | ||
@@ -117,7 +117,7 @@ check by comparing the reference count field to the immortality reference count. | |||
| 117 | 117 | ||
| 118 | 118 | // Make all internal uses of PyObject_HEAD_INIT immortal while preserving the | |
| 119 | 119 | // C-API expectation that the refcnt will be set to 1. | |
| 120 | - #if defined(Py_NOGIL) | ||
| 120 | + #if defined(Py_GIL_DISABLED) | ||
| 121 | 121 | #define PyObject_HEAD_INIT(type) \ | |
| 122 | 122 | { \ | |
| 123 | 123 | 0, \ | |
@@ -162,7 +162,7 @@ check by comparing the reference count field to the immortality reference count. | |||
| 162 | 162 | * by hand. Similarly every pointer to a variable-size Python object can, | |
| 163 | 163 | * in addition, be cast to PyVarObject*. | |
| 164 | 164 | */ | |
| 165 | - #ifndef Py_NOGIL | ||
| 165 | + #ifndef Py_GIL_DISABLED | ||
| 166 | 166 | struct _object { | |
| 167 | 167 | #if (defined(__GNUC__) || defined(__clang__)) \ | |
| 168 | 168 | && !(defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L) | |
@@ -238,7 +238,7 @@ typedef struct { | |||
| 238 | 238 | PyAPI_FUNC(int) Py_Is(PyObject *x, PyObject *y); | |
| 239 | 239 | #define Py_Is(x, y) ((x) == (y)) | |
| 240 | 240 | ||
| 241 | - #if defined(Py_NOGIL) && !defined(Py_LIMITED_API) | ||
| 241 | + #if defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API) | ||
| 242 | 242 | static inline uintptr_t | |
| 243 | 243 | _Py_ThreadId(void) | |
| 244 | 244 | { | |
@@ -275,7 +275,7 @@ _Py_IsOwnedByCurrentThread(PyObject *ob) | |||
| 275 | 275 | #endif | |
| 276 | 276 | ||
| 277 | 277 | static inline Py_ssize_t Py_REFCNT(PyObject *ob) { | |
| 278 | - #if !defined(Py_NOGIL) | ||
| 278 | + #if !defined(Py_GIL_DISABLED) | ||
| 279 | 279 | return ob->ob_refcnt; | |
| 280 | 280 | #else | |
| 281 | 281 | uint32_t local = _Py_atomic_load_uint32_relaxed(&ob->ob_ref_local); | |
@@ -316,7 +316,7 @@ static inline Py_ssize_t Py_SIZE(PyObject *ob) { | |||
| 316 | 316 | ||
| 317 | 317 | static inline Py_ALWAYS_INLINE int _Py_IsImmortal(PyObject *op) | |
| 318 | 318 | { | |
| 319 | - #if defined(Py_NOGIL) | ||
| 319 | + #if defined(Py_GIL_DISABLED) | ||
| 320 | 320 | return op->ob_ref_local == _Py_IMMORTAL_REFCNT_LOCAL; | |
| 321 | 321 | #elif SIZEOF_VOID_P > 4 | |
| 322 | 322 | return _Py_CAST(PY_INT32_T, op->ob_refcnt) < 0; | |
@@ -350,7 +350,7 @@ static inline void Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) { | |||
| 350 | 350 | if (_Py_IsImmortal(ob)) { | |
| 351 | 351 | return; | |
| 352 | 352 | } | |
| 353 | - #ifndef Py_NOGIL | ||
| 353 | + #ifndef Py_GIL_DISABLED | ||
| 354 | 354 | ob->ob_refcnt = refcnt; | |
| 355 | 355 | #else | |
| 356 | 356 | if (_Py_IsOwnedByCurrentThread(ob)) { | |
@@ -367,7 +367,7 @@ static inline void Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) { | |||
| 367 | 367 | ob->ob_ref_local = 0; | |
| 368 | 368 | ob->ob_ref_shared = _Py_REF_SHARED(refcnt, _Py_REF_MERGED); | |
| 369 | 369 | } | |
| 370 | - #endif // Py_NOGIL | ||
| 370 | + #endif // Py_GIL_DISABLED | ||
| 371 | 371 | #endif // Py_LIMITED_API+0 < 0x030d0000 | |
| 372 | 372 | } | |
| 373 | 373 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 | |
@@ -746,7 +746,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op) | |||
| 746 | 746 | #else | |
| 747 | 747 | // Non-limited C API and limited C API for Python 3.9 and older access | |
| 748 | 748 | // directly PyObject.ob_refcnt. | |
| 749 | - #if defined(Py_NOGIL) | ||
| 749 | + #if defined(Py_GIL_DISABLED) | ||
| 750 | 750 | uint32_t local = _Py_atomic_load_uint32_relaxed(&op->ob_ref_local); | |
| 751 | 751 | uint32_t new_local = local + 1; | |
| 752 | 752 | if (new_local == 0) { | |
@@ -784,7 +784,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op) | |||
| 784 | 784 | #endif | |
| 785 | 785 | ||
| 786 | 786 | ||
| 787 | - #if !defined(Py_LIMITED_API) && defined(Py_NOGIL) | ||
| 787 | + #if !defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED) | ||
| 788 | 788 | // Implements Py_DECREF on objects not owned by the current thread. | |
| 789 | 789 | PyAPI_FUNC(void) _Py_DecRefShared(PyObject *); | |
| 790 | 790 | PyAPI_FUNC(void) _Py_DecRefSharedDebug(PyObject *, const char *, int); | |
@@ -810,7 +810,7 @@ static inline void Py_DECREF(PyObject *op) { | |||
| 810 | 810 | } | |
| 811 | 811 | #define Py_DECREF(op) Py_DECREF(_PyObject_CAST(op)) | |
| 812 | 812 | ||
| 813 | - #elif defined(Py_NOGIL) && defined(Py_REF_DEBUG) | ||
| 813 | + #elif defined(Py_GIL_DISABLED) && defined(Py_REF_DEBUG) | ||
| 814 | 814 | static inline void Py_DECREF(const char *filename, int lineno, PyObject *op) | |
| 815 | 815 | { | |
| 816 | 816 | uint32_t local = _Py_atomic_load_uint32_relaxed(&op->ob_ref_local); | |
@@ -835,7 +835,7 @@ static inline void Py_DECREF(const char *filename, int lineno, PyObject *op) | |||
| 835 | 835 | } | |
| 836 | 836 | #define Py_DECREF(op) Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op)) | |
| 837 | 837 | ||
| 838 | - #elif defined(Py_NOGIL) | ||
| 838 | + #elif defined(Py_GIL_DISABLED) | ||
| 839 | 839 | static inline void Py_DECREF(PyObject *op) | |
| 840 | 840 | { | |
| 841 | 841 | uint32_t local = _Py_atomic_load_uint32_relaxed(&op->ob_ref_local); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,7 +348,7 @@ def _init_non_posix(vars): | |||
| 348 | 348 | vars['BINLIBDEST'] = get_path('platstdlib') | |
| 349 | 349 | vars['INCLUDEPY'] = get_path('include') | |
| 350 | 350 | ||
| 351 | - # Add EXT_SUFFIX, SOABI, and Py_NOGIL | ||
| 351 | + # Add EXT_SUFFIX, SOABI, and Py_GIL_DISABLED | ||
| 352 | 352 | vars.update(_sysconfig.config_vars()) | |
| 353 | 353 | ||
| 354 | 354 | vars['LIBDIR'] = _safe_realpath(os.path.join(get_config_var('installed_base'), 'libs')) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -290,7 +290,7 @@ def get_build_info(): | |||
| 290 | 290 | build = [] | |
| 291 | 291 | ||
| 292 | 292 | # --disable-gil | |
| 293 | - if sysconfig.get_config_var('Py_NOGIL'): | ||
| 293 | + if sysconfig.get_config_var('Py_GIL_DISABLED'): | ||
| 294 | 294 | build.append("nogil") | |
| 295 | 295 | ||
| 296 | 296 | if hasattr(sys, 'gettotalrefcount'): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -517,7 +517,7 @@ def collect_sysconfig(info_add): | |||
| 517 | 517 | 'PY_STDMODULE_CFLAGS', | |
| 518 | 518 | 'Py_DEBUG', | |
| 519 | 519 | 'Py_ENABLE_SHARED', | |
| 520 | - 'Py_NOGIL', | ||
| 520 | + 'Py_GIL_DISABLED', | ||
| 521 | 521 | 'SHELL', | |
| 522 | 522 | 'SOABI', | |
| 523 | 523 | 'abs_builddir', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -796,7 +796,7 @@ def check_cflags_pgo(): | |||
| 796 | 796 | return any(option in cflags_nodist for option in pgo_options) | |
| 797 | 797 | ||
| 798 | 798 | ||
| 799 | - if sysconfig.get_config_var('Py_NOGIL'): | ||
| 799 | + if sysconfig.get_config_var('Py_GIL_DISABLED'): | ||
| 800 | 800 | _header = 'PHBBInP' | |
| 801 | 801 | else: | |
| 802 | 802 | _header = 'nP' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments