gh-115999: Disable the specializing adaptive interpreter in free-threaded builds (#116013)

For now, disable all specialization when the GIL might be disabled.
This commit is contained in:
Brett Simmers 2024-02-29 18:53:32 -08:00 committed by GitHub
parent 2e94a6687c
commit 339c8e1c13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 96 additions and 3 deletions

View file

@ -296,11 +296,19 @@ GETITEM(PyObject *v, Py_ssize_t i) {
#define ADAPTIVE_COUNTER_IS_MAX(COUNTER) \
(((COUNTER) >> ADAPTIVE_BACKOFF_BITS) == ((1 << MAX_BACKOFF_VALUE) - 1))
#ifdef Py_GIL_DISABLED
#define DECREMENT_ADAPTIVE_COUNTER(COUNTER) \
do { \
/* gh-115999 tracks progress on addressing this. */ \
static_assert(0, "The specializing interpreter is not yet thread-safe"); \
} while (0);
#else
#define DECREMENT_ADAPTIVE_COUNTER(COUNTER) \
do { \
assert(!ADAPTIVE_COUNTER_IS_ZERO((COUNTER))); \
(COUNTER) -= (1 << ADAPTIVE_BACKOFF_BITS); \
} while (0);
#endif
#define INCREMENT_ADAPTIVE_COUNTER(COUNTER) \
do { \