summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
Commit message (Collapse)AuthorAgeFilesLines
...
* GH-130396: Use computed stack limits on linux (GH-130398)Mark Shannon2025-02-251-8/+3
| | | | | | | | | | | * Implement C recursion protection with limit pointers for Linux, MacOS and Windows * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not ↵Petr Viktorin2025-02-241-3/+8
| | | | | | | | | counters. (GH-130007)" for now (GH130413) Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now Unfortunatlely, the change broke some buildbots. This reverts commit 2498c22fa0a2b560491bc503fa676585c1a603d0.
* GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)Mark Shannon2025-02-191-8/+3
| | | | | | | | | | | | * Implement C recursion protection with limit pointers * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* gh-129989: Change Py_TAIL_CALL_INTERP ifndef to ! (#130269)Ken Jin2025-02-181-1/+1
| | | Change Py_TAIL_CALL_INTERP ifndef to !
* gh-129989: Properly disable tailcall interp in configure (GH-129991)Ken Jin2025-02-151-2/+2
| | | Co-authored-by: Zanie Blue <contact@zanie.dev>
* GH-128682: Account for escapes in `DECREF_INPUTS` (GH-129953)Mark Shannon2025-02-121-55/+56
| | | | | | | | * Handle escapes in DECREF_INPUTS * Mark a few more functions as escaping * Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
* gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR ↵Irit Katriel2025-02-071-50/+22
| | | | (#129700)
* GH-129715: Remove _DYNAMIC_EXIT (GH-129716)Brandt Bucher2025-02-071-36/+0
|
* GH-129709: Clean up tier two (GH-129710)Brandt Bucher2025-02-071-24/+16
|
* GH-129763: Remove the LLTRACE macro (GH-129764)Brandt Bucher2025-02-071-10/+2
|
* gh-128563: A new tail-calling interpreter (GH-128718)Ken Jin2025-02-061-1/+8
| | | | | Co-authored-by: Garrett Gu <garrettgu777@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* GH-128682: Mark two more macros as escaping. (GH-129645)Mark Shannon2025-02-041-7/+18
| | | Expand out SETLOCAL so that code generator can see the decref. Mark Py_CLEAR as escaping
* GH-128682: Spill the stack pointer in labels, as well as instructions ↵Mark Shannon2025-02-041-21/+24
| | | | (GH-129618)
* GH-128563: Generate `opcode = ...` in instructions that need `opcode` ↵Mark Shannon2025-02-031-20/+32
| | | | | (GH-129608) * Remove support for GO_TO_INSTRUCTION
* GH-128682: Make `PyStackRef_CLOSE` escaping. (GH-129404)Mark Shannon2025-02-031-42/+37
|
* GH-128563: Move some labels, to simplify implementing tailcalling ↵Mark Shannon2025-01-311-4/+29
| | | | interpreter. (GH-129525)
* gh-100239: specialize bitwise logical binary ops on ints (#128927)Irit Katriel2025-01-291-1/+1
|
* GH-126599: Remove the PyOptimizer API (GH-129194)Brandt Bucher2025-01-291-9/+35
|
* gh-115999: Enable free-threaded specialization of LOAD_CONST (#129365)T. Wouters2025-01-291-2/+12
| | | | Enable free-threaded specialization of LOAD_CONST.
* GH-128914: Remove all but one conditional stack effects (GH-129226)Mark Shannon2025-01-271-62/+51
| | | | | | | | | | | | | * Remove all 'if (0)' and 'if (1)' conditional stack effects * Use array instead of conditional for BUILD_SLICE args * Refactor LOAD_GLOBAL to use a common conditional uop * Remove conditional stack effects from LOAD_ATTR specializations * Replace conditional stack effects in LOAD_ATTR with a 0 or 1 sized array. * Remove conditional stack effects from CALL_FUNCTION_EX
* gh-128563: Move labels in ceval.c to bytecodes.c (GH-129112)Ken Jin2025-01-271-1/+120
|
* gh-128799: Add frame of except* to traceback when wrapping a naked exception ↵Irit Katriel2025-01-251-1/+1
| | | | (#128971)
* Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and ↵Sam Gross2025-01-231-123/+94
| | | | | | | the code generators (GH-128918)" (GH-129202) The commit introduced a ~2.5-3% regression in the free threading build. This reverts commit ab61d3f4303d14a413bc9ae6557c730ffdf7579e.
* GH-128682: Change a couple of functions to only steal references on success. ↵Mark Shannon2025-01-221-4/+8
| | | | | (GH-129132) Change PyTuple_FromStackRefSteal and PyList_FromStackRefSteal to only steal on success to avoid escaping
* gh-128563: Move lltrace into the frame struct (GH-129113)Ken Jin2025-01-211-2/+2
|
* GH-128563: Add new frame owner type for interpreter entry frames (GH-129078)Mark Shannon2025-01-211-8/+4
| | | Add new frame owner type for interpreter entry frames
* GH-127953: Make line number lookup O(1) regardless of the size of the code ↵Mark Shannon2025-01-211-1/+2
| | | | object (GH-128350)
* GH-128914: Remove conditional stack effects from `bytecodes.c` and the code ↵Mark Shannon2025-01-201-94/+123
| | | | generators (GH-128918)
* GH-126599: Remove the "counter" optimizer/executor (GH-126853)Xuanteng Huang2025-01-161-7/+0
|
* gh-100239: specialize long tail of binary operations (#128722)Irit Katriel2025-01-161-9/+36
|
* gh-115999: Specialize `LOAD_ATTR` for instance and class receivers in ↵mpage2025-01-141-27/+58
| | | | | | | free-threaded builds (#128164) Finish specialization for LOAD_ATTR in the free-threaded build by adding support for class and instance receivers.
* GH-128682: Convert explicit loops closing arrays into `DECREF_INPUTS`. ↵Mark Shannon2025-01-141-93/+46
| | | | | | | (GH-128822) * Mark Py_DECREF and Py_XDECREF as escaping * Remove explicit loops for clearing array inputs
* GH-128682: Stronger checking of `PyStackRef_CLOSE` and `DEAD`. (GH-128683)Mark Shannon2025-01-131-36/+38
|
* GH-128685: Specialize (rather than quicken) LOAD_CONST into ↵Mark Shannon2025-01-131-2/+16
| | | | LOAD_CONST_[IM]MORTAL (GH-128708)
* GH-127809: Fix the JIT's understanding of ** (GH-127844)Brandt Bucher2025-01-081-0/+16
|
* gh-115999: Add free-threaded specialization for COMPARE_OP (#126410)T. Wouters2025-01-071-1/+1
| | | | | Add free-threaded specialization for COMPARE_OP, and tests for COMPARE_OP specialization in general. Co-authored-by: Donghee Na <donghee.na92@gmail.com>
* GH-128375: Better instrument for `FOR_ITER` (GH-128445)Mark Shannon2025-01-061-24/+33
|
* gh-128262: Allow specialization of calls to classes with __slots__ (GH-128263)Ken Jin2024-12-311-2/+4
|
* GH-127705: Add debug mode for `_PyStackRef`s inspired by HPy debug mode ↵Mark Shannon2024-12-201-5/+12
| | | | (GH-128121)
* gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)Neil Schemenauer2024-12-191-16/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add `_PyDictKeys_StringLookupSplit` which does locking on dict keys and use in place of `_PyDictKeys_StringLookup`. * Change `_PyObject_TryGetInstanceAttribute` to use that function in the case of split keys. * Add `unicodekeys_lookup_split` helper which allows code sharing between `_Py_dict_lookup` and `_PyDictKeys_StringLookupSplit`. * Fix locking for `STORE_ATTR_INSTANCE_VALUE`. Create `_GUARD_TYPE_VERSION_AND_LOCK` uop so that object stays locked and `tp_version_tag` cannot change. * Pass `tp_version_tag` to `specialize_dict_access()`, ensuring the version we store on the cache is the correct one (in case of it changing during the specalize analysis). * Split `analyze_descriptor` into `analyze_descriptor_load` and `analyze_descriptor_store` since those don't share much logic. Add `descriptor_is_class` helper function. * In `specialize_dict_access`, double check `_PyObject_GetManagedDict()` in case we race and dict was materialized before the lock. * Avoid borrowed references in `_Py_Specialize_StoreAttr()`. * Use `specialize()` and `unspecialize()` helpers. * Add unit tests to ensure specializing happens as expected in FT builds. * Add unit tests to attempt to trigger data races (useful for running under TSAN). * Add `has_split_table` function to `_testinternalcapi`.
* GH-122548: Implement branch taken and not taken events for sys.monitoring ↵Mark Shannon2024-12-191-32/+28
| | | | (GH-122564)
* gh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737)Donghee Na2024-12-191-12/+10
|
* gh-115999: Specialize loading attributes from modules in free-threaded ↵mpage2024-12-131-17/+42
| | | | | | | | | builds (#127711) We use the same approach that was used for specialization of LOAD_GLOBAL in free-threaded builds: _CHECK_ATTR_MODULE is renamed to _CHECK_ATTR_MODULE_PUSH_KEYS; it pushes the keys object for the following _LOAD_ATTR_MODULE_FROM_KEYS (nee _LOAD_ATTR_MODULE). This arrangement avoids having to recheck the keys version. _LOAD_ATTR_MODULE is renamed to _LOAD_ATTR_MODULE_FROM_KEYS; it loads the value from the keys object pushed by the preceding _CHECK_ATTR_MODULE_PUSH_KEYS at the cached index.
* gh-126868: Add freelist for compact int objects (GH-126865)Pieter Eendebak2024-12-131-12/+13
|
* gh-115999: Specialize `CALL_KW` in free-threaded builds (#127713)mpage2024-12-111-4/+5
| | | | | | | | | | | | | * Enable specialization of CALL_KW * Fix bug pushing frame in _PY_FRAME_KW `_PY_FRAME_KW` pushes a pointer to the new frame onto the stack for consumption by the next uop. When pushing the frame fails, we do not want to push the result, `NULL`, to the stack because it is not a valid stackref. This works in the default build because `PyStackRef_NULL` and `NULL` are the same value, so the `PyStackRef_XCLOSE()` in the error handler ignores it. In the free-threaded build the values are not the same; `PyStackRef_XCLOSE()` will attempt to decref a null pointer.
* gh-115999: Enable specialization of `CALL` instructions in free-threaded ↵mpage2024-12-031-6/+10
| | | | | | | | | | | | | | | | | | | | | | builds (#127123) The CALL family of instructions were mostly thread-safe already and only required a small number of changes, which are documented below. A few changes were needed to make CALL_ALLOC_AND_ENTER_INIT thread-safe: Added _PyType_LookupRefAndVersion, which returns the type version corresponding to the returned ref. Added _PyType_CacheInitForSpecialization, which takes an init method and the corresponding type version and only populates the specialization cache if the current type version matches the supplied version. This prevents potentially caching a stale value in free-threaded builds if we race with an update to __init__. Only cache __init__ functions that are deferred in free-threaded builds. This ensures that the reference to __init__ that is stored in the specialization cache is valid if the type version guard in _CHECK_AND_ALLOCATE_OBJECT passes. Fix a bug in _CREATE_INIT_FRAME where the frame is pushed to the stack on failure. A few other miscellaneous changes were also needed: Use {LOCK,UNLOCK}_OBJECT in LIST_APPEND. This ensures that the list's per-object lock is held while we are appending to it. Add missing co_tlbc for _Py_InitCleanup. Stop/start the world around setting the eval frame hook. This allows us to read interp->eval_frame non-atomically and preserves the behavior of _CHECK_PEP_523 documented below.
* gh-115999: Add free-threaded specialization for `SEND` (gh-127426)Neil Schemenauer2024-12-031-2/+2
| | | | | No additional thread safety changes are required. Note that sending to a generator that is shared between threads is currently not safe in the free-threaded build.
* gh-115999: Specialize `LOAD_SUPER_ATTR` in free-threaded builds (gh-127128)Neil Schemenauer2024-12-031-2/+2
| | | | | | Use existing helpers to atomically modify the bytecode. Add unit tests to ensure specializing is happening as expected. Add test_specialize.py that can be used with ThreadSanitizer to detect data races. Fix thread safety issue with cell_set_contents().
* gh-115999: Use light-weight lock for UNPACK_SEQUENCE_LIST (gh-127514)Donghee Na2024-12-021-10/+3
|
* gh-115999: Add partial free-thread specialization for BINARY_SUBSCR (gh-127227)Donghee Na2024-12-021-2/+8
|