Skip to content

Commit d20fbb8

Browse files
pythongh-107557: Tier 2 abstract interpreter barebones
1 parent 439466a commit d20fbb8

12 files changed

+1229
-5
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Programs/test_frozenmain.h generated
8787
Python/Python-ast.c generated
8888
Python/executor_cases.c.h generated
8989
Python/generated_cases.c.h generated
90+
Python/abstract_interp_cases.c.h generated
9091
Python/opcode_targets.h generated
9192
Python/stdlib_module_names.h generated
9293
Tools/peg_generator/pegen/grammar_parser.py generated

Include/internal/pycore_optimizer.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef Py_INTERNAL_OPTIMIZER_H
2+
#define Py_INTERNAL_OPTIMIZER_H
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#ifndef Py_BUILD_CORE
8+
# error "this header requires Py_BUILD_CORE define"
9+
#endif
10+
11+
extern int uop_analyze_and_optimize(struct _PyUOpInstruction *trace, int trace_len);
12+
13+
#ifdef __cplusplus
14+
}
15+
#endif
16+
#endif /* !Py_INTERNAL_OPTIMIZER_H */

Makefile.pre.in

Lines changed: 8 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 \
@@ -1562,6 +1563,7 @@ Python/ceval.o: \
15621563

15631564
Python/executor.o: \
15641565
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
1566+
$(srcdir)/Include/internal/pycore_optimizer.h \
15651567
$(srcdir)/Python/ceval_macros.h \
15661568
$(srcdir)/Python/executor_cases.c.h
15671569

@@ -1570,7 +1572,12 @@ Python/flowgraph.o: \
15701572

15711573
Python/optimizer.o: \
15721574
$(srcdir)/Python/executor_cases.c.h \
1573-
$(srcdir)/Include/internal/pycore_opcode_metadata.h
1575+
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
1576+
$(srcdir)/Include/internal/pycore_optimizer.h
1577+
1578+
Python/optimizer_analysis.o: \
1579+
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
1580+
$(srcdir)/Include/internal/pycore_optimizer.h
15741581

15751582
Python/frozen.o: $(FROZEN_FILES_OUT)
15761583

PCbuild/_freeze_module.vcxproj

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

PCbuild/_freeze_module.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@
283283
<ClCompile Include="..\Python\optimizer.c">
284284
<Filter>Source Files</Filter>
285285
</ClCompile>
286+
<ClCompile Include="..\Python\optimizer_analysis.c">
287+
<Filter>Source Files</Filter>
288+
</ClCompile>
286289
<ClCompile Include="..\Parser\parser.c">
287290
<Filter>Source Files</Filter>
288291
</ClCompile>

PCbuild/pythoncore.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
<ClInclude Include="..\Include\internal\pycore_object_state.h" />
249249
<ClInclude Include="..\Include\internal\pycore_obmalloc.h" />
250250
<ClInclude Include="..\Include\internal\pycore_obmalloc_init.h" />
251+
<ClInclude Include="..\Include\internal\pycore_optimizer.h" />
251252
<ClInclude Include="..\Include\internal\pycore_pathconfig.h" />
252253
<ClInclude Include="..\Include\internal\pycore_pyarena.h" />
253254
<ClInclude Include="..\Include\internal\pycore_pyerrors.h" />
@@ -279,6 +280,7 @@
279280
<ClInclude Include="..\Include\internal\pycore_unionobject.h" />
280281
<ClInclude Include="..\Include\internal\pycore_unicodeobject.h" />
281282
<ClInclude Include="..\Include\internal\pycore_unicodeobject_generated.h" />
283+
<ClInclude Include="..\Include\internal\pycore_uops.h" />
282284
<ClInclude Include="..\Include\internal\pycore_warnings.h" />
283285
<ClInclude Include="..\Include\internal\pycore_weakref.h" />
284286
<ClInclude Include="..\Include\interpreteridobject.h" />
@@ -548,6 +550,7 @@
548550
<ClCompile Include="..\Python\mysnprintf.c" />
549551
<ClCompile Include="..\Python\mystrtoul.c" />
550552
<ClCompile Include="..\Python\optimizer.c" />
553+
<ClCompile Include="..\Python\optimizer_analysis.c" />
551554
<ClCompile Include="..\Python\pathconfig.c" />
552555
<ClCompile Include="..\Python\perf_trampoline.c" />
553556
<ClCompile Include="..\Python\preconfig.c" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,9 @@
648648
<ClInclude Include="..\Include\internal\pycore_obmalloc_init.h">
649649
<Filter>Include\internal</Filter>
650650
</ClInclude>
651+
<ClInclude Include="..\Include\internal\pycore_optimizer.h">
652+
<Filter>Include\internal</Filter>
653+
</ClInclude>
651654
<ClInclude Include="..\Include\internal\pycore_pathconfig.h">
652655
<Filter>Include\internal</Filter>
653656
</ClInclude>
@@ -732,6 +735,9 @@
732735
<ClInclude Include="..\Include\internal\pycore_unionobject.h">
733736
<Filter>Include\internal</Filter>
734737
</ClInclude>
738+
<ClInclude Include="..\Include\internal\pycore_uops.h">
739+
<Filter>Include\internal</Filter>
740+
</ClInclude>
735741
<ClInclude Include="$(zlibDir)\crc32.h">
736742
<Filter>Modules\zlib</Filter>
737743
</ClInclude>
@@ -1223,6 +1229,9 @@
12231229
<ClCompile Include="..\Python\optimizer.c">
12241230
<Filter>Python</Filter>
12251231
</ClCompile>
1232+
<ClCompile Include="..\Python\optimizer_analysis.c">
1233+
<Filter>Python</Filter>
1234+
</ClCompile>
12261235
<ClCompile Include="..\Python\pathconfig.c">
12271236
<Filter>Python</Filter>
12281237
</ClCompile>

0 commit comments

Comments
 (0)