From 9272e67cdd655075db1f600269e7431b52902af4 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 12 Jul 2023 10:13:05 +0100 Subject: [PATCH] gh-105481: move Python/opcode_metadata.h to Include/internal/pycore_opcode_metadata.h --- .gitattributes | 2 +- .../internal/pycore_opcode_metadata.h | 0 Makefile.pre.in | 12 ++++++------ Python/assemble.c | 8 ++++---- Python/ceval.c | 2 +- Python/compile.c | 2 +- Python/flowgraph.c | 2 +- Python/optimizer.c | 2 +- Tools/cases_generator/generate_cases.py | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) rename Python/opcode_metadata.h => Include/internal/pycore_opcode_metadata.h (100%) diff --git a/.gitattributes b/.gitattributes index 5e4ce963b63e5c..2616da74b48c0f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -87,7 +87,7 @@ Programs/test_frozenmain.h generated Python/Python-ast.c generated Python/executor_cases.c.h generated Python/generated_cases.c.h generated -Python/opcode_metadata.h generated +Include/internal/pycore_opcode_metadata.h generated Python/opcode_targets.h generated Python/stdlib_module_names.h generated Tools/peg_generator/pegen/grammar_parser.py generated diff --git a/Python/opcode_metadata.h b/Include/internal/pycore_opcode_metadata.h similarity index 100% rename from Python/opcode_metadata.h rename to Include/internal/pycore_opcode_metadata.h diff --git a/Makefile.pre.in b/Makefile.pre.in index 073b4bcc271ffc..a1ceedbd4812c0 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1548,30 +1548,30 @@ regen-cases: $(srcdir)/Tools/cases_generator/generate_cases.py \ --emit-line-directives \ -o $(srcdir)/Python/generated_cases.c.h.new \ - -m $(srcdir)/Python/opcode_metadata.h.new \ + -m $(srcdir)/Include/internal/pycore_opcode_metadata.h.new \ -e $(srcdir)/Python/executor_cases.c.h.new \ -p $(srcdir)/Lib/_opcode_metadata.py.new \ $(srcdir)/Python/bytecodes.c $(UPDATE_FILE) $(srcdir)/Python/generated_cases.c.h $(srcdir)/Python/generated_cases.c.h.new - $(UPDATE_FILE) $(srcdir)/Python/opcode_metadata.h $(srcdir)/Python/opcode_metadata.h.new + $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_opcode_metadata.h $(srcdir)/Include/internal/pycore_opcode_metadata.h.new $(UPDATE_FILE) $(srcdir)/Python/executor_cases.c.h $(srcdir)/Python/executor_cases.c.h.new $(UPDATE_FILE) $(srcdir)/Lib/_opcode_metadata.py $(srcdir)/Lib/_opcode_metadata.py.new -Python/compile.o: $(srcdir)/Python/opcode_metadata.h +Python/compile.o: $(srcdir)/Include/internal/pycore_opcode_metadata.h Python/ceval.o: \ $(srcdir)/Python/ceval_macros.h \ $(srcdir)/Python/condvar.h \ $(srcdir)/Python/generated_cases.c.h \ - $(srcdir)/Python/opcode_metadata.h \ + $(srcdir)/Include/internal/pycore_opcode_metadata.h \ $(srcdir)/Python/opcode_targets.h Python/flowgraph.o: \ - $(srcdir)/Python/opcode_metadata.h + $(srcdir)/Include/internal/pycore_opcode_metadata.h Python/optimizer.o: \ $(srcdir)/Python/executor_cases.c.h \ - $(srcdir)/Python/opcode_metadata.h + $(srcdir)/Include/internal/pycore_opcode_metadata.h Python/frozen.o: $(FROZEN_FILES_OUT) diff --git a/Python/assemble.c b/Python/assemble.c index ff7bca22286cd7..b7012534d6cc4e 100644 --- a/Python/assemble.c +++ b/Python/assemble.c @@ -1,11 +1,11 @@ #include #include "Python.h" -#include "pycore_code.h" // write_location_entry_start() +#include "pycore_code.h" // write_location_entry_start() #include "pycore_compile.h" -#include "pycore_opcode.h" // _PyOpcode_Caches[] and opcode category macros -#include "pycore_opcode_utils.h" // IS_BACKWARDS_JUMP_OPCODE -#include "opcode_metadata.h" // IS_PSEUDO_INSTR +#include "pycore_opcode.h" // _PyOpcode_Caches[] and opcode category macros +#include "pycore_opcode_utils.h" // IS_BACKWARDS_JUMP_OPCODE +#include "pycore_opcode_metadata.h" // IS_PSEUDO_INSTR #define DEFAULT_CODE_SIZE 128 diff --git a/Python/ceval.c b/Python/ceval.c index 63150a9456bbc8..de44085d732cfa 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -14,6 +14,7 @@ #include "pycore_object.h" // _PyObject_GC_TRACK() #include "pycore_moduleobject.h" // PyModuleObject #include "pycore_opcode.h" // EXTRA_CASES +#include "pycore_opcode_metadata.h" #include "pycore_opcode_utils.h" // MAKE_FUNCTION_* #include "pycore_pyerrors.h" // _PyErr_GetRaisedException() #include "pycore_pystate.h" // _PyInterpreterState_GET() @@ -30,7 +31,6 @@ #include "pycore_frame.h" #include "frameobject.h" // _PyInterpreterFrame_GetLine #include "opcode.h" -#include "opcode_metadata.h" #include "pydtrace.h" #include "setobject.h" #include "structmember.h" // struct PyMemberDef, T_OFFSET_EX diff --git a/Python/compile.c b/Python/compile.c index 29ea2742fad0cf..d9e38cfdefaf23 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -36,7 +36,7 @@ #include "pycore_pystate.h" // _Py_GetConfig() #include "pycore_symtable.h" // PySTEntryObject, _PyFuture_FromAST() -#include "opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed +#include "pycore_opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed #define COMP_GENEXP 0 #define COMP_LISTCOMP 1 diff --git a/Python/flowgraph.c b/Python/flowgraph.c index e159a4356dfe46..04f269c5853835 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -8,7 +8,7 @@ #include "pycore_opcode_utils.h" #define NEED_OPCODE_METADATA -#include "opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed +#include "pycore_opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed #undef NEED_OPCODE_METADATA diff --git a/Python/optimizer.c b/Python/optimizer.c index 7fc40e66057d30..c3fdee63a7ed48 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -2,7 +2,7 @@ #include "opcode.h" #include "pycore_interp.h" #include "pycore_opcode.h" -#include "opcode_metadata.h" +#include "pycore_opcode_metadata.h" #include "pycore_opcode_utils.h" #include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_uops.h" diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py index 8c77c1f08335df..a20abcde85b7c7 100644 --- a/Tools/cases_generator/generate_cases.py +++ b/Tools/cases_generator/generate_cases.py @@ -24,7 +24,7 @@ DEFAULT_INPUT = os.path.relpath(os.path.join(ROOT, "Python/bytecodes.c")) DEFAULT_OUTPUT = os.path.relpath(os.path.join(ROOT, "Python/generated_cases.c.h")) DEFAULT_METADATA_OUTPUT = os.path.relpath( - os.path.join(ROOT, "Python/opcode_metadata.h") + os.path.join(ROOT, "Include/internal/pycore_opcode_metadata.h") ) DEFAULT_PYMETADATA_OUTPUT = os.path.relpath( os.path.join(ROOT, "Lib/_opcode_metadata.py")