gh-124218: Use per-thread refcounts for code objects (#125216)

Use per-thread refcounting for the reference from function objects to
their corresponding code object. This can be a source of contention when
frequently creating nested functions. Deferred refcounting alone isn't a
great fit here because these references are on the heap and may be
modified by other libraries.
This commit is contained in:
Sam Gross 2024-10-15 15:06:41 -04:00 committed by GitHub
parent 206de4155b
commit 3ea488aac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 126 additions and 83 deletions

View file

@ -20,7 +20,7 @@
#include "pycore_runtime_init.h" // _PyRuntimeState_INIT
#include "pycore_sysmodule.h" // _PySys_Audit()
#include "pycore_obmalloc.h" // _PyMem_obmalloc_state_on_heap()
#include "pycore_uniqueid.h" // _PyType_FinalizeThreadLocalRefcounts()
#include "pycore_uniqueid.h" // _PyObject_FinalizePerThreadRefcounts()
/* --------------------------------------------------------------------------
CAUTION