Hugo Beauzée-Luyssen
214562ed4d
gh-130740: Move some `stdbool.h` includes after `Python.h` ( #130738 )
...
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`.
2025-03-02 09:56:49 +00:00
Yan Yanchii
38642bff13
gh-126835: Move constant unaryop & binop folding to CFG ( #129550 )
2025-02-21 17:54:22 +00:00
Yan Yanchii
334589f619
gh-126835: Set location for noped out instructions after constant folding in CFG. ( #130109 )
2025-02-14 14:15:08 +00:00
Yan Yanchii
140e69c4a8
gh-126835: Move const folding of lists & sets from ast_opt.c to flowgraph.c ( #130032 )
2025-02-13 12:11:07 +00:00
Yan Yanchii
91d9544112
gh-126835: Make CFG optimizer skip over NOP's when looking for const sequence construction ( #129703 )
...
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-09 18:00:41 +00:00
Irit Katriel
a1417b211f
gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR ( #129700 )
2025-02-07 22:39:54 +00:00
Yan Yanchii
d3c54f3788
gh-126835: Fix reference leak in `Python/flowgrapc.::optimize_if_const_subscr` ( #129634 )
2025-02-04 10:38:06 +00:00
Yan Yanchii
0664c1af9b
gh-126835: Move constant subscript folding to CFG ( #129568 )
...
Move folding of constant subscription from AST optimizer to CFG.
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-04 10:10:55 +02:00
Kirill Podoprigora
7d0521d5fc
gh-126835: Move optimization of constant sequence creation from codegen to 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>
2025-02-01 11:39:44 +00:00
Sam Gross
a10f99375e
Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918)" (GH-129202)
...
The commit introduced a ~2.5-3% regression in the free threading build.
This reverts commit ab61d3f430
.
2025-01-23 09:26:25 +00:00
Mark Shannon
ab61d3f430
GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918)
2025-01-20 17:09:23 +00:00
Brandt Bucher
004f9fd1f2
Remove unnecessary LIST_TO_TUPLE conversions (GH-126558)
2025-01-08 09:00:11 -08:00
Mark Shannon
2434fd2d50
GH-128533: Add `NOT_TAKEN` instruction after bytecode optimization. (GH-128554)
2025-01-06 22:01:07 +00:00
Mark Shannon
d2f1d917e8
GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564)
2024-12-19 16:59:51 +00:00
mpage
193890c1cc
gh-126612: Include stack effects of uops when computing maximum stack depth ( #126894 )
2024-11-26 00:53:49 +00:00
Mark Shannon
faa3272fb8
GH-125837: Split `LOAD_CONST` into three. (GH-125972)
...
* Add LOAD_CONST_IMMORTAL opcode
* Add LOAD_SMALL_INT opcode
* Remove RETURN_CONST opcode
2024-10-29 11:15:42 +00:00
Irit Katriel
f474391b26
gh-124871: fix 'visited' tracking in compiler's reachability analysis ( #124952 )
2024-10-04 17:37:38 +01:00
Irit Katriel
78aeb38f7d
gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression ( #124394 )
2024-09-25 15:51:25 +01:00
Irit Katriel
1a9d8917a3
gh-121404: split compile.c into compile.c and codegen.c ( #123651 )
2024-09-09 18:21:51 +01:00
Steve Dower
e731554337
Fixes loop variables to be the same types as their limit (GH-120958)
2024-06-24 17:11:47 +01:00
Irit Katriel
b7f478948f
gh-120367: fix bug where compiler detects redundant jump after pseudo op replacement ( #120714 )
2024-06-18 22:09:23 +00:00
Irit Katriel
21866c8ed2
gh-120367: fix removal of redundant NOPs and jumps after reordering hot-cold blocks ( #120425 )
2024-06-17 10:10:06 +00:00
Irit Katriel
4fc82b6d3b
gh-120225: fix crash in compiler on empty block at end of exception handler ( #120235 )
2024-06-07 22:37:35 +01:00
Xie Yanbo
9e052619a6
Fix typos in documentation and comments ( #119763 )
2024-06-04 10:22:22 +00:00
Irit Katriel
13a5fdc72f
gh-119744: move a few functions from compile.c to flowgraph.c ( #119745 )
2024-05-30 21:55:06 +01:00
Irit Katriel
04697bcfaf
gh-117494: extract the Instruction Sequence data structure into a separate file ( #117496 )
2024-04-04 15:47:26 +00:00
Irit Katriel
1d5479b236
gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private ( #117412 )
2024-04-02 10:34:49 +00:00
Irit Katriel
262fb911ab
gh-117288: Allocate fewer label IDs in _PyCfg_ToInstructionSequence ( #117290 )
2024-03-27 17:38:19 +00:00
Irit Katriel
96c1737591
gh-115796: fix exception table construction in _testinternalcapi.assemble_code_object ( #115797 )
2024-02-22 12:36:44 +00:00
Irit Katriel
f42e112fd8
gh-115420: Fix translation of exception hander targets by _testinternalcapi.optimize_cfg. ( #115425 )
2024-02-15 14:32:52 +00:00
Irit Katriel
2091fb2a85
gh-107901: make compiler inline basic blocks with no line number and no fallthrough ( #114750 )
2024-02-02 11:26:31 +00:00
Erlend E. Aasland
8612230c1c
gh-114569: Use PyMem_* APIs for non-PyObjects in compiler ( #114587 )
2024-01-30 00:04:34 +01:00
Irit Katriel
ac5e53e150
gh-107901: compiler replaces POP_BLOCK instruction by NOPs before optimisations ( #114530 )
2024-01-25 20:06:48 +00:00
Irit Katriel
0315941441
gh-114265: remove i_loc_propagated, jump threading does not consider line numbers anymore ( #114535 )
2024-01-25 12:54:19 +00:00
Irit Katriel
ed30a3c337
gh-114083: apply optimization of LOAD_CONST instructions to the whole CFG before optimize_basic_block. ( #114408 )
2024-01-22 17:12:06 +00:00
Irit Katriel
7e49f27b41
gh-114265: move line number propagation before cfg optimization, remove guarantee_lineno_for_exits ( #114267 )
2024-01-19 14:49:26 +00:00
Irit Katriel
8aa0088ea2
gh-107901: duplicate blocks with no lineno that have an eval break and multiple predecessors ( #113950 )
2024-01-12 15:38:09 +00:00
Irit Katriel
0d8fec79ca
gh-107901: jump leaving an exception handler doesn't need an eval break check ( #113943 )
2024-01-11 14:27:41 +00:00
Irit Katriel
d36a365118
gh-107901: synthetic jumps which are not at end of loop no longer check the eval breaker ( #113721 )
2024-01-06 14:20:08 +00:00
Irit Katriel
7d01fb4808
gh-113603: Compiler no longer tries to maintain the no-empty-block invariant ( #113636 )
2024-01-03 16:57:48 +00:00
Irit Katriel
c31943af16
gh-113297: Fix segfault in compiler for with statement with 19 context managers ( #113327 )
2023-12-22 01:50:26 +00:00
Mark Shannon
e96f26083b
GH-111485: Generate instruction and uop metadata (GH-113287)
2023-12-20 14:27:25 +00:00
Irit Katriel
e51b400945
gh-113054: Compiler no longer replaces a redundant jump with no line number by a NOP ( #113139 )
2023-12-19 11:04:44 +00:00
Irit Katriel
07ebd46f9e
gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c ( #112520 )
2023-11-30 11:03:30 +00:00
Irit Katriel
52cc4af6ae
gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 ( #111459 )
2023-11-02 10:18:43 +00:00
Irit Katriel
f580edcc6a
gh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno when looking for the next instruction's lineno ( #109987 )
2023-09-28 20:33:28 +01:00
Irit Katriel
ea285ad8b6
gh-109923: set line number on the POP_TOP that follows a RETURN_GENERATOR ( #109924 )
2023-09-27 13:24:33 +01:00
Irit Katriel
d73c12b88c
gh-109823: Adjust labels in compiler when removing an empty basic block which is a jump target ( #109839 )
2023-09-25 18:25:05 +00:00
Irit Katriel
7c55399172
gh-109719: Fix missing jump target labels when compiler reorders cold/warm blocks ( #109734 )
2023-09-22 16:59:35 +00:00
Irit Katriel
9ccf0545ef
gh-109627: duplicated smalll exit blocks need to be assigned jump target labels ( #109630 )
2023-09-20 23:08:06 +00:00