aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer_cases.c.h
Commit message (Collapse)AuthorAge
* GH-131798: Remove JIT guards for dict, frozenset, list, set, and tuple ↵Brandt Bucher2025-04-09
| | | | (GH-132289)
* GH-131798: Narrow the result of _CONTAINS_OP_DICT to bool in the JIT (GH-132269)Nadeshiko Manju2025-04-08
| | | | Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
* GH-131798: Narrow the result type of _BINARY_OP_SUBSCR_STR_INT to str in the ↵Tomas R.2025-04-08
| | | | JIT (GH-132153)
* GH-131798: Narrow the result of _CONTAINS_OP_SET to bool in the JIT (GH-132057)Tomas R.2025-04-05
|
* GH-131498: Cases generator: manage stacks automatically (GH-132074)Mark Shannon2025-04-04
|
* GH-131498: Cases generator: Parse down to C statement level. (GH-131948)Mark Shannon2025-04-02
| | | | | * Parse down to statement level in the cases generator * Add handling for #if macros, treating them much like normal ifs.
* GH-131726: Split up _CHECK_VALIDITY_AND_SET_IP (GH-131810)Brandt Bucher2025-04-01
|
* GH-131798: Allow the JIT to remove more int/float/str guards (GH-131800)Brandt Bucher2025-04-01
|
* gh-130704: Strength reduce `LOAD_FAST{_LOAD_FAST}` (#130708)mpage2025-04-01
| | | Optimize `LOAD_FAST` opcodes into faster versions that load borrowed references onto the operand stack when we can prove that the lifetime of the local outlives the lifetime of the temporary that is loaded onto the stack.
* GH-131798: Remove type checks for _TO_BOOL_STR (GH-131816)Amit Lavon2025-03-30
|
* GH-130415: Remove redundant sym_matches_type calls in the JIT optimizer ↵Brandt Bucher2025-03-27
| | | | (GH-131778)
* GH-131729: Code-gen better liveness analysis (GH-131732)Mark Shannon2025-03-26
| | | | | | | | | | | | * Rename 'defined' attribute to 'in_local' to more accurately reflect how it is used * Make death of variables explicit even for array variables. * Convert in_memory from boolean to stack offset * Don't apply liveness analysis to optimizer generated code * Fix RETURN_VALUE in optimizer
* GH-130415: Optimize constant comparison in JIT builds (GH-131489)Savannah Ostrowski2025-03-21
|
* GH-131498: Remove conditional stack effects (GH-131499)Mark Shannon2025-03-20
| | | * Adds some missing #includes
* gh-115999: Add free-threaded specialization for FOR_ITER (#128798)T. Wouters2025-03-12
| | | | Add free-threaded versions of existing specialization for FOR_ITER (list, tuples, fast range iterators and generators), without significantly affecting their thread-safety. (Iterating over shared lists/tuples/ranges should be fine like before. Reusing iterators between threads is not fine, like before. Sharing generators between threads is a recipe for significant crashes, like before.)
* GH-130903: typo in optimizer DSL for _GUARD_BOTH_UNICODE (#130904)Jamie Phan2025-03-06
| | | Typo introduced in gh-118910.
* GH-130415: Narrow str to "" based on boolean tests (GH-130476)Amit Lavon2025-03-04
|
* GH-130415: Narrow int to 0 based on boolean tests (GH-130772)Klaus1172025-03-04
|
* GH-130415: Use boolean guards to narrow types to values in the JIT (GH-130659)Brandt Bucher2025-03-02
|
* GH-130296: Avoid stack transients in four instructions. (GH-130310)Mark Shannon2025-02-28
| | | | | | | | | * Combine _GUARD_GLOBALS_VERSION_PUSH_KEYS and _LOAD_GLOBAL_MODULE_FROM_KEYS into _LOAD_GLOBAL_MODULE * Combine _GUARD_BUILTINS_VERSION_PUSH_KEYS and _LOAD_GLOBAL_BUILTINS_FROM_KEYS into _LOAD_GLOBAL_BUILTINS * Combine _CHECK_ATTR_MODULE_PUSH_KEYS and _LOAD_ATTR_MODULE_FROM_KEYS into _LOAD_ATTR_MODULE * Remove stack transient in LOAD_ATTR_WITH_HINT
* GH-128682: Account for escapes in `DECREF_INPUTS` (GH-129953)Mark Shannon2025-02-12
| | | | | | | | * 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-07
| | | | (#129700)
* GH-129715: Remove _DYNAMIC_EXIT (GH-129716)Brandt Bucher2025-02-07
|
* GH-129709: Clean up tier two (GH-129710)Brandt Bucher2025-02-07
|
* GH-128563: Generate `opcode = ...` in instructions that need `opcode` ↵Mark Shannon2025-02-03
| | | | | (GH-129608) * Remove support for GO_TO_INSTRUCTION
* GH-128682: Make `PyStackRef_CLOSE` escaping. (GH-129404)Mark Shannon2025-02-03
|
* GH-128914: Remove all but one conditional stack effects (GH-129226)Mark Shannon2025-01-27
| | | | | | | | | | | | | * 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
* Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and ↵Sam Gross2025-01-23
| | | | | | | 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-128914: Remove conditional stack effects from `bytecodes.c` and the code ↵Mark Shannon2025-01-20
| | | | generators (GH-128918)
* GH-128939: Refactor JIT optimize structs (GH-128940)Mark Shannon2025-01-20
|
* GH-126599: Remove the "counter" optimizer/executor (GH-126853)Xuanteng Huang2025-01-16
|
* gh-100239: specialize long tail of binary operations (#128722)Irit Katriel2025-01-16
|
* gh-115999: Specialize `LOAD_ATTR` for instance and class receivers in ↵mpage2025-01-14
| | | | | | | 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-14
| | | | | | | (GH-128822) * Mark Py_DECREF and Py_XDECREF as escaping * Remove explicit loops for clearing array inputs
* GH-128685: Specialize (rather than quicken) LOAD_CONST into ↵Mark Shannon2025-01-13
| | | | LOAD_CONST_[IM]MORTAL (GH-128708)
* GH-127809: Fix the JIT's understanding of ** (GH-127844)Brandt Bucher2025-01-07
|
* GH-128375: Better instrument for `FOR_ITER` (GH-128445)Mark Shannon2025-01-06
|
* gh-128195: Add `_REPLACE_WITH_TRUE` to the tier2 optimizer (GH-128203)Yan Yanchii2024-12-24
| | | Add `_REPLACE_WITH_TRUE` to the tier2 optimizer
* gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)Neil Schemenauer2024-12-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-19
| | | | (GH-122564)
* gh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737)Donghee Na2024-12-19
|
* gh-115999: Specialize loading attributes from modules in free-threaded ↵mpage2024-12-13
| | | | | | | | | 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-120619: Strength reduce function guards, support 2-operand uop forms ↵Ken Jin2024-11-09
| | | | | (GH-124846) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* gh-115999: Implement thread-local bytecode and enable specialization for ↵mpage2024-11-04
| | | | | | | | | `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.
* GH-125837: Split `LOAD_CONST` into three. (GH-125972)Mark Shannon2024-10-29
| | | | | | | | * Add LOAD_CONST_IMMORTAL opcode * Add LOAD_SMALL_INT opcode * Remove RETURN_CONST opcode
* GH-125912: Teach the JIT's optimizer about _BINARY_OP_INPLACE_ADD_UNICODE ↵Brandt Bucher2024-10-28
| | | | (GH-125935)
* gh-115999: Refactor `LOAD_GLOBAL` specializations to avoid reloading ↵mpage2024-10-09
| | | | | | | | | | | | | | | | | | {globals, builtins} keys (gh-124953) Each of the `LOAD_GLOBAL` specializations is implemented roughly as: 1. Load keys version. 2. Load cached keys version. 3. Deopt if (1) and (2) don't match. 4. Load keys. 5. Load cached index into keys. 6. Load object from (4) at offset from (5). This is not thread-safe in free-threaded builds; the keys object may be replaced in between steps (3) and (4). This change refactors the specializations to avoid reloading the keys object and instead pass the keys object from guards to be consumed by downstream uops.
* GH-119866: Spill the stack around escaping calls. (GH-124392)Mark Shannon2024-10-07
| | | | | | | * Spill the evaluation around escaping calls in the generated interpreter and JIT. * The code generator tracks live, cached values so they can be saved to memory when needed. * Spills the stack pointer around escaping calls, so that the exact stack is visible to the cycle GC.
* gh-120619: Optimize through `_Py_FRAME_GENERAL` (GH-124518)Ken Jin2024-10-03
| | | | | * Optimize through _Py_FRAME_GENERAL * refactor
* GH-123516: Improve JIT memory consumption by invalidating cold executors ↵Savannah Ostrowski2024-09-27
| | | | | (GH-124443) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>