summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authormpage <mpage@meta.com>2024-05-03 20:21:04 (GMT)
committerGitHub <noreply@github.com>2024-05-03 20:21:04 (GMT)
commit37d095002216a4e45b4e82539ca0421ded8aaae3 (patch)
tree0cfb64e629fa0f78cbc314ef7a326b93fc021170 /Include
parent52485967813acdb35c274e1b2eaedd34e9ac01fc (diff)
downloadcpython-37d095002216a4e45b4e82539ca0421ded8aaae3.zip
cpython-37d095002216a4e45b4e82539ca0421ded8aaae3.tar.gz
cpython-37d095002216a4e45b4e82539ca0421ded8aaae3.tar.bz2
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_function.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Include/internal/pycore_function.h b/Include/internal/pycore_function.h
index 24fbb3d..6d44e93 100644
--- a/Include/internal/pycore_function.h
+++ b/Include/internal/pycore_function.h
@@ -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