summaryrefslogtreecommitdiffstats
path: root/Python/flowgraph.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-133371: Don't optimize `LOAD_FAST` instructions whose local is killed by ↵mpage2025-05-051-0/+5
| | | | | | | | `DELETE_FAST` (#133383) In certain cases it's possible for locals loaded by `LOAD_FAST` instructions to be on the stack when the local is killed by `DEL_FAST`. These `LOAD_FAST` instructions should not be optimized into `LOAD_FAST_BORROW` as the strong reference in the frame is killed while there is still a reference on the stack.
* gh-132775: Add _PyCode_ReturnsOnlyNone() (gh-132981)Eric Snow2025-04-291-1/+1
| | | | | The function indicates whether or not the function has a return statement. This is used by a later change related treating some functions like scripts.
* gh-130907: Treat all module-level annotations as conditional (#131550)Jelle Zijlstra2025-04-281-1/+23
|
* gh-130704: Strength reduce `LOAD_FAST{_LOAD_FAST}` (#130708)mpage2025-04-011-0/+431
| | | 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-130296: Remove `_PyOpcode_max_stack_effect` as it is no longer used ↵Mark Shannon2025-03-201-12/+2
| | | | (GH-131493)
* gh-126835: Move constant tuple folding from ast_opt to CFG (#130769)Yan Yanchii2025-03-191-3/+96
|
* gh-130480: Move duplicate `LOAD_SMALL_INT` optimization from codegen to CFG ↵Yan Yanchii2025-03-141-4/+37
| | | | (#130481)
* gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it can be ↵Irit Katriel2025-03-131-7/+11
| | | | used outside of the compiler (#130930)
* gh-126835: Avoid creating unnecessary tuple when looking for constant ↵Yan Yanchii2025-03-121-78/+125
| | | | sequence during constant folding (#131054)
* GH-123044: Give the `POP_TOP` after a case test a location in the body, not ↵Mark Shannon2025-03-101-5/+5
| | | | the pattern. (GH-130627)
* GH-128534: Fix behavior of branch monitoring for `async for` (GH-130847)Mark Shannon2025-03-071-1/+1
| | | * Both branches in a pair now have a common source and are included in co_branches
* gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738)Hugo Beauzée-Luyssen2025-03-021-3/+2
| | | | | Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not included first and when we are in a platform-agnostic context. This is to avoid having features defined by `stdbool.h` before those decided by `Python.h`.
* gh-126835: Move constant unaryop & binop folding to CFG (#129550)Yan Yanchii2025-02-211-38/+293
|
* gh-126835: Set location for noped out instructions after constant folding in ↵Yan Yanchii2025-02-141-54/+31
| | | | CFG. (#130109)
* gh-126835: Move const folding of lists & sets from ast_opt.c to flowgraph.c ↵Yan Yanchii2025-02-131-18/+34
| | | | (#130032)
* gh-126835: Make CFG optimizer skip over NOP's when looking for const ↵Yan Yanchii2025-02-091-71/+88
| | | | | sequence construction (#129703) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR ↵Irit Katriel2025-02-071-4/+9
| | | | (#129700)
* gh-126835: Fix reference leak in ↵Yan Yanchii2025-02-041-2/+8
| | | | `Python/flowgrapc.::optimize_if_const_subscr` (#129634)
* gh-126835: Move constant subscript folding to CFG (#129568)Yan Yanchii2025-02-041-0/+82
| | | | | Move folding of constant subscription from AST optimizer to CFG. Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-126835: Move optimization of constant sequence creation from codegen to ↵Kirill Podoprigora2025-02-011-4/+71
| | | | | | | | | | | | | | | | | | | | | | CFG (#129426) Codegen phase has an optimization that transforms ``` LOAD_CONST x LOAD_CONST y LOAD_CONXT z BUILD_LIST/BUILD_SET (3) ``` -> ``` BUILD_LIST/BUILD_SET (0) LOAD_CONST (x, y, z) LIST_EXTEND/SET_UPDATE 1 ``` This optimization has now been moved to CFG phase to make #128802 work. Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
* Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and ↵Sam Gross2025-01-231-0/+6
| | | | | | | 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-6/+0
| | | | generators (GH-128918)
* Remove unnecessary LIST_TO_TUPLE conversions (GH-126558)Brandt Bucher2025-01-081-0/+7
|
* GH-128533: Add `NOT_TAKEN` instruction after bytecode optimization. (GH-128554)Mark Shannon2025-01-061-6/+3
|
* GH-122548: Implement branch taken and not taken events for sys.monitoring ↵Mark Shannon2024-12-191-0/+6
| | | | (GH-122564)
* gh-126612: Include stack effects of uops when computing maximum stack depth ↵mpage2024-11-261-23/+43
| | | | (#126894)
* GH-125837: Split `LOAD_CONST` into three. (GH-125972)Mark Shannon2024-10-291-30/+20
| | | | | | | | * Add LOAD_CONST_IMMORTAL opcode * Add LOAD_SMALL_INT opcode * Remove RETURN_CONST opcode
* gh-124871: fix 'visited' tracking in compiler's reachability analysis (#124952)Irit Katriel2024-10-041-2/+3
|
* gh-124285: Fix bug where bool() is called multiple times for the same part ↵Irit Katriel2024-09-251-2/+71
| | | | of a boolean expression (#124394)
* gh-121404: split compile.c into compile.c and codegen.c (#123651)Irit Katriel2024-09-091-2/+0
|
* Fixes loop variables to be the same types as their limit (GH-120958)Steve Dower2024-06-241-1/+1
|
* gh-120367: fix bug where compiler detects redundant jump after pseudo op ↵Irit Katriel2024-06-181-1/+1
| | | | replacement (#120714)
* gh-120367: fix removal of redundant NOPs and jumps after reordering hot-cold ↵Irit Katriel2024-06-171-12/+18
| | | | blocks (#120425)
* gh-120225: fix crash in compiler on empty block at end of exception handler ↵Irit Katriel2024-06-071-6/+2
| | | | (#120235)
* Fix typos in documentation and comments (#119763)Xie Yanbo2024-06-041-1/+1
|
* gh-119744: move a few functions from compile.c to flowgraph.c (#119745)Irit Katriel2024-05-301-4/+141
|
* gh-117494: extract the Instruction Sequence data structure into a separate ↵Irit Katriel2024-04-041-8/+8
| | | | file (#117496)
* gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private ↵Irit Katriel2024-04-021-3/+3
| | | | (#117412)
* gh-117288: Allocate fewer label IDs in _PyCfg_ToInstructionSequence (#117290)Irit Katriel2024-03-271-2/+3
|
* gh-115796: fix exception table construction in ↵Irit Katriel2024-02-221-6/+11
| | | | _testinternalcapi.assemble_code_object (#115797)
* gh-115420: Fix translation of exception hander targets by ↵Irit Katriel2024-02-151-1/+1
| | | | _testinternalcapi.optimize_cfg. (#115425)
* gh-107901: make compiler inline basic blocks with no line number and no ↵Irit Katriel2024-02-021-21/+54
| | | | fallthrough (#114750)
* gh-114569: Use PyMem_* APIs for non-PyObjects in compiler (#114587)Erlend E. Aasland2024-01-291-3/+3
|
* gh-107901: compiler replaces POP_BLOCK instruction by NOPs before ↵Irit Katriel2024-01-251-1/+2
| | | | optimisations (#114530)
* gh-114265: remove i_loc_propagated, jump threading does not consider line ↵Irit Katriel2024-01-251-41/+47
| | | | numbers anymore (#114535)
* gh-114083: apply optimization of LOAD_CONST instructions to the whole CFG ↵Irit Katriel2024-01-221-140/+179
| | | | before optimize_basic_block. (#114408)
* gh-114265: move line number propagation before cfg optimization, remove ↵Irit Katriel2024-01-191-53/+54
| | | | guarantee_lineno_for_exits (#114267)
* gh-107901: duplicate blocks with no lineno that have an eval break and ↵Irit Katriel2024-01-121-10/+22
| | | | multiple predecessors (#113950)
* gh-107901: jump leaving an exception handler doesn't need an eval break ↵Irit Katriel2024-01-111-1/+1
| | | | check (#113943)
* gh-107901: synthetic jumps which are not at end of loop no longer check the ↵Irit Katriel2024-01-061-3/+16
| | | | eval breaker (#113721)