cpython/Python
mpage 2e95c5ba3b
gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926)
Each thread specializes a thread-local copy of the bytecode, created on the first RESUME, in free-threaded builds. All copies of the bytecode for a code object are stored in the co_tlbc array on the code object. Threads reserve a globally unique index identifying its copy of the bytecode in all co_tlbc arrays at thread creation and release the index at thread destruction. The first entry in every co_tlbc array always points to the "main" copy of the bytecode that is stored at the end of the code object. This ensures that no bytecode is copied for programs that do not use threads.

Thread-local bytecode can be disabled at runtime by providing either -X tlbc=0 or PYTHON_TLBC=0. Disabling thread-local bytecode also disables specialization.

Concurrent modifications to the bytecode made by the specializing interpreter and instrumentation use atomics, with specialization taking care not to overwrite an instruction that was instrumented concurrently.
2024-11-04 11:13:32 -08:00
..
clinic gh-116750: Add clear_tool_id function to unregister events and callbacks (#124568) 2024-10-01 13:32:55 -04:00
frozen_modules
Python-ast.c gh-126105: Fix crash in `ast` module, when `._fields` is deleted (#126115) 2024-10-29 17:42:48 +02:00
Python-tokenize.c gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194) 2024-10-09 17:15:23 +02:00
README
_warnings.c gh-121163: Add "all" as an valid alias for "always" in warnings.simplefilter() (#121164) 2024-06-30 19:48:00 +02:00
asdl.c
asm_trampoline.S
assemble.c
ast.c gh-122313: Clean up deep recursion guarding code in the compiler (GH-122640) 2024-08-03 12:45:45 +03:00
ast_opt.c gh-123497: New limit for Python integers on 64-bit platforms (GH-123724) 2024-09-29 10:40:20 +03:00
ast_unparse.c gh-125268: Use static string for "1e309" in AST (#125272) 2024-10-10 16:21:29 -04:00
bltinmodule.c gh-119793: Add optional length-checking to `map()` (GH-120471) 2024-11-04 15:00:19 +01:00
bootstrap_hash.c gh-121199: Use _Py__has_attribute() in timemodule.c (#121203) 2024-07-01 08:49:33 +00:00
brc.c
bytecodes.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
ceval.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
ceval_gil.c gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) 2024-10-02 09:17:49 -07:00
ceval_macros.h gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
codecs.c gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194) 2024-10-09 17:15:23 +02:00
codegen.c gh-125832: Reformat comments for inlined comprehensions (gh-126346) 2024-11-03 04:15:07 +00:00
compile.c gh-126072: do not add `None` to `co_consts` if there is no docstring (GH-126101) 2024-10-30 09:01:09 +00:00
condvar.h
config_common.h
context.c gh-124872: Replace enter/exit events with "switched" (#125532) 2024-10-16 13:53:21 +02:00
critical_section.c
crossinterp.c Fix typos in docs, error messages and comments (#122502) 2024-08-01 00:26:09 +00:00
crossinterp_data_lookup.h
crossinterp_exceptions.h
dtoa.c
dup2.c
dynamic_annotations.c
dynload_hpux.c
dynload_shlib.c
dynload_stub.c
dynload_win.c
emscripten_signal.c
emscripten_trampoline.c gh-121698 Emscripten: Use updated WebAssembly type reflection proposal (GH-121699) 2024-07-14 11:25:09 +02:00
errors.c gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
executor_cases.c.h gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
fileutils.c
flowgraph.c GH-125837: Split `LOAD_CONST` into three. (GH-125972) 2024-10-29 11:15:42 +00:00
formatter_unicode.c gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194) 2024-10-09 17:15:23 +02:00
frame.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
frozen.c
frozenmain.c
future.c gh-126139: Improve error message location for future statement with unknown feature (#126140) 2024-10-29 23:57:59 +00:00
gc.c gh-116510: Fix crash during sub-interpreter shutdown (gh-124645) 2024-09-26 19:33:07 -07:00
gc_free_threading.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
gc_gil.c gh-100240: Use a consistent implementation for freelists (#121934) 2024-07-22 12:08:27 -04:00
generated_cases.c.h gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
getargs.c gh-124502: Remove _PyUnicode_EQ() function (#125114) 2024-10-09 10:15:17 +02:00
getcompiler.c
getcopyright.c
getopt.c
getplatform.c
getversion.c
hamt.c gh-125196: Use PyUnicodeWriter in HAMT (#125458) 2024-10-15 09:47:36 +00:00
hashtable.c
import.c gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
importdl.c gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952) 2024-08-13 14:44:57 -06:00
index_pool.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
initconfig.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
instruction_sequence.c
instrumentation.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
interpconfig.c
intrinsics.c
jit.c GH-125911: Call combine_symbol_mask on the initial trampoline of a trace (GH-125973) 2024-10-25 15:43:02 +00:00
legacy_tracing.c gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
lock.c gh-125139: use `_PyRecursiveMutex` in `_thread.RLock` (#125144) 2024-10-14 14:06:31 +05:30
marshal.c gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194) 2024-10-09 17:15:23 +02:00
modsupport.c
mysnprintf.c
mystrtoul.c
object_stack.c gh-100240: Use a consistent implementation for freelists (#121934) 2024-07-22 12:08:27 -04:00
opcode_targets.h GH-125837: Split `LOAD_CONST` into three. (GH-125972) 2024-10-29 11:15:42 +00:00
optimizer.c GH-118093: Don't lose confidence when tracing through 100% biased branches (GH-124813) 2024-10-02 19:24:37 +00:00
optimizer_analysis.c gh-115999: Refactor `LOAD_GLOBAL` specializations to avoid reloading {globals, builtins} keys (gh-124953) 2024-10-09 15:18:25 +00:00
optimizer_bytecodes.c GH-125837: Split `LOAD_CONST` into three. (GH-125972) 2024-10-29 11:15:42 +00:00
optimizer_cases.c.h gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
optimizer_symbols.c
parking_lot.c gh-125541: Make Ctrl-C interrupt `threading.Lock.acquire()` on Windows (#125546) 2024-10-17 20:10:55 +02:00
pathconfig.c
perf_jit_trampoline.c
perf_trampoline.c
preconfig.c
pyarena.c
pyctype.c
pyfpe.c
pyhash.c gh-122854: Add Py_HashBuffer() function (#122855) 2024-08-30 15:42:27 +00:00
pylifecycle.c gh-126255: Ignore warning about JIT being deactivated when perf support is active in `test_embed.InitConfigTests.test_initconfig_api` (#126302) 2024-11-01 23:10:58 +00:00
pymath.c
pystate.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
pystrcmp.c
pystrhex.c
pystrtod.c gh-120026: soft deprecate Py_HUGE_VAL macro (#120027) 2024-11-01 22:04:31 +00:00
pythonrun.c gh-125842: Fix `sys.exit(0xffff_ffff)` on Windows (#125896) 2024-10-24 12:03:50 -04:00
pytime.c gh-111513: Improve datetime.fromtimestamp's error message (#124249) 2024-09-20 14:42:43 +02:00
qsbr.c
specialize.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
stdlib_module_names.h gh-123892: Add "_wmi" to sys.stdlib_module_names (#123893) 2024-09-10 09:54:17 +00:00
structmember.c
suggestions.c
symtable.c gh-126072: do not add `None` to `co_consts` if there is no docstring (GH-126101) 2024-10-30 09:01:09 +00:00
sysmodule.c gh-115999: Implement thread-local bytecode and enable specialization for `BINARY_OP` (#123926) 2024-11-04 11:13:32 -08:00
thread.c
thread_nt.h gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) 2024-10-02 09:17:49 -07:00
thread_pthread.h gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) 2024-10-02 09:17:49 -07:00
thread_pthread_stubs.h gh-125161: return non zero value in pthread_self on wasi (#125303) 2024-10-13 20:59:41 +05:30
tier2_engine.md
traceback.c
tracemalloc.c gh-123923: Defer refcounting for `f_executable` in `_PyInterpreterFrame` (#123924) 2024-09-12 12:37:06 -04:00
uniqueid.c gh-124218: Use per-thread reference counting for globals and builtins (#125713) 2024-10-21 12:51:29 -04:00
vm-state.md

README

Miscellaneous source files for the main Python shared library