From d27729f5ac3e5feb520a952accbfc38c4e5a2770 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Wed, 13 Jul 2022 16:47:50 -0700 Subject: [PATCH 01/15] Update runtime repo to use Preview 6 SDK --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index ca4e4a8e16134..9562bd518fb09 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "7.0.100-preview.5.22307.18", + "version": "7.0.100-preview.6.22352.1", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "7.0.100-preview.5.22307.18" + "dotnet": "7.0.100-preview.6.22352.1", }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22358.3", From f276db3d89adb3e6466590d293f28f224b2674de Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Wed, 13 Jul 2022 18:28:54 -0700 Subject: [PATCH 02/15] Fix json encoding --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 9562bd518fb09..02f976ba7d847 100644 --- a/global.json +++ b/global.json @@ -5,7 +5,7 @@ "rollForward": "major" }, "tools": { - "dotnet": "7.0.100-preview.6.22352.1", + "dotnet": "7.0.100-preview.6.22352.1" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22358.3", From 0c66891da945e0b9480a1067011a6a035e123a8a Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Thu, 14 Jul 2022 12:40:10 -0700 Subject: [PATCH 03/15] Use TrimMode=full instead of TrimmerDefaultAction --- src/coreclr/tools/aot/crossgen2/crossgen2.props | 2 +- src/tests/nativeaot/Directory.Build.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props index d544530d81378..9600572dcfd22 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.props +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props @@ -14,7 +14,7 @@ Debug;Release;Checked true - link + full diff --git a/src/tests/nativeaot/Directory.Build.props b/src/tests/nativeaot/Directory.Build.props index c80fd3b623f2f..fc60b308ddcb4 100644 --- a/src/tests/nativeaot/Directory.Build.props +++ b/src/tests/nativeaot/Directory.Build.props @@ -1,7 +1,7 @@ - link + full From 556bb8abf1a9cac16c022d633039909ef74b3bde Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Thu, 14 Jul 2022 14:47:55 -0700 Subject: [PATCH 04/15] Also set TrimMode=full in TrimmingTests props file --- eng/testing/linker/SupportFiles/Directory.Build.props | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/testing/linker/SupportFiles/Directory.Build.props b/eng/testing/linker/SupportFiles/Directory.Build.props index bb7beb3a3cc8c..e7637a86c2a3f 100644 --- a/eng/testing/linker/SupportFiles/Directory.Build.props +++ b/eng/testing/linker/SupportFiles/Directory.Build.props @@ -4,8 +4,7 @@ true true true - link - link + full false true true From b40a8416c27af213575314572762512b7e47f305 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Thu, 14 Jul 2022 21:43:52 -0700 Subject: [PATCH 05/15] Add TrimmerDefaultAction for NativeAOT library testing --- eng/testing/tests.singlefile.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets index f95e1957de028..703b7df4bd183 100644 --- a/eng/testing/tests.singlefile.targets +++ b/eng/testing/tests.singlefile.targets @@ -27,6 +27,8 @@ $(CoreCLRAotSdkDir) $(NetCoreAppCurrentTestHostSharedFrameworkPath) $(NoWarn);IL3050;IL3051;IL3052;IL3055;IL1005 + + copy false true From 5af1afa3c8a3ec69085b302c7b493ff656c89c37 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Thu, 14 Jul 2022 21:46:22 -0700 Subject: [PATCH 06/15] Remove usage of default trim mode --- src/coreclr/tools/aot/crossgen2/crossgen2.props | 2 -- src/tests/nativeaot/Directory.Build.props | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props index 9600572dcfd22..d76815aac9e82 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.props +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props @@ -13,8 +13,6 @@ false Debug;Release;Checked true - - full diff --git a/src/tests/nativeaot/Directory.Build.props b/src/tests/nativeaot/Directory.Build.props index fc60b308ddcb4..fe0acbf1362ff 100644 --- a/src/tests/nativeaot/Directory.Build.props +++ b/src/tests/nativeaot/Directory.Build.props @@ -1,7 +1,4 @@ - - full - From e1b012adff7da0335ded305554d02119956d61c0 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Fri, 15 Jul 2022 01:01:34 -0700 Subject: [PATCH 07/15] Replace with TrimMode partial --- eng/testing/tests.singlefile.targets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets index 703b7df4bd183..87d1066fcb04a 100644 --- a/eng/testing/tests.singlefile.targets +++ b/eng/testing/tests.singlefile.targets @@ -27,8 +27,7 @@ $(CoreCLRAotSdkDir) $(NetCoreAppCurrentTestHostSharedFrameworkPath) $(NoWarn);IL3050;IL3051;IL3052;IL3055;IL1005 - - copy + partial false true From b137f4dde743bf1f42d2e07a9fc6eb3be37a6893 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 11 Aug 2022 11:46:30 -0700 Subject: [PATCH 08/15] Update SDK to preview 7 --- eng/Versions.props | 5 ----- global.json | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index d67c8f03640f6..bc66d8a7b0098 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -20,7 +20,6 @@ false false $(AssemblyVersion) - true - 4.4.0-1.22358.14 0.2.0 7.0.100-rc.1.22402.1 diff --git a/global.json b/global.json index b3b2998cd965a..551c7f97419c3 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "7.0.100-preview.6.22352.1", + "version": "7.0.100-preview.7.22377.5", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "7.0.100-preview.6.22352.1" + "dotnet": "7.0.100-preview.7.22377.5" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22408.3", From 8774ee3670c9566b110218b2f73adbe866e1e0e0 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Sat, 13 Aug 2022 02:09:13 -0700 Subject: [PATCH 09/15] Update Roslyn to 4.4.0-2.22412.11 --- eng/Versions.props | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/Versions.props b/eng/Versions.props index c73efc5edfc9e..444d187bf7067 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -20,6 +20,7 @@ false false $(AssemblyVersion) + true + 4.4.0-2.22412.11 0.2.0 7.0.100-rc.1.22402.1 From 459a67a63946c7f03121a1da332b43f4428a290e Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sat, 13 Aug 2022 08:26:14 -0700 Subject: [PATCH 10/15] Merge in main and update pgo project --- src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs b/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs index 5f01ddfab8b43..8a7e4d2931b97 100644 --- a/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs +++ b/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs @@ -58,7 +58,7 @@ public unsafe struct LbrTraceEventData32 public Span Entries(int totalSize) { IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref this), ref Unsafe.As(ref _entries)); - return MemoryMarshal.CreateSpan(ref _entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry32)); + return MemoryMarshal.CreateSpan(ref Unsafe.AsRef(Unsafe.AsPointer(ref _entries)), (totalSize - (int)entriesOffset) / sizeof(LbrEntry32)); } } @@ -74,7 +74,7 @@ public unsafe struct LbrTraceEventData64 public Span Entries(int totalSize) { IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref this), ref Unsafe.As(ref _entries)); - return MemoryMarshal.CreateSpan(ref _entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry64)); + return MemoryMarshal.CreateSpan(ref Unsafe.AsRef(Unsafe.AsPointer(ref _entries)), (totalSize - (int)entriesOffset) / sizeof(LbrEntry64)); } } } From 79ff97d4f38966c61aa35dc7c73fc3cefcd337f8 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sat, 13 Aug 2022 09:33:52 -0700 Subject: [PATCH 11/15] Add ByRefFields feature flag. --- .../aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs index 886f7aa791fd6..2850c56a10f3c 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs @@ -133,6 +133,7 @@ public sealed class IsByRefLikeAttribute : Attribute public static class RuntimeFeature { + public const string ByRefFields = nameof(ByRefFields); public const string VirtualStaticsInInterfaces = nameof(VirtualStaticsInInterfaces); } } From 99af1bd1810215f8924243e1d864ab3b56ad11f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Mon, 15 Aug 2022 12:05:13 +0900 Subject: [PATCH 12/15] Inline deleted ILLink.targets logic --- eng/testing/tests.singlefile.targets | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets index 45dd366f5add3..1149c35511ca9 100644 --- a/eng/testing/tests.singlefile.targets +++ b/eng/testing/tests.singlefile.targets @@ -33,6 +33,41 @@ true + + + + $(NoWarn);IL2026;IL2116 + + $(NoWarn);IL2041;IL2042;IL2043;IL2056 + + $(NoWarn);IL2045 + + $(NoWarn);IL2046 + + $(NoWarn);IL2050 + + $(NoWarn);IL2032;IL2055;IL2057;IL2058;IL2059;IL2060;IL2061;IL2096 + + $(NoWarn);IL2062;IL2063;IL2064;IL2065;IL2066 + + $(NoWarn);IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091 + + $(NoWarn);IL2092;IL2093;IL2094;IL2095 + + $(NoWarn);IL2097;IL2098;IL2099;IL2106 + + $(NoWarn);IL2103 + + $(NoWarn);IL2107;IL2117 + + $(NoWarn);IL2109 + + $(NoWarn);IL2110;IL2111;IL2114;IL2115 + + $(NoWarn);IL2112;IL2113 + + $(NoWarn);IL2118;IL2119;IL2120 + From 6fa5900110fd1e53da8e0aa3e8c1f8bb0866a6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Mon, 15 Aug 2022 12:06:24 +0900 Subject: [PATCH 13/15] Cleanups --- eng/testing/linker/SupportFiles/Directory.Build.props | 1 - src/tests/nativeaot/Directory.Build.props | 4 ---- 2 files changed, 5 deletions(-) delete mode 100644 src/tests/nativeaot/Directory.Build.props diff --git a/eng/testing/linker/SupportFiles/Directory.Build.props b/eng/testing/linker/SupportFiles/Directory.Build.props index fb3ac60132c32..da3533e49c939 100644 --- a/eng/testing/linker/SupportFiles/Directory.Build.props +++ b/eng/testing/linker/SupportFiles/Directory.Build.props @@ -3,7 +3,6 @@ true true true - true full false true diff --git a/src/tests/nativeaot/Directory.Build.props b/src/tests/nativeaot/Directory.Build.props deleted file mode 100644 index fe0acbf1362ff..0000000000000 --- a/src/tests/nativeaot/Directory.Build.props +++ /dev/null @@ -1,4 +0,0 @@ - - - - From cedada94e0e8c4578447fe85e82f293d15e99b87 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Mon, 15 Aug 2022 11:32:03 +0200 Subject: [PATCH 14/15] Ensure no GC hole for LbrTraceEventData There was no GC hole here in practice since the users have unmanaged pointers. However, the better fix is to just mark it as UnscopedRef. --- src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs b/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs index 8a7e4d2931b97..a10ce4b6eb1aa 100644 --- a/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs +++ b/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -55,10 +56,11 @@ public unsafe struct LbrTraceEventData32 public LbrOptionFlags Options; private LbrEntry32 _entries; + [UnscopedRef] public Span Entries(int totalSize) { IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref this), ref Unsafe.As(ref _entries)); - return MemoryMarshal.CreateSpan(ref Unsafe.AsRef(Unsafe.AsPointer(ref _entries)), (totalSize - (int)entriesOffset) / sizeof(LbrEntry32)); + return MemoryMarshal.CreateSpan(ref _entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry32)); } } @@ -71,10 +73,11 @@ public unsafe struct LbrTraceEventData64 public LbrOptionFlags Options; private LbrEntry64 _entries; + [UnscopedRef] public Span Entries(int totalSize) { IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref this), ref Unsafe.As(ref _entries)); - return MemoryMarshal.CreateSpan(ref Unsafe.AsRef(Unsafe.AsPointer(ref _entries)), (totalSize - (int)entriesOffset) / sizeof(LbrEntry64)); + return MemoryMarshal.CreateSpan(ref _entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry64)); } } } From 17a4e22734b6bfe1450b228682b89d22d7fb174f Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Mon, 15 Aug 2022 12:28:31 +0200 Subject: [PATCH 15/15] Use static workaround since UnscopedRef is not yet available --- src/coreclr/tools/dotnet-pgo/Program.cs | 4 ++-- src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/coreclr/tools/dotnet-pgo/Program.cs b/src/coreclr/tools/dotnet-pgo/Program.cs index 02cde991728a9..53f61f05fb672 100644 --- a/src/coreclr/tools/dotnet-pgo/Program.cs +++ b/src/coreclr/tools/dotnet-pgo/Program.cs @@ -1626,7 +1626,7 @@ void AddToInstrumentationData(int eventClrInstanceId, long methodID, int methodF if (data->ProcessId != p.ProcessID) continue; - Span lbr32 = data->Entries(e.EventDataLength); + Span lbr32 = LbrTraceEventData32.Entries(ref *data, e.EventDataLength); correlator.AttributeSampleToLbrRuns(lbr32); } else @@ -1640,7 +1640,7 @@ void AddToInstrumentationData(int eventClrInstanceId, long methodID, int methodF if (data->ProcessId != p.ProcessID) continue; - Span lbr64 = data->Entries(e.EventDataLength); + Span lbr64 = LbrTraceEventData64.Entries(ref *data, e.EventDataLength); correlator.AttributeSampleToLbrRuns(lbr64); } } diff --git a/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs b/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs index a10ce4b6eb1aa..d87b8e837766a 100644 --- a/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs +++ b/src/coreclr/tools/dotnet-pgo/SPGO/LbrEntry.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -56,11 +55,10 @@ public unsafe struct LbrTraceEventData32 public LbrOptionFlags Options; private LbrEntry32 _entries; - [UnscopedRef] - public Span Entries(int totalSize) + public static Span Entries(ref LbrTraceEventData32 data, int totalSize) { - IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref this), ref Unsafe.As(ref _entries)); - return MemoryMarshal.CreateSpan(ref _entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry32)); + IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref data), ref Unsafe.As(ref data._entries)); + return MemoryMarshal.CreateSpan(ref data._entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry32)); } } @@ -73,11 +71,10 @@ public unsafe struct LbrTraceEventData64 public LbrOptionFlags Options; private LbrEntry64 _entries; - [UnscopedRef] - public Span Entries(int totalSize) + public static Span Entries(ref LbrTraceEventData64 data, int totalSize) { - IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref this), ref Unsafe.As(ref _entries)); - return MemoryMarshal.CreateSpan(ref _entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry64)); + IntPtr entriesOffset = Unsafe.ByteOffset(ref Unsafe.As(ref data), ref Unsafe.As(ref data._entries)); + return MemoryMarshal.CreateSpan(ref data._entries, (totalSize - (int)entriesOffset) / sizeof(LbrEntry64)); } } }