mirror of https://github.com/python/cpython
Rename tier 2 redundancy eliminator to optimizer (#115888)
The original name is just too much of a mouthful.
This commit is contained in:
parent
7259480957
commit
c0fdfba7ff
|
@ -95,7 +95,7 @@ Programs/test_frozenmain.h generated
|
|||
Python/Python-ast.c generated
|
||||
Python/executor_cases.c.h generated
|
||||
Python/generated_cases.c.h generated
|
||||
Python/tier2_redundancy_eliminator_cases.c.h generated
|
||||
Python/optimizer_cases.c.h generated
|
||||
Python/opcode_targets.h generated
|
||||
Python/stdlib_module_names.h generated
|
||||
Tools/peg_generator/pegen/grammar_parser.py generated
|
||||
|
|
|
@ -38,7 +38,7 @@ Python/ast_opt.c @isidentical
|
|||
Python/bytecodes.c @markshannon @gvanrossum
|
||||
Python/optimizer*.c @markshannon @gvanrossum
|
||||
Python/optimizer_analysis.c @Fidget-Spinner
|
||||
Python/tier2_redundancy_eliminator_bytecodes.c @Fidget-Spinner
|
||||
Python/optimizer_bytecodes.c @Fidget-Spinner
|
||||
Lib/test/test_patma.py @brandtbucher
|
||||
Lib/test/test_type_*.py @JelleZijlstra
|
||||
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
|
||||
|
|
|
@ -5,13 +5,13 @@ on:
|
|||
- '**jit**'
|
||||
- 'Python/bytecodes.c'
|
||||
- 'Python/optimizer*.c'
|
||||
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
|
||||
- 'Python/optimizer_bytecodes.c'
|
||||
push:
|
||||
paths:
|
||||
- '**jit**'
|
||||
- 'Python/bytecodes.c'
|
||||
- 'Python/optimizer*.c'
|
||||
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
|
||||
- 'Python/optimizer_bytecodes.c'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
|
|
|
@ -33,7 +33,7 @@ with test_tools.imports_under_tool("cases_generator"):
|
|||
import parser
|
||||
from stack import Stack
|
||||
import tier1_generator
|
||||
import tier2_abstract_generator
|
||||
import optimizer_generator
|
||||
|
||||
|
||||
def handle_stderr():
|
||||
|
@ -841,7 +841,7 @@ class TestGeneratedAbstractCases(unittest.TestCase):
|
|||
temp_input.flush()
|
||||
|
||||
with handle_stderr():
|
||||
tier2_abstract_generator.generate_tier2_abstract_from_files(
|
||||
optimizer_generator.generate_tier2_abstract_from_files(
|
||||
[self.temp_input_filename, self.temp_input2_filename],
|
||||
self.temp_output_filename
|
||||
)
|
||||
|
|
|
@ -1889,9 +1889,9 @@ regen-cases:
|
|||
-o $(srcdir)/Python/generated_cases.c.h.new $(srcdir)/Python/bytecodes.c
|
||||
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/tier2_generator.py \
|
||||
-o $(srcdir)/Python/executor_cases.c.h.new $(srcdir)/Python/bytecodes.c
|
||||
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/tier2_abstract_generator.py \
|
||||
-o $(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h.new \
|
||||
$(srcdir)/Python/tier2_redundancy_eliminator_bytecodes.c \
|
||||
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/optimizer_generator.py \
|
||||
-o $(srcdir)/Python/optimizer_cases.c.h.new \
|
||||
$(srcdir)/Python/optimizer_bytecodes.c \
|
||||
$(srcdir)/Python/bytecodes.c
|
||||
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/cases_generator/opcode_metadata_generator.py \
|
||||
-o $(srcdir)/Include/internal/pycore_opcode_metadata.h.new $(srcdir)/Python/bytecodes.c
|
||||
|
@ -1904,7 +1904,7 @@ regen-cases:
|
|||
$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_opcode_metadata.h $(srcdir)/Include/internal/pycore_opcode_metadata.h.new
|
||||
$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_uop_metadata.h $(srcdir)/Include/internal/pycore_uop_metadata.h.new
|
||||
$(UPDATE_FILE) $(srcdir)/Python/executor_cases.c.h $(srcdir)/Python/executor_cases.c.h.new
|
||||
$(UPDATE_FILE) $(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h $(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h.new
|
||||
$(UPDATE_FILE) $(srcdir)/Python/optimizer_cases.c.h $(srcdir)/Python/optimizer_cases.c.h.new
|
||||
$(UPDATE_FILE) $(srcdir)/Lib/_opcode_metadata.py $(srcdir)/Lib/_opcode_metadata.py.new
|
||||
|
||||
Python/compile.o: $(srcdir)/Include/internal/pycore_opcode_metadata.h
|
||||
|
@ -1927,7 +1927,7 @@ Python/optimizer.o: \
|
|||
Python/optimizer_analysis.o: \
|
||||
$(srcdir)/Include/internal/pycore_opcode_metadata.h \
|
||||
$(srcdir)/Include/internal/pycore_optimizer.h \
|
||||
$(srcdir)/Python/tier2_redundancy_eliminator_cases.c.h
|
||||
$(srcdir)/Python/optimizer_cases.c.h
|
||||
|
||||
Python/frozen.o: $(FROZEN_FILES_OUT)
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
<!-- Taken from _Target._compute_digest in Tools\jit\_targets.py: -->
|
||||
<_JITSources Include="$(PySourcePath)Python\executor_cases.c.h;$(GeneratedPyConfigDir)pyconfig.h;$(PySourcePath)Tools\jit\**"/>
|
||||
<_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils.h"/>
|
||||
<_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\tier2_redundancy_eliminator_bytecodes.c;"/>
|
||||
<_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"/>
|
||||
<_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\optimizer_bytecodes.c;"/>
|
||||
<_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"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="_TouchRegenSources" Condition="$(ForceRegen) == 'true'">
|
||||
|
@ -98,7 +98,7 @@
|
|||
WorkingDirectory="$(PySourcePath)" />
|
||||
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\tier2_generator.py $(PySourcePath)Python\bytecodes.c"
|
||||
WorkingDirectory="$(PySourcePath)" />
|
||||
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\tier2_abstract_generator.py $(PySourcePath)Python\tier2_redundancy_eliminator_bytecodes.c $(PySourcePath)Python\bytecodes.c"
|
||||
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\optimizer_generator.py $(PySourcePath)Python\optimizer_bytecodes.c $(PySourcePath)Python\bytecodes.c"
|
||||
WorkingDirectory="$(PySourcePath)" />
|
||||
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\opcode_metadata_generator.py $(PySourcePath)Python\bytecodes.c"
|
||||
WorkingDirectory="$(PySourcePath)" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* This file contains the support code for CPython's uops redundancy eliminator.
|
||||
* This file contains the support code for CPython's uops optimizer.
|
||||
* It also performs some simple optimizations.
|
||||
* It performs a traditional data-flow analysis[1] over the trace of uops.
|
||||
* Using the information gained, it chooses to emit, or skip certain instructions
|
||||
|
@ -606,7 +606,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
|
||||
/* 1 for success, 0 for not ready, cannot error at the moment. */
|
||||
static int
|
||||
uop_redundancy_eliminator(
|
||||
optimize_uops(
|
||||
PyCodeObject *co,
|
||||
_PyUOpInstruction *trace,
|
||||
int trace_len,
|
||||
|
@ -638,7 +638,7 @@ uop_redundancy_eliminator(
|
|||
_PyUOpName(opcode),
|
||||
oparg);
|
||||
switch (opcode) {
|
||||
#include "tier2_redundancy_eliminator_cases.c.h"
|
||||
#include "optimizer_cases.c.h"
|
||||
|
||||
default:
|
||||
DPRINTF(1, "Unknown opcode in abstract interpreter\n");
|
||||
|
@ -812,7 +812,7 @@ _Py_uop_analyze_and_optimize(
|
|||
|
||||
char *uop_optimize = Py_GETENV("PYTHONUOPSOPTIMIZE");
|
||||
if (uop_optimize != NULL && *uop_optimize > '0') {
|
||||
err = uop_redundancy_eliminator(
|
||||
err = optimize_uops(
|
||||
(PyCodeObject *)frame->f_executable, buffer,
|
||||
buffer_size, curr_stacklen, dependencies);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file is generated by Tools/cases_generator/tier2_abstract_generator.py
|
||||
// This file is generated by Tools/cases_generator/optimizer_generator.py
|
||||
// from:
|
||||
// Python/tier2_redundancy_eliminator_bytecodes.c
|
||||
// Python/optimizer_bytecodes.c
|
||||
// Do not edit!
|
||||
|
||||
case _NOP: {
|
|
@ -83,11 +83,11 @@ Python/deepfreeze/*.c
|
|||
Python/frozen_modules/*.h
|
||||
Python/generated_cases.c.h
|
||||
Python/executor_cases.c.h
|
||||
Python/tier2_redundancy_eliminator_cases.c.h
|
||||
Python/optimizer_cases.c.h
|
||||
|
||||
# not actually source
|
||||
Python/bytecodes.c
|
||||
Python/tier2_redundancy_eliminator_bytecodes.c
|
||||
Python/optimizer_bytecodes.c
|
||||
|
||||
# mimalloc
|
||||
Objects/mimalloc/*.c
|
||||
|
|
|
@ -13,9 +13,9 @@ What's currently here:
|
|||
- `parser.py` helper for interactions with `parsing.py`
|
||||
- `tierN_generator.py`: a couple of driver scripts to read `Python/bytecodes.c` and
|
||||
write `Python/generated_cases.c.h` (and several other files)
|
||||
- `tier2_abstract_generator.py`: reads `Python/bytecodes.c` and
|
||||
`Python/tier2_redundancy_eliminator_bytecodes.c` and writes
|
||||
`Python/tier2_redundancy_eliminator_cases.c.h`
|
||||
- `optimizer_generator.py`: reads `Python/bytecodes.c` and
|
||||
`Python/optimizer_bytecodes.c` and writes
|
||||
`Python/optimizer_cases.c.h`
|
||||
- `stack.py`: code to handle generalized stack effects
|
||||
- `cwriter.py`: code which understands tokens and how to format C code;
|
||||
main class: `CWriter`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Generate the cases for the tier 2 redundancy eliminator/abstract interpreter.
|
||||
Reads the instruction definitions from bytecodes.c. and tier2_redundancy_eliminator.bytecodes.c
|
||||
Writes the cases to tier2_redundancy_eliminator_cases.c.h, which is #included in Python/optimizer_analysis.c.
|
||||
"""Generate the cases for the tier 2 optimizer.
|
||||
Reads the instruction definitions from bytecodes.c and optimizer_bytecodes.c
|
||||
Writes the cases to optimizer_cases.c.h, which is #included in Python/optimizer_analysis.c.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
@ -30,8 +30,8 @@ from typing import TextIO, Iterator
|
|||
from lexer import Token
|
||||
from stack import StackOffset, Stack, SizeMismatch, UNUSED
|
||||
|
||||
DEFAULT_OUTPUT = ROOT / "Python/tier2_redundancy_eliminator_cases.c.h"
|
||||
DEFAULT_ABSTRACT_INPUT = ROOT / "Python/tier2_redundancy_eliminator_bytecodes.c"
|
||||
DEFAULT_OUTPUT = ROOT / "Python/optimizer_cases.c.h"
|
||||
DEFAULT_ABSTRACT_INPUT = ROOT / "Python/optimizer_bytecodes.c"
|
||||
|
||||
|
||||
def validate_uop(override: Uop, uop: Uop) -> None:
|
Loading…
Reference in New Issue