diff --git a/src/coreclr/jit/fgwasm.cpp b/src/coreclr/jit/fgwasm.cpp index 63feee17649d37..8bf4ca100b306d 100644 --- a/src/coreclr/jit/fgwasm.cpp +++ b/src/coreclr/jit/fgwasm.cpp @@ -821,6 +821,12 @@ class Scc headerNumber++; } + // All entry flow now passes through the try header before reaching the dispatcher. + if (tryHeader != nullptr) + { + tryHeader->setBBProfileWeight(TotalEntryWeight()); + } + // Create the dispatch switch... really there should be no default but for now we'll have one. // JITDUMP("\nDispatch header is " FMT_BB "; %u cases\n", dispatcher->bbNum, numHeaders); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_133120/Runtime_133120.cs b/src/tests/JIT/Regression/JitBlue/Runtime_133120/Runtime_133120.cs new file mode 100644 index 00000000000000..1368077db17944 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_133120/Runtime_133120.cs @@ -0,0 +1,63 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Runtime.ExceptionServices; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +public class Runtime_133120 +{ + private static readonly Dictionary> s_validators = new() + { + [0] = static _ => Task.CompletedTask, + }; + + [Fact] + public static void TestEntryPoint() + { + ValidateAsync().GetAwaiter().GetResult(); + } + + private static async Task ValidateAsync(CancellationToken cancellationToken = default) + { + List? exceptions = null; + + foreach (Func validator in s_validators.Values) + { + try + { + await validator(cancellationToken).ConfigureAwait(false); + } + catch (InvalidOperationException ex) + { + exceptions ??= new(); + exceptions.Add(ex); + } + catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) + { + throw; + } + catch (Exception ex) + { + (exceptions ??= new()).Add(ex); + break; + } + } + + if (exceptions is not null) + { + if (exceptions.Count == 1) + { + ExceptionDispatchInfo.Capture(exceptions[0]).Throw(); + } + + if (exceptions.Count > 1) + { + throw new AggregateException(exceptions); + } + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_133120/Runtime_133120.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_133120/Runtime_133120.csproj new file mode 100644 index 00000000000000..728f75516bd42a --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_133120/Runtime_133120.csproj @@ -0,0 +1,12 @@ + + + true + true + + + + + + $(CrossGen2TestExtraArguments) --codegenopt:JitSynthesizeCounts=1 + +