summaryrefslogtreecommitdiffstats
path: root/Tools/cases_generator/stack.py
Commit message (Collapse)AuthorAgeFilesLines
* GH-135379: Top of stack caching for the JIT. (GH-135465)Mark Shannon2025-12-111-1/+8
| | | | Uses three registers to cache values at the top of the evaluation stack This significantly reduces memory traffic for smaller, more common uops.
* gh-141976: Check stack bounds in JIT optimizer (GH-142201)Ken Jin2025-12-041-1/+12
|
* GH-141794: Limit size of generated machine code. (GH-142228)Mark Shannon2025-12-031-1/+1
| | | | | | * Factor out bodies of the largest uops, to reduce jit code size. * Factor out common assert, also reducing jit code size. * Limit size of jitted code for a single executor to 1MB.
* GH-135379: Remove types from stack items in code generator. (GH-135384)Mark Shannon2025-06-111-14/+6
| | | | * Make casts explicit in the instruction definitions
* GH-132554: Fix tier2 `FOR_ITER` implementation and optimizations (GH-135137)Mark Shannon2025-06-051-1/+1
|
* GH-131498: Replace single-element arrays with scalars in bytecodes.c (GH-132615)Brandt Bucher2025-04-181-12/+10
|
* GH-131498: Cases generator: Allow input and 'peek' variables to be modified ↵Mark Shannon2025-04-141-15/+21
| | | | (GH-132506)
* GH-131498: Cases generator: manage stacks automatically (GH-132074)Mark Shannon2025-04-041-28/+43
|
* GH-131498: Another refactoring of the code generator (GH-131827)Mark Shannon2025-03-311-167/+160
| | | | | | | | | | | | * 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 analyis to optimizer generated code * Add 'out' parameter to stack.pop
* GH-131729: Consider in-memory state when merging storage and stack (GH-131773)Mark Shannon2025-03-271-0/+7
|
* GH-131729: Code-gen better liveness analysis (GH-131732)Mark Shannon2025-03-261-151/+169
| | | | | | | | | | | | * 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-131513: Cases generator: Allow dead inputs to be reassigned (GH-131515)Mark Shannon2025-03-211-0/+4
|
* GH-131498: Remove conditional stack effects (GH-131499)Mark Shannon2025-03-201-31/+3
| | | * Adds some missing #includes
* GH-130296: Remove `_PyOpcode_max_stack_effect` as it is no longer used ↵Mark Shannon2025-03-201-10/+0
| | | | (GH-131493)
* gh-131152: Remove unused imports from `Tools/cases_generator` (#131156)Victor Stinner2025-03-131-2/+1
|
* GH-128682: Account for escapes in `DECREF_INPUTS` (GH-129953)Mark Shannon2025-02-121-12/+108
| | | | | | | | * Handle escapes in DECREF_INPUTS * Mark a few more functions as escaping * Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
* GH-128682: Spill the stack pointer in labels, as well as instructions ↵Mark Shannon2025-02-041-1/+1
| | | | (GH-129618)
* Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and ↵Sam Gross2025-01-231-2/+29
| | | | | | | 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-201-29/+2
| | | | generators (GH-128918)
* Refactor code generators a bit (GH-128920)Mark Shannon2025-01-171-10/+11
| | | Refactor code generators a bit to avoid passing stack property around all over the place
* gh-115999: Specialize `LOAD_ATTR` for instance and class receivers in ↵mpage2025-01-141-4/+0
| | | | | | | free-threaded builds (#128164) Finish specialization for LOAD_ATTR in the free-threaded build by adding support for class and instance receivers.
* gh-115999: Specialize loading attributes from modules in free-threaded ↵mpage2024-12-131-0/+4
| | | | | | | | | 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-126612: Include stack effects of uops when computing maximum stack depth ↵mpage2024-11-261-21/+37
| | | | (#126894)
* GH-119866: Spill the stack around escaping calls. (GH-124392)Mark Shannon2024-10-071-95/+338
| | | | | | | * 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-123996: Explicitly mark 'self_or_null' as an array of size 1 to ensure ↵Mark Shannon2024-09-121-2/+9
| | | | that it is kept in memory for calls (GH-124003)
* GH-120024: Tidy up case generator code a bit. (GH-122780)Mark Shannon2024-08-081-55/+79
|
* gh-118926: Spill deferred references to stack in cases generator (#122748)Sam Gross2024-08-071-9/+34
| | | | | | | This automatically spills the results from `_PyStackRef_FromPyObjectNew` to the in-memory stack so that the deferred references are visible to the GC before we make any possibly escaping call. Co-authored-by: Ken Jin <kenjin@python.org>
* GH-122155: Track local variables between pops and pushes in cases generator ↵Mark Shannon2024-08-011-46/+126
| | | | (GH-122286)
* GH-122155: Fix cases generator to correctly compute 'peek' offset for error ↵Mark Shannon2024-07-231-4/+11
| | | | handling (GH-122158)
* GH-121784: Generate an error during code gen if a variable is marked ↵Mark Shannon2024-07-181-10/+14
| | | | | | | | | | | | `unused`, but is used and thus cached in a prior uop. (#121788) * Reject uop definitions that declare values as 'unused' that are already cached by prior uops * Track which variables are defined and only load from memory when needed * Support explicit `flush` in macro definitions. * Make sure stack is flushed in where needed.
* GH-118926: Better distinguish between pointer and arrays in interpreter ↵Mark Shannon2024-07-091-5/+6
| | | | generator (GH-121496)
* gh-117139: Convert the evaluation stack to stack refs (#118450)Ken Jin2024-06-261-4/+6
| | | | | | | | | | | | | | | | | 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>
* GH-120982: Add stack check assertions to generated interpreter code (GH-120992)Mark Shannon2024-06-251-0/+1
|
* gh-119689: generate stack effect metadata for pseudo instructions (#119691)Irit Katriel2024-05-291-7/+15
|
* GH-115457: Support splitting and replication of micro ops. (GH-115558)Mark Shannon2024-02-201-4/+16
|
* gh-114058: Foundations of the Tier2 redundancy eliminator (GH-115085)Ken Jin2024-02-131-2/+2
| | | | | | | --------- Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com> Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
* GH-112354: `_GUARD_IS_TRUE_POP` side-exits to target the next instruction, ↵Mark Shannon2024-01-151-0/+2
| | | | not themselves. (GH-114078)
* gh-113710: Add types to the interpreter DSL (#113711)Ken Jin2024-01-121-9/+9
| | | | Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* GH-111485: Delete the old generator code. (GH-113321)Mark Shannon2023-12-211-2/+16
|
* GH-111485: Generate instruction and uop metadata (GH-113287)Mark Shannon2023-12-201-8/+32
|
* GH-111485: Test the new cases generator (GH-113252)Mark Shannon2023-12-181-1/+1
|
* GH-111485: Factor out tier 2 code generation from the rest of the ↵Mark Shannon2023-12-121-0/+87
| | | | interpreter code generator (GH-112968)
* GH-111485: Separate out parsing, analysis and code-gen phases of tier 1 code ↵Mark Shannon2023-12-071-0/+81
generator (GH-112299)