cpython/Objects
Ken Jin 22b0de2755
gh-117139: Convert the evaluation stack to stack refs (#118450)
This PR sets up tagged pointers for CPython.

The general idea is to create a separate struct _PyStackRef for everything on the evaluation stack to store the bits. This forces the C compiler to warn us if we try to cast things or pull things out of the struct directly.

Only for free threading: We tag the low bit if something is deferred - that means we skip incref and decref operations on it. This behavior may change in the future if Mark's plans to defer all objects in the interpreter loop pans out.

This implies a strict stack reference discipline is required. ALL incref and decref operations on stackrefs must use the stackref variants. It is unsafe to untag something then do normal incref/decref ops on it.

The new incref and decref variants are called dup and close. They mimic a "handle" API operating on these stackrefs.

Please read Include/internal/pycore_stackref.h for more information!

---------

Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
2024-06-27 03:10:43 +08:00
..
clinic gh-120080: Accept `None as a valid argument for direct call of the int.__round__` (#120088) 2024-06-07 10:03:28 +02:00
mimalloc Fix typos in comments (#120821) 2024-06-24 19:47:00 +02:00
stringlib gh-120196: Reuse find_max_char() for bytes objects (#120497) 2024-06-17 12:21:58 +02:00
abstract.c gh-119740: Remove deprecated trunc delegation (#119743) 2024-06-02 10:16:49 +01:00
boolobject.c gh-111999: Add signatures and improve docstrings for builtins (GH-112000) 2023-11-13 09:13:49 +02:00
bytearrayobject.c gh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502) 2024-04-12 07:40:55 +00:00
bytes_methods.c gh-120196: Reuse find_max_char() for bytes objects (#120497) 2024-06-17 12:21:58 +02:00
bytesobject.c gh-117557: Improve error messages when a string, bytes or bytearray of length 1 are expected (GH-117631) 2024-05-28 12:01:37 +03:00
call.c gh-106320: Remove _PyFunction_Vectorcall() API (#107071) 2023-07-22 21:44:33 +00:00
capsule.c gh-108240: Add pycore_capsule.h internal header file (#108596) 2023-08-29 01:20:02 +00:00
cellobject.c gh-117323: Make cell thread-safe in free-threaded builds (#117330) 2024-03-29 13:35:43 -04:00
classobject.c gh-118362: Fix thread safety around lookups from the type cache in the face of concurrent mutators (#118454) 2024-05-06 10:50:35 -07:00
codeobject.c Fix typos in comments (#120821) 2024-06-24 19:47:00 +02:00
complexobject.c Fix typos in comments (#120821) 2024-06-24 19:47:00 +02:00
descrobject.c bpo-24766: doc= argument to subclasses of property not handled correctly (GH-2487) 2024-06-10 08:55:49 +00:00
dictnotes.txt bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
dictobject.c gh-120858: PyDict_Next should not lock the dict (#120859) 2024-06-24 14:15:15 -04:00
enumobject.c gh-106320: Create pycore_modsupport.h header file (#106355) 2023-07-03 09:39:11 +00:00
exceptions.c gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680) 2024-06-24 14:08:12 +02:00
fileobject.c gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160) 2024-03-25 16:32:11 +01:00
floatobject.c gh-119057: Use better error messages for zero division (#119066) 2024-06-03 19:03:56 +03:00
frameobject.c gh-117139: Convert the evaluation stack to stack refs (#118450) 2024-06-27 03:10:43 +08:00
funcobject.c gh-119180: Lazily wrap annotations on classmethod and staticmethod (#119864) 2024-05-31 14:05:51 -07:00
genericaliasobject.c gh-119182: Use public PyUnicodeWriter API in ga_repr() (#120799) 2024-06-20 20:35:35 +02:00
genobject.c gh-117139: Convert the evaluation stack to stack refs (#118450) 2024-06-27 03:10:43 +08:00
iterobject.c gh-106320: Remove private _PyEval function (#108433) 2023-08-24 20:25:22 +02:00
listobject.c Fix typos in comments (#120821) 2024-06-24 19:47:00 +02:00
listsort.txt GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
lnotab_notes.txt Document the co_lines method on code objects (#113682) 2024-01-03 19:29:24 +00:00
longobject.c gh-120593: Fix const qualifier in _PyLong_CompactValue() (#121053) 2024-06-26 20:11:21 +02:00
memoryobject.c gh-120155: Fix copy/paste error in HAVE_SUBOFFSETS_IN_LAST_DIM() (#120228) 2024-06-07 17:58:21 +02:00
methodobject.c gh-113024: C API: Add PyObject_GenericHash() function (GH-113025) 2024-03-22 20:19:10 +02:00
moduleobject.c gh-119180: PEP 649: Add __annotate__ attributes (#119209) 2024-05-22 04:38:12 +02:00
namespaceobject.c gh-108191: Add support of positional argument in SimpleNamespace constructor (GH-108195) 2024-04-25 00:39:54 +03:00
object.c gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520) 2024-06-21 17:19:31 +02:00
object_layout.md GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_312.gv GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_312.png GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
obmalloc.c Fix typos in comments (#120821) 2024-06-24 19:47:00 +02:00
odictobject.c Remove almost all unpaired backticks in docstrings (#119231) 2024-05-22 12:35:18 -04:00
picklebufobject.c gh-104922: remove PY_SSIZE_T_CLEAN (#106315) 2023-07-02 15:07:46 +09:00
rangeobject.c gh-117764: Fix and add signatures for many builtins (GH-117769) 2024-04-12 13:56:41 +03:00
README
setobject.c gh-118527: Intern code consts in free-threaded build (#118667) 2024-05-06 20:12:39 -04:00
sliceobject.c gh-117764: Add docstrings and signatures for the types of None, Ellipsis and NotImplemented (GH-117813) 2024-04-12 15:45:23 +03:00
structseq.c gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929) 2024-06-03 17:09:18 -06:00
tupleobject.c gh-117439: Make refleak checking thread-safe without the GIL (#117469) 2024-04-08 12:11:36 -04:00
typeobject.c gh-117139: Convert the evaluation stack to stack refs (#118450) 2024-06-27 03:10:43 +08:00
typeslots.inc bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) 2020-11-10 12:53:46 -08:00
typeslots.py bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) 2020-11-10 12:53:46 -08:00
typevarobject.c Rename notimplemented_methods into nodefault_methods (#118896) 2024-05-10 12:46:20 +00:00
unicodectype.c bpo-46670: Remove unused macros in the Objects directory (GH-31193) 2022-02-07 16:21:41 +01:00
unicodeobject.c Fix typos in comments (#120821) 2024-06-24 19:47:00 +02:00
unicodetype_db.h gh-96954: Fix make regen-unicodedata in out-of-tree builds (#112118) 2023-11-15 16:42:17 +00:00
unionobject.c Fixes loop variables to be the same types as their limit (GH-120958) 2024-06-24 17:11:47 +01:00
weakrefobject.c gh-118789: Add PyUnstable_Object_ClearWeakRefsNoCallbacks (#118807) 2024-06-18 09:57:23 -04:00

Source files for various builtin objects