0
0
mirror of https://github.com/python/cpython.git synced 2024-11-21 21:09:37 +01:00
cpython/Include
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
..
cpython gh-115999: Implement thread-local bytecode and enable specialization for BINARY_OP (#123926) 2024-11-04 11:13:32 -08:00
internal gh-115999: Implement thread-local bytecode and enable specialization for BINARY_OP (#123926) 2024-11-04 11:13:32 -08:00
abstract.h gh-105201: Add PyIter_NextItem() (#122331) 2024-08-08 00:47:15 +02:00
audit.h gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
bltinmodule.h
boolobject.h
bytearrayobject.h
bytesobject.h
ceval.h GH-120507: Lower the BEFORE_WITH and BEFORE_ASYNC_WITH instructions. (#120640) 2024-06-18 12:17:46 +01:00
codecs.h
compile.h
complexobject.h
critical_section.h gh-119344: Make critical section API public (#119353) 2024-06-21 15:50:18 -04:00
datetime.h
descrobject.h
dictobject.h
dynamic_annotations.h
enumobject.h
errcode.h
exports.h gh-121040: Use __attribute__((fallthrough)) (#121044) 2024-06-27 09:58:44 +00:00
fileobject.h
fileutils.h
floatobject.h gh-120026: soft deprecate Py_HUGE_VAL macro (#120027) 2024-11-01 22:04:31 +00:00
frameobject.h
genericaliasobject.h
import.h
intrcheck.h
iterobject.h
listobject.h
lock.h gh-117511: Make PyMutex public in the non-limited API (#117731) 2024-06-20 11:29:08 -04:00
longobject.h gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390) 2024-08-28 10:16:13 +00:00
marshal.h
memoryobject.h
methodobject.h
modsupport.h gh-112136: Restore removed _PyArg_Parser (#121262) 2024-07-03 18:36:57 +02:00
moduleobject.h
monitoring.h
object.h gh-121654: Add PyType_Freeze() function (#122457) 2024-10-25 11:12:48 +02:00
objimpl.h
opcode_ids.h GH-125837: Split LOAD_CONST into three. (GH-125972) 2024-10-29 11:15:42 +00:00
opcode.h
osdefs.h
osmodule.h
patchlevel.h Post 3.14.0a1 2024-10-16 00:44:52 +03:00
py_curses.h gh-123961: Add a global state to _curses (#124729) 2024-09-29 15:17:20 +00:00
pyatomic.h
pybuffer.h
pycapsule.h
pydtrace.d
pydtrace.h
pyerrors.h gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680) 2024-06-24 14:08:12 +02:00
pyexpat.h
pyframe.h
pyhash.h
pylifecycle.h
pymacconfig.h
pymacro.h gh-118124: fix assert related C++ checks on Solaris/Illumos (#121974) 2024-07-21 18:50:14 +02:00
pymath.h gh-120026: soft deprecate Py_HUGE_VAL macro (#120027) 2024-11-01 22:04:31 +00:00
pymem.h
pyport.h gh-121040: Use __attribute__((fallthrough)) (#121044) 2024-06-27 09:58:44 +00:00
pystate.h
pystats.h GH-124284: Add stats for refcount operations on immortal objects (GH-124288) 2024-09-23 19:10:55 +01:00
pystrcmp.h
pystrtod.h
Python.h gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
pythonrun.h
pythread.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
pytypedefs.h
rangeobject.h
README.rst
refcount.h GH-125174: Make immortal objects more robust, following design from PEP 683 (GH-125251) 2024-10-10 18:19:08 +01:00
setobject.h
sliceobject.h
structmember.h Fix typos in comments (#120188) 2024-06-07 10:19:41 +02:00
structseq.h
sysmodule.h gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605) 2024-10-18 09:26:08 -06:00
traceback.h
tupleobject.h
typeslots.h gh-124153: Implement PyType_GetBaseByToken() and Py_tp_token slot (GH-124163) 2024-09-18 09:18:19 +02:00
unicodeobject.h gh-124502: Add PyUnicode_Equal() function (#124504) 2024-10-07 21:24:53 +00:00
warnings.h
weakrefobject.h

The Python C API
================

The C API is divided into these sections:

1. ``Include/``: Limited API
2. ``Include/cpython/``: CPython implementation details
3. ``Include/cpython/``, names with the ``PyUnstable_`` prefix: API that can
   change between minor releases
4. ``Include/internal/``, and any name with ``_`` prefix: The internal API

Information on changing the C API is available `in the developer guide`_

.. _in the developer guide: https://devguide.python.org/c-api/