Commit Graph

60 Commits

Author SHA1 Message Date
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
Carl Meyer 1ce9ea0453
dump readable opcode names in flowgraph debug utility (#109392)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-09-14 14:28:21 +00:00
Brandt Bucher 22e65eecaa
GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300) 2023-09-13 10:25:45 -07:00
Victor Stinner b32d4cad15
gh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)
Change generated by the command:

sed -i -e 's!_PyLong_AsInt!PyLong_AsInt!g' \
    $(find -name "*.c" -o -name "*.h")
2023-08-25 01:01:30 +02:00
Victor Stinner f5559f38d9
gh-108308: Replace PyDict_GetItem() with PyDict_GetItemRef() (#108309)
Replace PyDict_GetItem() calls with PyDict_GetItemRef()
or PyDict_GetItemWithError() to handle errors.

* Replace PyLong_AS_LONG() with _PyLong_AsInt()
  and check for errors.
* Check for PyDict_Contains() error.
* pycore_init_builtins() checks for _PyType_Lookup() failure.
2023-08-23 17:40:26 +02:00
Irit Katriel a1cc74c4ee
gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop (#108242) 2023-08-21 23:44:31 +01:00
Irit Katriel bafedfbebd
gh-106149: move CFG and basicblock definitions into flowgraph.c, use them as opaque types in compile.c (#107639) 2023-08-10 13:03:47 +01:00
Brandt Bucher a9caf9cf90
GH-105848: Simplify the arrangement of CALL's stack (GH-107788) 2023-08-09 18:19:39 +00:00
Irit Katriel b0202a4e5d
gh-106149: Simplify stack depth calculation. Replace asserts by exceptions. (#107255) 2023-07-26 13:32:47 +01:00
Irit Katriel 7608fa8fd5
gh-106149: move _PyCfg_BasicblockLastInstr and make it local to flowgraph.c (#107180) 2023-07-24 22:08:59 +01:00
Irit Katriel 6a70edf24c
gh-105481: expose opcode metadata via the _opcode module (#106688) 2023-07-14 18:41:52 +01:00
Irit Katriel 2ca008e2b7
gh-105481: move Python/opcode_metadata.h to Include/internal/pycore_opcode_metadata.h (#106673) 2023-07-12 11:30:25 +01:00
Brandt Bucher e4ba71fe4b
GH-106008: Fix refleak when peepholing `None` comparisons (#106367) 2023-07-04 11:03:57 +01:00
Irit Katriel 200f255411
gh-106149: move unconditional jump direction resolution from optimizer to assembler (#106291) 2023-07-01 11:28:07 +01:00
Brandt Bucher 7b2d94d875
GH-106008: Make implicit boolean conversions explicit (GH-106003) 2023-06-29 13:49:54 -07:00
hms 8bff940ad6
gh-105775: Convert LOAD_CLOSURE to a pseudo-op (#106059)
This enables super-instruction formation,
removal of checks for uninitialized variables,
and frees up an instruction.
2023-06-29 09:34:00 -07:00
Irit Katriel 5290881009
gh-106149: move jump target resolution from optimizer to assembler (#106150) 2023-06-27 20:24:58 +01:00
Irit Katriel 14d01262da
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865) 2023-06-17 17:00:16 +01:00
Irit Katriel d1b0297d3e
gh-105481: add HAS_JUMP flag to opcode metadata (#105791) 2023-06-14 23:14:22 +00:00
Irit Katriel 58f5227d7c
gh-105481: add pseudo-instructions to the bytecodes DSL (#105506) 2023-06-11 22:31:59 +01:00