Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into darc-main-9dbe0517-…
Browse files Browse the repository at this point in the history
…45a5-433c-8ef5-b5807629e7e2

# Conflicts:
#	src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs
#	src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs
#	src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTestsBase.cs
#	src/mono/wasm/Wasm.Build.Tests/TestMainJsTestBase.cs
  • Loading branch information
akoeplinger committed Dec 12, 2024
2 parents 0787ae6 + bf40019 commit 0e05150
Show file tree
Hide file tree
Showing 197 changed files with 4,298 additions and 5,315 deletions.
385 changes: 268 additions & 117 deletions docs/design/mono/diagnostics-tracing.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,17 @@
<Uri>https://github.com/dotnet/runtime-assets</Uri>
<Sha>4daef9f8f673c1d0bbec273f2bcda1ab9074ef75</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-2.24570.4">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-3.24602.26">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>94fff7ad4f11977f903f435b0d97dcf0f2183710</Sha>
<Sha>089e61c59dcb3d46fe766abc85176ef8e42e4d58</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis" Version="4.13.0-2.24570.4">
<Dependency Name="Microsoft.CodeAnalysis" Version="4.13.0-3.24602.26">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>94fff7ad4f11977f903f435b0d97dcf0f2183710</Sha>
<Sha>089e61c59dcb3d46fe766abc85176ef8e42e4d58</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.13.0-2.24570.4">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.13.0-3.24602.26">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>94fff7ad4f11977f903f435b0d97dcf0f2183710</Sha>
<Sha>089e61c59dcb3d46fe766abc85176ef8e42e4d58</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.12.0-beta1.24559.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
Expand All @@ -397,9 +397,9 @@
<Sha>5435ba7b1037f21237adc1b3845f97e9fdbc075d</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-2.24570.4">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-3.24602.26">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>94fff7ad4f11977f903f435b0d97dcf0f2183710</Sha>
<Sha>089e61c59dcb3d46fe766abc85176ef8e42e4d58</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="10.0.100-alpha.1.24610.7">
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure
they do not break the local dev experience.
-->
<MicrosoftCodeAnalysisCSharpVersion>4.13.0-2.24570.4</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisVersion>4.13.0-2.24570.4</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersToolsetVersion>4.13.0-2.24570.4</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCodeAnalysisCSharpVersion>4.13.0-3.24602.26</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisVersion>4.13.0-3.24602.26</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersToolsetVersion>4.13.0-3.24602.26</MicrosoftNetCompilersToolsetVersion>
</PropertyGroup>
<!--
For source generator support we need to target multiple versions of Roslyn in order to be able to run on older versions of Roslyn.
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/common/evaluate-default-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ parameters:
src/libraries/sendtohelix-browser.targets
src/libraries/sendtohelix-wasi.targets
src/libraries/sendtohelix-wasm.targets
src/libraries/System.Runtime.InteropServices.JavaScript/*
src/libraries/System.Runtime.InteropServices.JavaScript/src/*
src/mono/mono/**/*wasm*
src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/*
src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk/*
Expand Down
22 changes: 10 additions & 12 deletions eng/testing/scenarios/BuildWasmAppsJobsList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ Wasm.Build.NativeRebuild.Tests.NoopNativeRebuildTest
Wasm.Build.NativeRebuild.Tests.OptimizationFlagChangeTests
Wasm.Build.NativeRebuild.Tests.ReferenceNewAssemblyRebuildTest
Wasm.Build.NativeRebuild.Tests.SimpleSourceChangeRebuildTest
Wasm.Build.Tests.TestAppScenarios.InterpPgoTests
Wasm.Build.Tests.InterpPgoTests
Wasm.Build.Templates.Tests.NativeBuildTests
Wasm.Build.Tests.Blazor.AppsettingsTests
Wasm.Build.Tests.Blazor.BuildPublishTests
Wasm.Build.Tests.Blazor.SimpleRunTests
Wasm.Build.Tests.Blazor.CleanTests
Wasm.Build.Tests.Blazor.MiscTests
Wasm.Build.Tests.Blazor.MiscTests2
Wasm.Build.Tests.Blazor.MiscTests3
Wasm.Build.Tests.Blazor.DllImportTests
Wasm.Build.Tests.Blazor.NativeTests
Wasm.Build.Tests.Blazor.NoopNativeRebuildTest
Wasm.Build.Tests.Blazor.WorkloadRequiredTests
Wasm.Build.Tests.Blazor.IcuTests
Wasm.Build.Tests.Blazor.IcuShardingTests
Wasm.Build.Tests.Blazor.SignalRClientTests
Wasm.Build.Tests.BuildPublishTests
Wasm.Build.Tests.ConfigSrcTests
Wasm.Build.Tests.DllImportTests
Wasm.Build.Tests.IcuShardingTests
Wasm.Build.Tests.IcuShardingTests2
Wasm.Build.Tests.IcuTests
Expand All @@ -32,13 +30,13 @@ Wasm.Build.Tests.NonWasmTemplateBuildTests
Wasm.Build.Tests.PInvokeTableGeneratorTests
Wasm.Build.Tests.RebuildTests
Wasm.Build.Tests.SatelliteAssembliesTests
Wasm.Build.Tests.TestAppScenarios.AppSettingsTests
Wasm.Build.Tests.TestAppScenarios.DownloadThenInitTests
Wasm.Build.Tests.TestAppScenarios.LazyLoadingTests
Wasm.Build.Tests.TestAppScenarios.LibraryInitializerTests
Wasm.Build.Tests.TestAppScenarios.SatelliteLoadingTests
Wasm.Build.Tests.TestAppScenarios.ModuleConfigTests
Wasm.Build.Tests.TestAppScenarios.MemoryTests
Wasm.Build.Tests.AppSettingsTests
Wasm.Build.Tests.DownloadThenInitTests
Wasm.Build.Tests.LazyLoadingTests
Wasm.Build.Tests.LibraryInitializerTests
Wasm.Build.Tests.SatelliteLoadingTests
Wasm.Build.Tests.ModuleConfigTests
Wasm.Build.Tests.MemoryTests
Wasm.Build.Tests.AspNetCore.SignalRClientTests
Wasm.Build.Tests.WasmBuildAppTest
Wasm.Build.Tests.WasmNativeDefaultsTests
Expand Down
40 changes: 34 additions & 6 deletions src/coreclr/scripts/superpmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ def aggregate_diff_metrics(details_file):
# Project out these fields for the saved diffs, to use for further
# processing. Saving everything into memory is costly on memory when there
# are a large number of diffs.
diffs_fields = ["Context", "Context size", "Base ActualCodeBytes", "Diff ActualCodeBytes", "Base PerfScore", "Diff PerfScore"]
diffs_fields = ["Context", "Method full name", "Context size", "Base ActualCodeBytes", "Diff ActualCodeBytes", "Base PerfScore", "Diff PerfScore"]
diffs = []

for row in read_csv(details_file):
Expand Down Expand Up @@ -2725,12 +2725,40 @@ def diff_pct(r):

display_subset("Smallest {} zero sized diffs:", smallest_zero_size_contexts)

by_diff_size_pct_examples = [diff for diff in by_diff_size_pct if abs(int(diff['Diff ActualCodeBytes']) - int(diff['Base ActualCodeBytes'])) < 50]
if len(by_diff_size_pct_examples) == 0:
by_diff_size_pct_examples = by_diff_size_pct
# Prefer to show small diffs over large percentage wise diffs; sort by this additionally.
# sorted is stable, so for multiple small diffs this will keep them in order of percentage wise improvement/regression.
def is_small_diff(row):
if abs(int(row['Diff ActualCodeBytes']) - int(row['Base ActualCodeBytes'])) < 50:
return 0

return 1

by_small_then_improvement = sorted(by_diff_size_pct, key=is_small_diff)
by_small_then_regression = sorted(reversed(by_diff_size_pct), key=is_small_diff)

def pick_examples(diffs, picked_contexts):
seen = set()
def try_add_seen(row):
len_before = len(seen)
seen.add(row["Method full name"])
return len_before < len(seen)

result = []
for row in diffs:
if row["Context"] in picked_contexts or not try_add_seen(row):
continue

result.append(row)
if len(result) >= 3:
break

return result

example_improvements = pick_examples(by_small_then_improvement, set())

example_improvement_contexts = set(row["Context"] for row in example_improvements)
example_regressions = pick_examples(by_small_then_regression, example_improvement_contexts)

example_improvements = by_diff_size_pct_examples[:3]
example_regressions = by_diff_size_pct_examples[3:][-3:]
contexts = smallest_contexts + top_improvements + top_regressions + top_improvements_pct + top_regressions_pct + smallest_zero_size_contexts + example_improvements + example_regressions
examples = example_improvements + example_regressions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public ReachabilityInstrumentationFilter(string profileDataFileName, ILProvider
int numTokens = reader.ReadInt32();

bool[] tokenStates = new bool[numTokens];
if (reader.Read(MemoryMarshal.Cast<bool, byte>(tokenStates)) != numTokens)
if (reader.Read(MemoryMarshal.Cast<bool, byte>(tokenStates.AsSpan())) != numTokens)
throw new IOException("Unexpected end of file");

_reachabilityInfo.Add(new Guid(guidBytes), tokenStates);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ public virtual async Task ReadWrite_MessagesSmallerThanReadBuffer_Success(ReadWr
}

Assert.Equal(writerBytes.Length, n);
AssertExtensions.SequenceEqual(writerBytes, readerBytes.AsSpan(0, writerBytes.Length));
AssertExtensions.SequenceEqual(writerBytes.AsSpan(), readerBytes.AsSpan(0, writerBytes.Length));

await writes;
}
Expand Down Expand Up @@ -3069,7 +3069,7 @@ public virtual async Task ZeroByteRead_PerformsZeroByteReadOnUnderlyingStreamWhe

if (FlushGuaranteesAllDataWritten)
{
AssertExtensions.SequenceEqual(data, buffer.AsSpan(0, bytesRead));
AssertExtensions.SequenceEqual(data.AsSpan(), buffer.AsSpan(0, bytesRead));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ internal static IReadOnlyList<T> DecodePrimitiveTypes(BinaryReader reader, int c
{
if (typeof(T) == typeof(short) || typeof(T) == typeof(ushort))
{
Span<short> span = MemoryMarshal.Cast<T, short>(result);
Span<short> span = MemoryMarshal.Cast<T, short>(result.AsSpan());
#if NET
BinaryPrimitives.ReverseEndianness(span, span);
#else
Expand All @@ -173,7 +173,7 @@ internal static IReadOnlyList<T> DecodePrimitiveTypes(BinaryReader reader, int c
}
else if (typeof(T) == typeof(int) || typeof(T) == typeof(uint) || typeof(T) == typeof(float))
{
Span<int> span = MemoryMarshal.Cast<T, int>(result);
Span<int> span = MemoryMarshal.Cast<T, int>(result.AsSpan());
#if NET
BinaryPrimitives.ReverseEndianness(span, span);
#else
Expand All @@ -185,7 +185,7 @@ internal static IReadOnlyList<T> DecodePrimitiveTypes(BinaryReader reader, int c
}
else if (typeof(T) == typeof(long) || typeof(T) == typeof(ulong) || typeof(T) == typeof(double))
{
Span<long> span = MemoryMarshal.Cast<T, long>(result);
Span<long> span = MemoryMarshal.Cast<T, long>(result.AsSpan());
#if NET
BinaryPrimitives.ReverseEndianness(span, span);
#else
Expand All @@ -201,7 +201,7 @@ internal static IReadOnlyList<T> DecodePrimitiveTypes(BinaryReader reader, int c
{
// See DontCastBytesToBooleans test to see what could go wrong.
bool[] booleans = (bool[])(object)result;
Span<byte> resultAsBytes = MemoryMarshal.AsBytes<T>(result);
Span<byte> resultAsBytes = MemoryMarshal.AsBytes<T>(result.AsSpan());
for (int i = 0; i < booleans.Length; i++)
{
// We don't use the bool array to get the value, as an optimizing compiler or JIT could elide this.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public NonSeekableStream(byte[] buffer) : base(buffer) { }

public static IEnumerable<object[]> GetCanReadArrayOfAnySizeArgs()
{
foreach (int size in new[] { 1, 127, 128, 512_001, 512_001 })
foreach (int size in new[] { 1, 127, 128, 20_001 })
{
yield return new object[] { size, true };
yield return new object[] { size, false };
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Linq/tests/RangeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static void Validate(IEnumerable<int> e, int[] expected)
list.CopyTo(actual, 1);
Assert.Equal(0, actual[0]);
Assert.Equal(0, actual[^1]);
AssertExtensions.SequenceEqual(expected, actual.AsSpan(1, expected.Length));
AssertExtensions.SequenceEqual(expected.AsSpan(), actual.AsSpan(1, expected.Length));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Linq/tests/RepeatTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static void Validate(IEnumerable<int> e, int[] expected)
list.CopyTo(actual, 1);
Assert.Equal(0, actual[0]);
Assert.Equal(0, actual[^1]);
AssertExtensions.SequenceEqual(expected, actual.AsSpan(1, expected.Length));
AssertExtensions.SequenceEqual(expected.AsSpan(), actual.AsSpan(1, expected.Length));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public static void Base64_AllMethodsRoundtripConsistently()
Span<byte> decodedBytes = new byte[original.Length];
int decoded = Base64Url.DecodeFromChars(encodedArray, decodedBytes);
Assert.Equal(original.Length, decoded);
AssertExtensions.SequenceEqual(original, decodedBytes);
AssertExtensions.SequenceEqual(original.AsSpan(), decodedBytes);

byte[] actualBytes = new byte[original.Length];
Assert.True(Base64Url.TryDecodeFromChars(encodedSpan, actualBytes, out int bytesWritten));
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Memory/tests/Span/SearchValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ static SearchValuesTestHelper()
s_randomLatin1Chars[i] = (char)rng.Next(0, 256);
}

rng.NextBytes(MemoryMarshal.Cast<char, byte>(s_randomChars));
rng.NextBytes(MemoryMarshal.Cast<char, byte>(s_randomChars.AsSpan()));

s_randomAsciiBytes = Encoding.ASCII.GetBytes(s_randomAsciiChars);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ public StringSearchValuesTestHelper(IndexOfAnySearchDelegate expected, SearchVal
}));
}

rng.NextBytes(MemoryMarshal.Cast<char, byte>(_randomChars));
rng.NextBytes(MemoryMarshal.Cast<char, byte>(_randomChars.AsSpan()));
}

public void StressRandomInputs(TimeSpan duration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ public void AcceptAsync_WithReceiveBuffer_Success()

Assert.Equal(acceptBufferDataSize, acceptArgs.BytesTransferred);

AssertExtensions.SequenceEqual(sendBuffer, acceptArgs.Buffer.AsSpan(0, acceptArgs.BytesTransferred));
AssertExtensions.SequenceEqual(sendBuffer.AsSpan(), acceptArgs.Buffer.AsSpan(0, acceptArgs.BytesTransferred));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static JSSignatureContext Create(

// there could be multiple method signatures with the same name, get unique signature name
uint hash = 17;
int typesHash;
unchecked
{
foreach (var param in sigContext.ElementTypeInformation)
Expand All @@ -57,8 +58,8 @@ public static JSSignatureContext Create(
foreach (char c in param.ManagedType.FullTypeName)
hash = hash * 31 + c;
}
typesHash = (int)(hash & int.MaxValue);
};
int typesHash = Math.Abs((int)hash);

var fullName = $"{method.ContainingType.ToDisplayString()}.{method.Name}";
string qualifiedName = GetFullyQualifiedMethodName(env, method);
Expand Down
Loading

0 comments on commit 0e05150

Please sign in to comment.