Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix a performance regression in the :term:`free-threaded build` where a
thread ran slower while the main thread was executing the same function
concurrently.
9 changes: 7 additions & 2 deletions Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,13 @@ static void dtrace_function_return(_PyInterpreterFrame *);
} while (0);
#endif

#ifdef ENABLE_SPECIALIZATION
/* Multiple threads may execute these concurrently if thread-local bytecode is
#if defined(ENABLE_SPECIALIZATION) && defined(_Py_TIER2)
/* The branch history is only used by the tier 2 optimizer. Don't record it
* otherwise: in the free-threaded build the main thread's bytecode is stored
* inline in the code object, so the store would cause false sharing with
* threads reading the code object's other fields.
*
* Multiple threads may execute these concurrently if thread-local bytecode is
* disabled and they all execute the main copy of the bytecode. Specialization
* is disabled in that case so the value is unused, but the RMW cycle should be
* free of data races.
Expand Down
Loading