Skip to content

Commit c0fdfba

Browse files
authored
Rename tier 2 redundancy eliminator to optimizer (#115888)
The original name is just too much of a mouthful.
1 parent 7259480 commit c0fdfba

File tree

12 files changed

+30
-30
lines changed

12 files changed

+30
-30
lines changed

Diff for: .gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Programs/test_frozenmain.h generated
9595
Python/Python-ast.c generated
9696
Python/executor_cases.c.h generated
9797
Python/generated_cases.c.h generated
98-
Python/tier2_redundancy_eliminator_cases.c.h generated
98+
Python/optimizer_cases.c.h generated
9999
Python/opcode_targets.h generated
100100
Python/stdlib_module_names.h generated
101101
Tools/peg_generator/pegen/grammar_parser.py generated

Diff for: .github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Python/ast_opt.c @isidentical
3838
Python/bytecodes.c @markshannon @gvanrossum
3939
Python/optimizer*.c @markshannon @gvanrossum
4040
Python/optimizer_analysis.c @Fidget-Spinner
41-
Python/tier2_redundancy_eliminator_bytecodes.c @Fidget-Spinner
41+
Python/optimizer_bytecodes.c @Fidget-Spinner
4242
Lib/test/test_patma.py @brandtbucher
4343
Lib/test/test_type_*.py @JelleZijlstra
4444
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum

Diff for: .github/workflows/jit.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55
- '**jit**'
66
- 'Python/bytecodes.c'
77
- 'Python/optimizer*.c'
8-
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
8+
- 'Python/optimizer_bytecodes.c'
99
push:
1010
paths:
1111
- '**jit**'
1212
- 'Python/bytecodes.c'
1313
- 'Python/optimizer*.c'
14-
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
14+
- 'Python/optimizer_bytecodes.c'
1515
workflow_dispatch:
1616

1717
concurrency:

Diff for: Lib/test/test_generated_cases.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def skip_if_different_mount_drives():
3333
import parser
3434
from stack import Stack
3535
import tier1_generator
36-
import tier2_abstract_generator
36+
import optimizer_generator
3737

3838

3939
def handle_stderr():
@@ -841,7 +841,7 @@ def run_cases_test(self, input: str, input2: str, expected: str):
841841
temp_input.flush()
842842

843843
with handle_stderr():
844-
tier2_abstract_generator.generate_tier2_abstract_from_files(
844+
optimizer_generator.generate_tier2_abstract_from_files(
845845
[self.temp_input_filename, self.temp_input2_filename],
846846
self.temp_output_filename
847847
)

Diff for: Makefile.pre.in

+5-5
Original file line numberDiff line numberDiff line change
@@ -1889,9 +1889,9 @@ regen-cases:
18891889
-o $(srcdir)/Python/generated_cases.c.h.new $(srcdir)/Python/bytecodes.c
18901890
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/tier2_generator.py \
18911891
-o $(srcdir)/Python/executor_cases.c.h.new $(srcdir)/Python/bytecodes.c
1892-
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/tier2_abstract_generator.py \
1893-
-o $(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h.new \
1894-
$(srcdir)/Python/tier2_redundancy_eliminator_bytecodes.c \
1892+
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/optimizer_generator.py \
1893+
-o $(srcdir)/Python/optimizer_cases.c.h.new \
1894+
$(srcdir)/Python/optimizer_bytecodes.c \
18951895
$(srcdir)/Python/bytecodes.c
18961896
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/opcode_metadata_generator.py \
18971897
-o $(srcdir)/Include/internal/pycore_opcode_metadata.h.new $(srcdir)/Python/bytecodes.c
@@ -1904,7 +1904,7 @@ regen-cases:
19041904
$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_opcode_metadata.h $(srcdir)/Include/internal/pycore_opcode_metadata.h.new
19051905
$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_uop_metadata.h $(srcdir)/Include/internal/pycore_uop_metadata.h.new
19061906
$(UPDATE_FILE) $(srcdir)/Python/executor_cases.c.h $(srcdir)/Python/executor_cases.c.h.new
1907-
$(UPDATE_FILE) $(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h $(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h.new
1907+
$(UPDATE_FILE) $(srcdir)/Python/optimizer_cases.c.h $(srcdir)/Python/optimizer_cases.c.h.new
19081908
$(UPDATE_FILE) $(srcdir)/Lib/_opcode_metadata.py $(srcdir)/Lib/_opcode_metadata.py.new
19091909

19101910
Python/compile.o: $(srcdir)/Include/internal/pycore_opcode_metadata.h
@@ -1927,7 +1927,7 @@ Python/optimizer.o: \
19271927
Python/optimizer_analysis.o: \
19281928
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
19291929
$(srcdir)/Include/internal/pycore_optimizer.h \
1930-
$(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h
1930+
$(srcdir)/Python/optimizer_cases.c.h
19311931

19321932
Python/frozen.o: $(FROZEN_FILES_OUT)
19331933

Diff for: PCbuild/regen.targets

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<!-- Taken from _Target._compute_digest in Tools\jit\_targets.py: -->
3232
<_JITSources Include="$(PySourcePath)Python\executor_cases.c.h;$(GeneratedPyConfigDir)pyconfig.h;$(PySourcePath)Tools\jit\**"/>
3333
<_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils.h"/>
34-
<_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\tier2_redundancy_eliminator_bytecodes.c;"/>
35-
<_CasesOutputs Include="$(PySourcePath)Python\generated_cases.c.h;$(PySourcePath)Include\opcode_ids.h;$(PySourcePath)Include\internal\pycore_uop_ids.h;$(PySourcePath)Python\opcode_targets.h;$(PySourcePath)Include\internal\pycore_opcode_metadata.h;$(PySourcePath)Include\internal\pycore_uop_metadata.h;$(PySourcePath)Python\tier2_redundancy_eliminator_cases.c.h;$(PySourcePath)Lib\_opcode_metadata.py"/>
34+
<_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\optimizer_bytecodes.c;"/>
35+
<_CasesOutputs Include="$(PySourcePath)Python\generated_cases.c.h;$(PySourcePath)Include\opcode_ids.h;$(PySourcePath)Include\internal\pycore_uop_ids.h;$(PySourcePath)Python\opcode_targets.h;$(PySourcePath)Include\internal\pycore_opcode_metadata.h;$(PySourcePath)Include\internal\pycore_uop_metadata.h;$(PySourcePath)Python\optimizer_cases.c.h;$(PySourcePath)Lib\_opcode_metadata.py"/>
3636
</ItemGroup>
3737

3838
<Target Name="_TouchRegenSources" Condition="$(ForceRegen) == 'true'">
@@ -98,7 +98,7 @@
9898
WorkingDirectory="$(PySourcePath)" />
9999
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\tier2_generator.py $(PySourcePath)Python\bytecodes.c"
100100
WorkingDirectory="$(PySourcePath)" />
101-
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\tier2_abstract_generator.py $(PySourcePath)Python\tier2_redundancy_eliminator_bytecodes.c $(PySourcePath)Python\bytecodes.c"
101+
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\optimizer_generator.py $(PySourcePath)Python\optimizer_bytecodes.c $(PySourcePath)Python\bytecodes.c"
102102
WorkingDirectory="$(PySourcePath)" />
103103
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\opcode_metadata_generator.py $(PySourcePath)Python\bytecodes.c"
104104
WorkingDirectory="$(PySourcePath)" />

Diff for: Python/optimizer_analysis.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file contains the support code for CPython's uops redundancy eliminator.
2+
* This file contains the support code for CPython's uops optimizer.
33
* It also performs some simple optimizations.
44
* It performs a traditional data-flow analysis[1] over the trace of uops.
55
* Using the information gained, it chooses to emit, or skip certain instructions
@@ -606,7 +606,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
606606

607607
/* 1 for success, 0 for not ready, cannot error at the moment. */
608608
static int
609-
uop_redundancy_eliminator(
609+
optimize_uops(
610610
PyCodeObject *co,
611611
_PyUOpInstruction *trace,
612612
int trace_len,
@@ -638,7 +638,7 @@ uop_redundancy_eliminator(
638638
_PyUOpName(opcode),
639639
oparg);
640640
switch (opcode) {
641-
#include "tier2_redundancy_eliminator_cases.c.h"
641+
#include "optimizer_cases.c.h"
642642

643643
default:
644644
DPRINTF(1, "Unknown opcode in abstract interpreter\n");
@@ -812,7 +812,7 @@ _Py_uop_analyze_and_optimize(
812812

813813
char *uop_optimize = Py_GETENV("PYTHONUOPSOPTIMIZE");
814814
if (uop_optimize != NULL && *uop_optimize > '0') {
815-
err = uop_redundancy_eliminator(
815+
err = optimize_uops(
816816
(PyCodeObject *)frame->f_executable, buffer,
817817
buffer_size, curr_stacklen, dependencies);
818818
}
File renamed without changes.

Diff for: Python/tier2_redundancy_eliminator_cases.c.h renamed to Python/optimizer_cases.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Tools/c-analyzer/cpython/_parser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ def clean_lines(text):
8383
Python/frozen_modules/*.h
8484
Python/generated_cases.c.h
8585
Python/executor_cases.c.h
86-
Python/tier2_redundancy_eliminator_cases.c.h
86+
Python/optimizer_cases.c.h
8787
8888
# not actually source
8989
Python/bytecodes.c
90-
Python/tier2_redundancy_eliminator_bytecodes.c
90+
Python/optimizer_bytecodes.c
9191
9292
# mimalloc
9393
Objects/mimalloc/*.c

Diff for: Tools/cases_generator/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ What's currently here:
1313
- `parser.py` helper for interactions with `parsing.py`
1414
- `tierN_generator.py`: a couple of driver scripts to read `Python/bytecodes.c` and
1515
write `Python/generated_cases.c.h` (and several other files)
16-
- `tier2_abstract_generator.py`: reads `Python/bytecodes.c` and
17-
`Python/tier2_redundancy_eliminator_bytecodes.c` and writes
18-
`Python/tier2_redundancy_eliminator_cases.c.h`
16+
- `optimizer_generator.py`: reads `Python/bytecodes.c` and
17+
`Python/optimizer_bytecodes.c` and writes
18+
`Python/optimizer_cases.c.h`
1919
- `stack.py`: code to handle generalized stack effects
2020
- `cwriter.py`: code which understands tokens and how to format C code;
2121
main class: `CWriter`

Diff for: Tools/cases_generator/tier2_abstract_generator.py renamed to Tools/cases_generator/optimizer_generator.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"""Generate the cases for the tier 2 redundancy eliminator/abstract interpreter.
2-
Reads the instruction definitions from bytecodes.c. and tier2_redundancy_eliminator.bytecodes.c
3-
Writes the cases to tier2_redundancy_eliminator_cases.c.h, which is #included in Python/optimizer_analysis.c.
1+
"""Generate the cases for the tier 2 optimizer.
2+
Reads the instruction definitions from bytecodes.c and optimizer_bytecodes.c
3+
Writes the cases to optimizer_cases.c.h, which is #included in Python/optimizer_analysis.c.
44
"""
55

66
import argparse
@@ -30,8 +30,8 @@
3030
from lexer import Token
3131
from stack import StackOffset, Stack, SizeMismatch, UNUSED
3232

33-
DEFAULT_OUTPUT = ROOT / "Python/tier2_redundancy_eliminator_cases.c.h"
34-
DEFAULT_ABSTRACT_INPUT = ROOT / "Python/tier2_redundancy_eliminator_bytecodes.c"
33+
DEFAULT_OUTPUT = ROOT / "Python/optimizer_cases.c.h"
34+
DEFAULT_ABSTRACT_INPUT = ROOT / "Python/optimizer_bytecodes.c"
3535

3636

3737
def validate_uop(override: Uop, uop: Uop) -> None:

0 commit comments

Comments
 (0)