From: Egor Bogatov Date: Mon, 26 Jun 2023 22:42:28 +0000 (+0200) Subject: Add newguid.bat/sh to update jiteeversionguid.h (#88022) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~1381 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc70fec98fe39e63e194e7ffa30e9d1f44b4f254;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Add newguid.bat/sh to update jiteeversionguid.h (#88022) --- diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs index b28a018..1f0362e 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/Program.cs @@ -8,6 +8,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; namespace Thunkerator @@ -633,6 +634,28 @@ public: wrappedObjectName: "original_ICorJitInfo"); } + private static void GenerateNewJitEEVersion(string file) + { + if (!File.Exists(file)) + throw new FileNotFoundException(file); + + Guid newGuid = Guid.NewGuid(); + string[] hex = newGuid.ToString("X").Replace("{", "").Replace("}", "").Split(','); + + string newGuidStr = $$""" +constexpr GUID JITEEVersionIdentifier = { /* {{newGuid:D}} */ + {{hex[0]}}, + {{hex[1]}}, + {{hex[2]}}, + {{{hex[3]}}, {{hex[4]}}, {{hex[5]}}, {{hex[6]}}, {{hex[7]}}, {{hex[8]}}, {{hex[9]}}, {{hex[10]}}} + }; +"""; + string pattern = @"constexpr GUID JITEEVersionIdentifier = .*\n.*\n.*\n.*\n.*\n.*;"; + string output = Regex.Replace(File.ReadAllText(file), pattern, newGuidStr); + File.WriteAllText(file, output); + Console.WriteLine($"Updated to {newGuid}"); + } + private static void Main(string[] args) { if (args.Length == 0) @@ -640,11 +663,22 @@ public: Console.WriteLine("ThunkGenerator - Generate thunks for the jit interface and for defining the set of instruction sets supported by the runtime, JIT, and crossgen2. Call by using the gen scripts which are aware of the right set of files generated and command line args."); return; } - if (args[0] == "InstructionSetGenerator") + + if (args[0] == "NewJITEEVersion") + { + if (args.Length != 2) + { + Console.WriteLine("Incorrect number of arguments specified for NewJITEEVersion"); + return; + } + GenerateNewJitEEVersion(args[1]); + } + else if (args[0] == "InstructionSetGenerator") { if (args.Length != 7) { Console.WriteLine("Incorrect number of files specified for generation"); + return; } InstructionSetGenerator generator = new InstructionSetGenerator(); if (!generator.ParseInput(new StreamReader(args[1]))) @@ -685,6 +719,7 @@ public: if (args.Length != 8) { Console.WriteLine("Incorrect number of files specified for generation"); + return; } IEnumerable functions = ParseInput(new StreamReader(args[0])); diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat index cd59f14..a77ea5c 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat @@ -1,4 +1,5 @@ pushd %~dp0 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 +call ..\..\..\..\..\..\dotnet.cmd run -- NewJITEEVersion ..\..\..\..\inc\jiteeversionguid.h popd diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh index a582087..ddc4032 100755 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh @@ -2,3 +2,4 @@ cd "$(dirname ${BASH_SOURCE[0]})" ../../../../../../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 +../../../../../../dotnet.sh run -- NewJITEEVersion ../../../../inc/jiteeversionguid.h