From a5430cd669893adebca2d62e5d8504311b052c5a Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Tue, 24 Sep 2019 13:35:58 -0700 Subject: [PATCH] Use netcoreapp3.0 for building crossgen2 (dotnet/coreclr#26792) * Use netcoreapp3.0 for building crossgen2 - Enables better debugging support - Enables use of netcoreapp3.0 surface area in crossgen2 - Should improve performance - Initialize the PAL in the jit on Unix builds - Enable crossgen2smoke on alpine Commit migrated from https://github.com/dotnet/coreclr/commit/41471dc78816edffa072582f2f826210829bf0d1 --- .../crossgen2/Common/JitInterface/CorInfoImpl.cs | 19 +++++++++++++++++++ .../ILCompiler.DependencyAnalysisFramework.csproj | 2 +- .../ILCompiler.ReadyToRun.csproj | 4 ++-- .../ILCompiler.TypeSystem.ReadyToRun.csproj | 2 +- .../src/tools/crossgen2/crossgen2/crossgen2.csproj | 4 ++-- .../src/readytorun/crossgen2/crossgen2smoke.csproj | 9 +-------- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/coreclr/src/tools/crossgen2/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/src/tools/crossgen2/Common/JitInterface/CorInfoImpl.cs index a64cf95..6b2d62d 100644 --- a/src/coreclr/src/tools/crossgen2/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/src/tools/crossgen2/Common/JitInterface/CorInfoImpl.cs @@ -55,6 +55,11 @@ namespace Internal.JitInterface private ExceptionDispatchInfo _lastException; + private static bool s_jitRegistered = RegisterJITModule(); + + [DllImport("clrjitilc")] + private extern static IntPtr PAL_RegisterModule([MarshalAs(UnmanagedType.LPUTF8Str)] string moduleName); + [DllImport("clrjitilc", CallingConvention=CallingConvention.StdCall)] // stdcall in CoreCLR! private extern static IntPtr jitStartup(IntPtr host); @@ -109,12 +114,26 @@ namespace Internal.JitInterface private readonly UnboxingMethodDescFactory _unboxingThunkFactory; + private static bool RegisterJITModule() + { + if ((Environment.OSVersion.Platform == PlatformID.Unix) || (Environment.OSVersion.Platform == PlatformID.MacOSX)) + { + return PAL_RegisterModule("libclrjitilc.so") != (IntPtr)1; + } + else + { + return true; + } + } + public CorInfoImpl(JitConfigProvider jitConfig) { // // Global initialization // _jitConfig = jitConfig; + if (!s_jitRegistered) + throw new IOException("Failed to register JIT"); jitStartup(GetJitHost(_jitConfig.UnmanagedInstance)); diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj b/src/coreclr/src/tools/crossgen2/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj index 3a0dc1e..3ac648b1 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj @@ -7,7 +7,7 @@ netstandard1.3 false x64;x86 - $(BinDir)\crossgen2 + $(BinDir)/crossgen2/libs false diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj index 28f4459..87bfdf3 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj @@ -4,12 +4,12 @@ Library ILCompiler.ReadyToRun - netstandard1.3 + netcoreapp3.0 true READYTORUN;$(DefineConstants) false x64;x86 - $(BinDir)\crossgen2 + $(BinDir)/crossgen2/libs false diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj b/src/coreclr/src/tools/crossgen2/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj index d130008..0598bb9 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj @@ -9,7 +9,7 @@ netstandard1.3 false x64;x86 - $(BinDir)\crossgen2 + $(BinDir)/crossgen2/libs false diff --git a/src/coreclr/src/tools/crossgen2/crossgen2/crossgen2.csproj b/src/coreclr/src/tools/crossgen2/crossgen2/crossgen2.csproj index 2a1fe01..e1d1e9c 100644 --- a/src/coreclr/src/tools/crossgen2/crossgen2/crossgen2.csproj +++ b/src/coreclr/src/tools/crossgen2/crossgen2/crossgen2.csproj @@ -5,10 +5,10 @@ crossgen2 true Exe - netcoreapp2.0 + netcoreapp3.0 8002,NU1701 x64;x86 - $(BinDir)\crossgen2 + $(BinDir)/crossgen2 false diff --git a/src/coreclr/tests/src/readytorun/crossgen2/crossgen2smoke.csproj b/src/coreclr/tests/src/readytorun/crossgen2/crossgen2smoke.csproj index 674eba3..d521fc1 100644 --- a/src/coreclr/tests/src/readytorun/crossgen2/crossgen2smoke.csproj +++ b/src/coreclr/tests/src/readytorun/crossgen2/crossgen2smoke.csproj @@ -27,14 +27,7 @@ $(CLRTestBatchPreCommands) ]]> -- 2.7.4