From 9e7a8a1b312b159d739b19c536b1d8a2f6b3fd25 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Sun, 16 Oct 2022 02:49:12 +0200 Subject: [PATCH] Add "_generated.*" suffix to some auto-generated files (#77083) * Add _generated.h to src\coreclr\jit\ICorJitInfo_API_names.h * Add _generated.h to src\coreclr\jit\ICorJitInfo_API_wrapper.hpp * renamed src\coreclr\tools\Common\JitInterface\CorInfoBase.cs * fix ThunkGenerator (it used to insert two empty lines) * CorInfoBase_generated.cs -> CorInfoImpl_generated.cs * Drop _API_ part * Rename icorjitinfo.cpp * jitinterface.h -> _generated Co-authored-by: Jan Kotas --- docs/project/updating-jitinterface.md | 2 +- src/coreclr/jit/CMakeLists.txt | 4 ++-- ...CorJitInfo_API_names.h => ICorJitInfo_names_generated.h} | 0 ...fo_API_wrapper.hpp => ICorJitInfo_wrapper_generated.hpp} | 0 src/coreclr/jit/compiler.cpp | 6 +++--- src/coreclr/jit/compiler.h | 2 +- .../{CorInfoBase.cs => CorInfoImpl_generated.cs} | 0 .../tools/Common/JitInterface/ThunkGenerator/Program.cs | 3 +-- .../tools/Common/JitInterface/ThunkGenerator/gen.bat | 2 +- src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh | 2 +- .../aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj | 4 ++-- .../tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj | 4 ++-- src/coreclr/tools/aot/jitinterface/jitinterface.cpp | 2 +- .../{jitinterface.h => jitinterface_generated.h} | 0 src/coreclr/tools/aot/jitinterface/jitwrapper.cpp | 2 +- .../tools/superpmi/superpmi-shim-counter/CMakeLists.txt | 2 +- .../{icorjitinfo.cpp => icorjitinfo_generated.cpp} | 0 .../tools/superpmi/superpmi-shim-simple/CMakeLists.txt | 2 +- .../{icorjitinfo.cpp => icorjitinfo_generated.cpp} | 0 19 files changed, 18 insertions(+), 19 deletions(-) rename src/coreclr/jit/{ICorJitInfo_API_names.h => ICorJitInfo_names_generated.h} (100%) rename src/coreclr/jit/{ICorJitInfo_API_wrapper.hpp => ICorJitInfo_wrapper_generated.hpp} (100%) rename src/coreclr/tools/Common/JitInterface/{CorInfoBase.cs => CorInfoImpl_generated.cs} (100%) rename src/coreclr/tools/aot/jitinterface/{jitinterface.h => jitinterface_generated.h} (100%) rename src/coreclr/tools/superpmi/superpmi-shim-counter/{icorjitinfo.cpp => icorjitinfo_generated.cpp} (100%) rename src/coreclr/tools/superpmi/superpmi-shim-simple/{icorjitinfo.cpp => icorjitinfo_generated.cpp} (100%) diff --git a/docs/project/updating-jitinterface.md b/docs/project/updating-jitinterface.md index b3750e533c546..56ced8bc09429 100644 --- a/docs/project/updating-jitinterface.md +++ b/docs/project/updating-jitinterface.md @@ -12,7 +12,7 @@ There are several components that consume the JIT outside of the runtime. Since The JitInterface is versioned by a GUID. Any change to JitInterface is required to update the JitInterface GUID located in jiteeversionguid.h (look for `JITEEVersionIdentifier`). Not doing so has consequences that are sometimes hard to debug. -If a method was added or modified in ICorStaticInfo or ICorDynamicInfo, port the change to src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt. Functions must be in the same order in ThunkInput.txt as they exist in corinfo.h and corjit.h. Run gen.bat or gen.sh to regenerate CorInfoBase.cs, jitinterface.h, ICorJitInfo_API_names.h, ICorJitInfo_API_wrapper.hpp, superpmi-shared\icorjitinfoimpl.h, superpmi-shim-counter\icorjitinfo.cpp, and superpmi-shim-simple\icorjitinfo.cpp from ThunkInput.txt. Provide a managed implementation of the method in CorInfoImpl.cs. +If a method was added or modified in ICorStaticInfo or ICorDynamicInfo, port the change to src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt. Functions must be in the same order in ThunkInput.txt as they exist in corinfo.h and corjit.h. Run gen.bat or gen.sh to regenerate all \*_generated.\* files from ThunkInput.txt. Provide a managed implementation of the method in CorInfoImpl.cs. ## Porting JitInterface changes to crossgen2 diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index af8a596ab0ee9..f1f7f335415c0 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -301,8 +301,8 @@ set( JIT_HEADERS host.h hostallocator.h hwintrinsic.h - ICorJitInfo_API_names.h - ICorJitInfo_API_wrapper.hpp + ICorJitInfo_names_generated.h + ICorJitInfo_wrapper_generated.hpp inline.h inlinepolicy.h instr.h diff --git a/src/coreclr/jit/ICorJitInfo_API_names.h b/src/coreclr/jit/ICorJitInfo_names_generated.h similarity index 100% rename from src/coreclr/jit/ICorJitInfo_API_names.h rename to src/coreclr/jit/ICorJitInfo_names_generated.h diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp similarity index 100% rename from src/coreclr/jit/ICorJitInfo_API_wrapper.hpp rename to src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index ce74fbb1d9501..5af1161f9f20f 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -7140,7 +7140,7 @@ struct WrapICorJitInfo : public ICorJitInfo { // If you get a build error here due to 'WrapICorJitInfo' being // an abstract class, it's very likely that the wrapper bodies - // in ICorJitInfo_API_wrapper.hpp are no longer in sync with + // in ICorJitInfo_wrapper_generated.hpp are no longer in sync with // the EE interface; please be kind and update the header file. wrap = new (inst, jitstd::placement_t()) WrapICorJitInfo(); @@ -7160,7 +7160,7 @@ struct WrapICorJitInfo : public ICorJitInfo COMP_HANDLE wrapHnd; // the "real thing" public: -#include "ICorJitInfo_API_wrapper.hpp" +#include "ICorJitInfo_wrapper_generated.hpp" }; #endif // MEASURE_CLRAPI_CALLS @@ -8164,7 +8164,7 @@ void CompTimeSummaryInfo::Print(FILE* f) static const char* APInames[] = { #define DEF_CLR_API(name) #name, -#include "ICorJitInfo_API_names.h" +#include "ICorJitInfo_names_generated.h" }; unsigned shownCalls = 0; diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 8be9687f69bae..dc3e3c4171e79 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -1420,7 +1420,7 @@ enum class PhaseDumps enum API_ICorJitInfo_Names { #define DEF_CLR_API(name) API_##name, -#include "ICorJitInfo_API_names.h" +#include "ICorJitInfo_names_generated.h" API_COUNT }; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs similarity index 100% rename from src/coreclr/tools/Common/JitInterface/CorInfoBase.cs rename to src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs index b0d12f06cdc12..be6dbec59fb8a 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs @@ -365,8 +365,7 @@ private static IntPtr GetUnmanagedCallbacks() return (IntPtr)callbacks; } } -} -"); +}"); } static void WriteNativeWrapperInterface(TextWriter tw, IEnumerable functionData) diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat index 69e3367c4e094..cd59f146d0b8f 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat @@ -1,4 +1,4 @@ pushd %~dp0 -call ..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoBase.cs ..\..\..\aot\jitinterface\jitinterface.h ..\..\..\..\jit\ICorJitInfo_API_names.h ..\..\..\..\jit\ICorJitInfo_API_wrapper.hpp ..\..\..\..\inc\icorjitinfoimpl_generated.h ..\..\..\..\tools\superpmi\superpmi-shim-counter\icorjitinfo.cpp ..\..\..\..\tools\superpmi\superpmi-shim-simple\icorjitinfo.cpp +call ..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoImpl_generated.cs ..\..\..\aot\jitinterface\jitinterface_generated.h ..\..\..\..\jit\ICorJitInfo_names_generated.h ..\..\..\..\jit\ICorJitInfo_wrapper_generated.hpp ..\..\..\..\inc\icorjitinfoimpl_generated.h ..\..\..\..\tools\superpmi\superpmi-shim-counter\icorjitinfo_generated.cpp ..\..\..\..\tools\superpmi\superpmi-shim-simple\icorjitinfo_generated.cpp call ..\..\..\..\..\..\dotnet.cmd run -- InstructionSetGenerator InstructionSetDesc.txt ..\..\Internal\Runtime\ReadyToRunInstructionSet.cs ..\..\Internal\Runtime\ReadyToRunInstructionSetHelper.cs ..\CorInfoInstructionSet.cs ..\..\..\..\inc\corinfoinstructionset.h ..\..\..\..\inc\readytoruninstructionset.h popd diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh index ca9cdcb52ef11..a5820871fa6df 100755 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash cd "$(dirname ${BASH_SOURCE[0]})" -../../../../../../dotnet.sh run -- ThunkInput.txt ../CorInfoBase.cs ../../../aot/jitinterface/jitinterface.h ../../../../jit/ICorJitInfo_API_names.h ../../../../jit/ICorJitInfo_API_wrapper.hpp ../../../../inc/icorjitinfoimpl_generated.h ../../../../tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp ../../../../tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp +../../../../../../dotnet.sh run -- ThunkInput.txt ../CorInfoImpl_generated.cs ../../../aot/jitinterface/jitinterface_generated.h ../../../../jit/ICorJitInfo_names_generated.h ../../../../jit/ICorJitInfo_wrapper_generated.hpp ../../../../inc/icorjitinfoimpl_generated.h ../../../../tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp ../../../../tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp ../../../../../../dotnet.sh run -- InstructionSetGenerator InstructionSetDesc.txt ../../Internal/Runtime/ReadyToRunInstructionSet.cs ../../Internal/Runtime/ReadyToRunInstructionSetHelper.cs ../CorInfoInstructionSet.cs ../../../../inc/corinfoinstructionset.h ../../../../inc/readytoruninstructionset.h diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj index 4b8361f944f69..056fa74ad82b6 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj @@ -265,8 +265,8 @@ JitInterface\TypeString.cs - - JitInterface\CorInfoBase.cs + + JitInterface\CorInfoImpl_generated.cs JitInterface\CorInfoImpl.cs diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj b/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj index 921059e06a008..d63b66741ed64 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj @@ -68,8 +68,8 @@ JitInterface\TypeString.cs - - JitInterface\CorInfoBase.cs + + JitInterface\CorInfoImpl_generated.cs JitInterface\CorInfoImpl.cs diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface.cpp b/src/coreclr/tools/aot/jitinterface/jitinterface.cpp index de7efac0b6b55..bbd4f812e2eae 100644 --- a/src/coreclr/tools/aot/jitinterface/jitinterface.cpp +++ b/src/coreclr/tools/aot/jitinterface/jitinterface.cpp @@ -6,7 +6,7 @@ #include #include "dllexport.h" -#include "jitinterface.h" +#include "jitinterface_generated.h" static void NotImplemented() { diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface.h b/src/coreclr/tools/aot/jitinterface/jitinterface_generated.h similarity index 100% rename from src/coreclr/tools/aot/jitinterface/jitinterface.h rename to src/coreclr/tools/aot/jitinterface/jitinterface_generated.h diff --git a/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp b/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp index c978af57ca256..4b763aec27fbf 100644 --- a/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp +++ b/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp @@ -6,7 +6,7 @@ #include #include "dllexport.h" -#include "jitinterface.h" +#include "jitinterface_generated.h" DLL_EXPORT int JitCompileMethod( CorInfoExceptionClass **ppException, diff --git a/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt index 403841d95c8ed..576ea739566b0 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt +++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt @@ -17,7 +17,7 @@ include_directories(../superpmi-shared) set(SUPERPMI_SHIM_COUNTER_SOURCES jithost.cpp icorjitcompiler.cpp - icorjitinfo.cpp + icorjitinfo_generated.cpp methodcallsummarizer.cpp superpmi-shim-counter.cpp ../superpmi-shared/callutils.cpp diff --git a/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp similarity index 100% rename from src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo_generated.cpp diff --git a/src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt index e1c168ef9d9dd..0510ae24359b1 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt +++ b/src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt @@ -17,7 +17,7 @@ include_directories(../superpmi-shared) set(SUPERPMI_SHIM_SIMPLE_SOURCES jithost.cpp icorjitcompiler.cpp - icorjitinfo.cpp + icorjitinfo_generated.cpp superpmi-shim-simple.cpp ../superpmi-shared/callutils.cpp ../superpmi-shared/compileresult.cpp diff --git a/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp similarity index 100% rename from src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo_generated.cpp