gh-117657: Disable the function/code cache in free-threaded builds (#118301)

This is only used by the specializing interpreter and the tier 2
optimizer, both of which are disabled in free-threaded builds.
This commit is contained in:
mpage 2024-05-03 13:21:04 -07:00 committed by GitHub
parent 5248596781
commit 37d0950022
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 1 deletions

View file

@ -4,6 +4,8 @@
extern "C" {
#endif
#include "pycore_lock.h"
#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif
@ -24,6 +26,11 @@ struct _func_version_cache_item {
};
struct _py_func_state {
#ifdef Py_GIL_DISABLED
// Protects next_version
PyMutex mutex;
#endif
uint32_t next_version;
// Borrowed references to function and code objects whose
// func_version % FUNC_VERSION_CACHE_SIZE