Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite28b0dc

Browse files
Fidget-SpinnergvanrossumJuliaPoo
authored
gh-107557: Setup abstract interpretation (#107847)
Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>Co-authored-by: Jules <57632293+juliapoo@users.noreply.github.com>
1 parent34e1917 commite28b0dc

21 files changed

+1118
-9
lines changed

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Programs/test_frozenmain.h generated
9090
Python/Python-ast.cgenerated
9191
Python/executor_cases.c.hgenerated
9292
Python/generated_cases.c.hgenerated
93+
Python/abstract_interp_cases.c.hgenerated
9394
Python/opcode_targets.hgenerated
9495
Python/stdlib_module_names.hgenerated
9596
Tools/peg_generator/pegen/grammar_parser.pygenerated

‎Include/cpython/optimizer.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef struct _PyExecutorObject {
2222
typedefstruct_PyOptimizerObject_PyOptimizerObject;
2323

2424
/* Should return > 0 if a new executor is created. O if no executor is produced and < 0 if an error occurred. */
25-
typedefint (*optimize_func)(_PyOptimizerObject*self,PyCodeObject*code,_Py_CODEUNIT*instr,_PyExecutorObject**);
25+
typedefint (*optimize_func)(_PyOptimizerObject*self,PyCodeObject*code,_Py_CODEUNIT*instr,_PyExecutorObject**,intcurr_stackentries);
2626

2727
typedefstruct_PyOptimizerObject {
2828
PyObject_HEAD

‎Include/internal/pycore_opcode_metadata.h‎

Lines changed: 142 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndefPy_INTERNAL_OPTIMIZER_H
2+
#definePy_INTERNAL_OPTIMIZER_H
3+
#ifdef__cplusplus
4+
extern"C" {
5+
#endif
6+
7+
#ifndefPy_BUILD_CORE
8+
# error "this header requires Py_BUILD_CORE define"
9+
#endif
10+
11+
#include"pycore_uops.h"
12+
13+
int_Py_uop_analyze_and_optimize(PyCodeObject*code,
14+
_PyUOpInstruction*trace,inttrace_len,intcurr_stackentries);
15+
16+
17+
#ifdef__cplusplus
18+
}
19+
#endif
20+
#endif/* !Py_INTERNAL_OPTIMIZER_H */

‎Include/internal/pycore_uops.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
#define_Py_UOP_MAX_TRACE_LENGTH32
11+
#define_Py_UOP_MAX_TRACE_LENGTH64
1212

1313
typedefstruct {
1414
uint32_topcode;

‎Makefile.pre.in‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ PYTHON_OBJS=\
405405
Python/mysnprintf.o \
406406
Python/mystrtoul.o \
407407
Python/optimizer.o \
408+
Python/optimizer_analysis.o \
408409
Python/pathconfig.o \
409410
Python/preconfig.o \
410411
Python/pyarena.o \
@@ -1552,10 +1553,12 @@ regen-cases:
15521553
-m $(srcdir)/Include/internal/pycore_opcode_metadata.h.new \
15531554
-e $(srcdir)/Python/executor_cases.c.h.new \
15541555
-p $(srcdir)/Lib/_opcode_metadata.py.new \
1556+
-a $(srcdir)/Python/abstract_interp_cases.c.h.new \
15551557
$(srcdir)/Python/bytecodes.c
15561558
$(UPDATE_FILE) $(srcdir)/Python/generated_cases.c.h $(srcdir)/Python/generated_cases.c.h.new
15571559
$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_opcode_metadata.h $(srcdir)/Include/internal/pycore_opcode_metadata.h.new
15581560
$(UPDATE_FILE) $(srcdir)/Python/executor_cases.c.h $(srcdir)/Python/executor_cases.c.h.new
1561+
$(UPDATE_FILE) $(srcdir)/Python/abstract_interp_cases.c.h $(srcdir)/Python/abstract_interp_cases.c.h.new
15591562
$(UPDATE_FILE) $(srcdir)/Lib/_opcode_metadata.py $(srcdir)/Lib/_opcode_metadata.py.new
15601563

15611564
Python/compile.o: $(srcdir)/Include/internal/pycore_opcode_metadata.h
@@ -1568,6 +1571,7 @@ Python/ceval.o: \
15681571

15691572
Python/executor.o: \
15701573
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
1574+
$(srcdir)/Include/internal/pycore_optimizer.h \
15711575
$(srcdir)/Python/ceval_macros.h \
15721576
$(srcdir)/Python/executor_cases.c.h
15731577

@@ -1576,7 +1580,12 @@ Python/flowgraph.o: \
15761580

15771581
Python/optimizer.o: \
15781582
$(srcdir)/Python/executor_cases.c.h \
1579-
$(srcdir)/Include/internal/pycore_opcode_metadata.h
1583+
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
1584+
$(srcdir)/Include/internal/pycore_optimizer.h
1585+
1586+
Python/optimizer_analysis.o: \
1587+
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
1588+
$(srcdir)/Include/internal/pycore_optimizer.h
15801589

15811590
Python/frozen.o: $(FROZEN_FILES_OUT)
15821591

@@ -1786,6 +1795,7 @@ PYTHON_HEADERS= \
17861795
$(srcdir)/Include/internal/pycore_obmalloc_init.h \
17871796
$(srcdir)/Include/internal/pycore_opcode.h \
17881797
$(srcdir)/Include/internal/pycore_opcode_utils.h \
1798+
$(srcdir)/Include/internal/pycore_optimizer.h \
17891799
$(srcdir)/Include/internal/pycore_pathconfig.h \
17901800
$(srcdir)/Include/internal/pycore_pyarena.h \
17911801
$(srcdir)/Include/internal/pycore_pyerrors.h \
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Generate the cases needed for the barebones tier 2 abstract interpreter for optimization passes in CPython.

‎PCbuild/_freeze_module.vcxproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
<ClCompileInclude="..\Python\mysnprintf.c" />
219219
<ClCompileInclude="..\Python\mystrtoul.c" />
220220
<ClCompileInclude="..\Python\optimizer.c" />
221+
<ClCompileInclude="..\Python\optimizer_analysis.c" />
221222
<ClCompileInclude="..\Python\pathconfig.c" />
222223
<ClCompileInclude="..\Python\perf_trampoline.c" />
223224
<ClCompileInclude="..\Python\preconfig.c" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp