Huo Yaoyuan [Fri, 3 Mar 2023 23:00:07 +0000 (07:00 +0800)]
Implement managed SegmentCommandLine (#82883)
* Implement managed version of SegmentCommandLine
* Remove P/Invoke for CommandLineToArgv
* Update parsing to latest UCRT
* Add test and fix trailing space in command
* Fix test cases
Ankit Jain [Fri, 3 Mar 2023 22:27:59 +0000 (17:27 -0500)]
[wasm] Debugger tests - fix build (#82958)
* [wasm] Debugger tests - fix build
`/workspaces/runtime/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs(135,44): error CS8601: Possible null reference assignment`
Started being hit with https://github.com/dotnet/runtime/pull/82479 .
The other instances of this were fixed in
https://github.com/dotnet/runtime/pull/82803 .
* CI: Trigger all the wasm jobs, when roslyn is updated
And this includes the debugger tests
Andy Ayers [Fri, 3 Mar 2023 21:56:52 +0000 (13:56 -0800)]
JIT: fix fgDfsReversePostorder (#82950)
This method was not doing a proper depth first search, so the reverse postorder
it created was flawed.
Jan Kotas [Fri, 3 Mar 2023 21:49:41 +0000 (13:49 -0800)]
Fix patterns that defeat resource string optimizations in CoreLib (#82947)
Replace the resource string keys with enums
Fixes #82759
Elinor Fung [Fri, 3 Mar 2023 21:28:54 +0000 (13:28 -0800)]
Fix trim warning in ComponentActivator (#82952)
* Fix trim warning in ComponentActivator
* Add UnsupportedOSPlatform attributes
Katelyn Gadd [Fri, 3 Mar 2023 21:14:09 +0000 (13:14 -0800)]
[wasm] Fix min/max in the jiterpreter (#82955)
The math intrinsics table had a typo
Tomas Weinfurt [Fri, 3 Mar 2023 21:00:24 +0000 (13:00 -0800)]
use PlatformSpecific attribute to supress platform specific Quic tests (#82933)
* use PlatformSpecific attribute to supress platform specific Quic tests
* Update src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicPlatformDetectionTests.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
---------
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Tomas Weinfurt [Fri, 3 Mar 2023 20:13:53 +0000 (12:13 -0800)]
add RID for Ubuntu 23.04 (#82284)
* add RID for Ubuntu 23.04
* fix resolve
Pavel Savara [Fri, 3 Mar 2023 19:24:37 +0000 (20:24 +0100)]
[browser] legacy JS interop optional via WasmEnableLegacyJsInterop - native part (#82834)
dotnet-maestro[bot] [Fri, 3 Mar 2023 19:17:23 +0000 (13:17 -0600)]
[main] Update dependencies from dotnet/roslyn (#82479)
* Update dependencies from https://github.com/dotnet/roslyn build
20230221.6
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-2.23120.1 -> To Version 4.6.0-2.23121.6
* Update dependencies from https://github.com/dotnet/roslyn build
20230222.3
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-2.23122.3
* Update dependencies from https://github.com/dotnet/roslyn build
20230223.15
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-2.23123.15
* Update dependencies from https://github.com/dotnet/roslyn build
20230225.1
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-2.23125.1
* Update dependencies from https://github.com/dotnet/roslyn build
20230226.1
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-2.23126.1
* Update dependencies from https://github.com/dotnet/roslyn build
20230226.2
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-2.23126.2
* Update dependencies from https://github.com/dotnet/roslyn build
20230228.2
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-2.23128.2
* Update dependencies from https://github.com/dotnet/roslyn build
20230301.1
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-2.23151.1
* Update dependencies from https://github.com/dotnet/roslyn build
20230302.1
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-3.23152.1
* Update dependencies from https://github.com/dotnet/roslyn build
20230303.1
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-1.23073.4 -> To Version 4.6.0-3.23153.1
---------
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Katelyn Gadd [Fri, 3 Mar 2023 16:59:02 +0000 (08:59 -0800)]
[wasm] Implement more jiterpreter opcodes (#82940)
* Implement a bunch of missing math opcodes like exp, log and pow
* Implement STELEM_VT
dotnet-maestro[bot] [Fri, 3 Mar 2023 16:44:57 +0000 (17:44 +0100)]
[main] Update dependencies from 9 repositories (#82600)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Huo Yaoyuan [Fri, 3 Mar 2023 16:27:00 +0000 (00:27 +0800)]
Guard more COM interop related code (#82882)
Jared Parsons [Fri, 3 Mar 2023 16:01:43 +0000 (08:01 -0800)]
Nullable annotation fixes (#82803)
* Nullable annotation fixes
Once runtime merges to a Roslyn toolset that has the fix for [issue
50782](https://github.com/dotnet/roslyn/issues/50782) these annotations
will be necessary. Front loading the work here with this change.
* Apply suggestions from code review
Co-authored-by: Stephen Toub <stoub@microsoft.com>
---------
Co-authored-by: Stephen Toub <stoub@microsoft.com>
dotnet-maestro[bot] [Fri, 3 Mar 2023 15:57:34 +0000 (16:57 +0100)]
[main] Update dependencies from dotnet/arcade (#82764)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Jan Vorlicek [Fri, 3 Mar 2023 15:40:52 +0000 (16:40 +0100)]
Remove cached RW mapping when the corresponding RX one is released (#82841)
When a RX mapping in the ExecutableAllocation is released and there is a
RW mapping cached for it, it incorrectly stays in the cache. So when the
same virtual address range that was just released gets reserved again
and a request to get RW mapping comes in, the cached RW mapping is used.
But it is likely that the new RX mapping has a different offset in the
underlying file mapping and thus the RW mapping is unrelated to the new
RX mapping. Using this RW mapping results either in an overwrite of a
different block of memory or just a silent dropping of what's written.
This was discovered when investigating a GC reliability framework crash.
It turned out it was also the culprit behind the #75244 issue that I
was unable to reproduce and it kept occuring in the CI on x86 only for
quite some time.
In addition to the fix, I've found that there was an off by one
condition in the ExecutableAllocator::FindRWBlock so I've fixed that.
And I've also noticed that in UnlockedLoaderHeap::UnlockedReservePages,
if the allocation of LoaderHeapBlock failed, we would leave the data
block incorrectly on the m_pRangeList. I've fixed that too.
Close #75244
Adeel Mujahid [Fri, 3 Mar 2023 15:17:52 +0000 (17:17 +0200)]
Fix typo in SingleEntry.targets property (#82935)
Kevin Jones [Fri, 3 Mar 2023 14:54:13 +0000 (09:54 -0500)]
Support raw ECDH key agreements
Pavel Savara [Fri, 3 Mar 2023 13:18:24 +0000 (14:18 +0100)]
[browser] Calculate hash for runtime assets (#82891)
* hash assets and IL check
* @thaystg feedback about webcil hash
* @radical feedback
David Mason [Fri, 3 Mar 2023 12:05:09 +0000 (04:05 -0800)]
Issue correct Enable/Disable commands for EventSources with EventPipe (#81867)
Stephen Toub [Fri, 3 Mar 2023 11:43:56 +0000 (06:43 -0500)]
Allow default AsyncFlowControls rather than throwing (#82912)
ExecutionContext.SuppressFlow currently throws an exception if flow is already suppressed. This makes it complicated to use, as you need to check whether IsFlowSuppressed first and take two different paths based on the result. If we instead just allow SuppressFlow to return a default AsyncFlowControl rather than throwing, and have AsyncFlowControl's Undo nop rather than throw if it doesn't contain a Thread, we can again make it simple to just always use SuppressFlow without any of the other complications.
Fan Yang [Fri, 3 Mar 2023 09:55:38 +0000 (04:55 -0500)]
[Mono] Enable runtime tests running on arm64 with mini JIT (#82814)
* Enable runtime tests running on arm64 with mini JIT
* Disable failed tests
* Add tracking issue link
* Disable one more failing test
Katelyn Gadd [Fri, 3 Mar 2023 09:40:06 +0000 (01:40 -0800)]
[jiterp] Perform a single unsigned bounds check for ldelema1 (#82919)
Array and Span both have a uint32_t length field (at least as far as wasm is concerned). If index is signed and we do an unsigned index <= length then any negative index will be treated as a massive value. For arrays it appears to be safe to exploit this and not do the >= 0 check, and interp.c doesn't do it.
Maoni Stephens [Fri, 3 Mar 2023 08:38:01 +0000 (00:38 -0800)]
Fixing a bug that causes us to mistakenly demote a gen2 region to gen0 (#82413)
We are seeing a gen0 region that's almost fully occupied (< 24 bytes free) with one giant plug (ie, no free objects at all in the region). This causes allocate_in_condemned_generations to go into an infinite loop because in ephemeral generations we expect short plugs, ie, we should be able to allocate a min free object in front of each plug. And normally we can because when we allocate objects in gen0 we make sure to break up the allocation contexts with min free objects and when we compact into gen1 we form short plugs.
We are in this situation when all of the following conditions are true -
+ we did a gen2 compacting GC that generates a pinned plug in a gen2 region almost as big as the whole region. my guess for the reason why there's this giant pinned plug is because that gen2 region was already really compact so when we called allocate_in_condemned_generations on the non pinned plugs that are next to some pinned plugs in it we discovered we can't move the non pinned plugs anyway so we artificially pinned them and formed a giant pinned plug. and during this GC those objects were no longer pinned so we have one giant non pinned plug.
+ this gen2 region needs to be the last region with pinned plugs;
+ this gen2 region hasn't been consumed by allocate_in_condemned_generations yet so it was processed by process_remaining_regions;
Then in process_remaining_regions we'll set the plan_gen_num for that gen2 region to 0 because we are doing
set_region_plan_gen_num_sip (current_region, current_plan_gen_num);
and next time we do a GC, this plug is no longer pinned (and still survived) so we call allocate_in_condemned_generations on it which causes the infinite loop.
instead of going through the demotion logic to decide whether we should demote this region or not.
Michal Strehovský [Fri, 3 Mar 2023 04:19:26 +0000 (13:19 +0900)]
Implement interfaces in the non-generic enumerator base (#82923)
* Implement IDisposable in the non-generic enumerator base
...so that the interface implementation details go to the non-generic dispatch map.
Saves 1.5 kB on BasicMinimalApi.
* f
Stephen Toub [Fri, 3 Mar 2023 04:15:36 +0000 (23:15 -0500)]
Fix a few async void tests to be async Task (#82914)
Adeel Mujahid [Fri, 3 Mar 2023 03:36:19 +0000 (05:36 +0200)]
Revert "Enable symbol stripping for crossgen2 (#82698)" (#82881)
This reverts commit
6a218ab799e56d4ebaffda550de06a9a73a88b14.
Stephen Toub [Fri, 3 Mar 2023 02:46:31 +0000 (21:46 -0500)]
Improve DateTime.ParseExact perf for invariant culture (#82877)
* Improve DateTime parsing perf for invariant culture
Speed up the handling of ddd, dddd, MMM, and MMMM parts of a date time format string when using the invariant culture, which is very commonly used in parsing. Today, when one of these is encountered, the relevant array of comparison strings is retrieved from the DateTimeFormatInfo, and each is compared as a prefix against the current position in the input, using a linguistic ignore-case comparison. But for the invariant culture, we don't need to consult any arrays, and can do the comparison much more quickly. These parts dominate the processing of a format like that for RFC1123.
* Address PR feedback
Mitchell Hwang [Fri, 3 Mar 2023 01:35:24 +0000 (20:35 -0500)]
Substitute out geopolitical term in TimeZoneInfo (#82916)
Natalia Kondratyeva [Thu, 2 Mar 2023 23:44:54 +0000 (00:44 +0100)]
Disable SupportedWindowsPlatforms_IsSupportedIsTrue on Windows Arm64 (#82902)
Zoltan Varga [Thu, 2 Mar 2023 23:38:58 +0000 (18:38 -0500)]
[mono][aot] Emit cctor instantiations for classes referenced by gshared methods. (#82900)
Zoltan Varga [Thu, 2 Mar 2023 23:38:35 +0000 (18:38 -0500)]
[mono][aot] Emit a list of exported methods into the AOT image and load them when the image is loaded. (#82809)
If there is a runtime attach function specified, these methods can call into the runtime
before its initialized. In order for this to work, the runtime attach function needs
to load all the AOT images containing such methods, and load_aot_module () will
load and initialize these methods using the newly emitted table.
David Mason [Thu, 2 Mar 2023 23:02:42 +0000 (15:02 -0800)]
EventPipe env var to disable stack collection (#82470)
Stephen Toub [Thu, 2 Mar 2023 22:32:57 +0000 (17:32 -0500)]
Mark some internal/private structs as readonly (#82415)
* Mark some internal/private structs as readonly
* Address PR feedback
Ankit Jain [Thu, 2 Mar 2023 21:59:25 +0000 (16:59 -0500)]
[wasi] CI: Provision `wasi-sdk`, and `wasmtime` only when needed (#82454)
* [wasm] Install wasi-sdk, and wasmtime on CI only if needed
* Add generic support for staging helix payloads
For a directory specified as a helix correlation payload, the helix
tasks will attempt to write a `.payload` file to the directory. But if the
directory is not writable then we need to stage the payload in a
writable location, before passing the path to helix.
For example, if we have `wasi-sdk` installed on the system as:
`WASI_SDK_PATH=/usr/local/wasi-sdk`
.. then we can stage it by copying to
`artifacts/obj/helix-staging/wasi-sdk`, and then using that staging path
for the helix correlation payload.
This was already being done for `EMSDK`, and `WasiSdk` in two separate
targets. And now needs to be done for `wasmtime` also. Instead of having
completely separate targets for all this, add a new mechanism to specify
helix dependencies to stage.
For example:
```xml
<ItemGroup>
<HelixDependenciesToStage Condition="'$(NeedsWasmtime)' == 'true'" SourcePath="$(WasmtimeDir)" Include="$(WasmtimeDirForHelixPayload)" />
</ItemGroup>
```
.. and the payload can use specified as
```xml
<HelixCorrelationPayload Include="$(WasmtimeDirForHelixPayload)" Destination="wasmtime" Condition="'$(NeedsWasmtime)' == 'true'" />
```
* [wasm] CI: Fix path for wasi artifacts
These were getting created with all the wasi builds sharing the same
prefixes causing them to get overwritten.
Radek Doulik [Thu, 2 Mar 2023 21:55:28 +0000 (22:55 +0100)]
[wasm] Fix tests substitution conditions (#82901)
PR #82886 fixed it for user builds, we should fix it for tests as well.
Stephen Toub [Thu, 2 Mar 2023 21:19:51 +0000 (16:19 -0500)]
Add dedicated empty array enumerator for footprint reduction (#82899)
* Add dedicated empty array enumerator for footprint reduction
Its singleton can be used in places where it's less likely the consumer will otherwise be using a T[], such that it's less likely we'll need to generate code for T[].
* Address PR feedback
Tarek Mahmoud Sayed [Thu, 2 Mar 2023 21:15:32 +0000 (13:15 -0800)]
Introducing ValidateOptionsResultBuilder (#82749)
Sven Boemer [Thu, 2 Mar 2023 19:59:08 +0000 (11:59 -0800)]
Mark Microsoft.NET.ILLink as non-shipping (#82905)
This package should not be published to nuget. It is only used by xamarin, and contains the API surface for custom illink steps.
Steve Pfister [Thu, 2 Mar 2023 19:58:37 +0000 (14:58 -0500)]
[iOS][maccatalyst] Disable MacCatalyst and Simulator CI runs (#82915)
The work items for these configurations are failing at a high rate and causing numerous retries. Disabling temporarily to see if that helps queue traffic stabilize.
Stephen Toub [Thu, 2 Mar 2023 19:39:50 +0000 (14:39 -0500)]
Fix string allocation in DateTimeParse.ParseByFormat (#82861)
If a quote is encountered, the parser searches for the ending quote while also handling escaped characters. It does by adding the interim characters to a temporary ValueStringBuilder. But it then ToString's that builder to produce a temporary string that's examined. This is unnecessary: we can just examine the span from the VSB directly.
Stephen Toub [Thu, 2 Mar 2023 19:28:06 +0000 (14:28 -0500)]
Store Parallel.ForEachAsync exceptions from cancellation callbacks (#82434)
* Store Parallel.ForEachAsync exceptions from cancellation callbacks
If a cancellation callback erroneously throws an exception, make sure we store it into the list of exceptions used to complete the resulting task. In most cases, this just means we may not be returning _all_ exceptions when there are multiple. If, however, disposal of the enumerator throws an exception and a cancellation callback throws an exception and no exceptions were thrown from the loop body, without this change the task returned from ForEachAsync likely won't be marked completed.
* Update src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs
Elinor Fung [Thu, 2 Mar 2023 19:21:16 +0000 (11:21 -0800)]
Stop storing the parsed RID fallback graph (#82811)
After startup, we only need the RID fallback graph from the root framework for component dependency resolution (AssemblyDependencyResolver). This change stops storing that graph (which is decently large for portable linux) for all applications and switches to re-populating it on demand.
Removing this stored value also lines up with the plan to move to algorithmic RID selection rather than reading from the .deps.json.
Tomas Weinfurt [Thu, 2 Mar 2023 18:22:31 +0000 (10:22 -0800)]
disable tests on Server 2022 with spanish locale (#82578)
* disable tests on Server 2022 with spanish locale
* update name
Adeel Mujahid [Thu, 2 Mar 2023 17:44:02 +0000 (19:44 +0200)]
Append version to RID only with valid characters (#81497)
This is the `init-distro-rid.sh` counterpart of
31e4f404c218eae7ba999c4df5346d30f971451c.
In `amd64/archlinux` docker container, the non-portable RID auto-detection (without explicit `-p:TargetRid=arch-x64` arg or `__DistroRid=arch-x64` env var) looks like this:
Before: `__DistroRid: arch.TEMPLATE_VERSION_ID-x64`
After: `__DistroRid: arch-x64`
Steve Pfister [Thu, 2 Mar 2023 17:22:38 +0000 (12:22 -0500)]
[workloads] Upstream workload fixes from 7.0 (#82069)
Upstreamed from #75486
- The updated task now provides metadata that will allow us to split the VSDROP generation into two separate archives.
One which only contains workload packs (needed to share DROPs across VS versions to support multi-targeting) and
another that only contains the manifest installers and workload components.
- The ZIP archive names have been updated to disambiguate its contents and support automatic drop creation during
staging.
Most of the changes are in eng due to the Arcade update to obtain the latest copy of the workload build tasks. Those changes are unrelated to the workload fix, but appears to be necessary.
Co-authored-by: Jacques Eloff <joeloff@users.noreply.github.com>
Lakshan Fernando [Thu, 2 Mar 2023 17:08:32 +0000 (09:08 -0800)]
EventPipe lock implementation (#82790)
* EventPipe lock implementation
* FB
Stephen Toub [Thu, 2 Mar 2023 17:04:28 +0000 (12:04 -0500)]
Fix Icon(Stream) handling of partial reads (#82621)
Icon's ctor assumes Read on a stream will always produce as much data as was asked for, and that's not guaranteed to be the case.
Stephen Toub [Thu, 2 Mar 2023 17:02:29 +0000 (12:02 -0500)]
Fix SoundPlayer handling of partial reads on streams (#82612)
SoundPlayer assumes that a Read on a stream will return everything asked for, and that's not the case.
Ankit Jain [Thu, 2 Mar 2023 17:02:12 +0000 (12:02 -0500)]
[wasm] Avoid unnecessary relinking when publishing a blazor project for AOT (#82748)
* [wasm] Wasm.Build.Tests: Add blazor+aot run test
* cleanup
* [wasm] Wasm.Build.Tests: Use $(_IsPublishing) to avoid unncessary
.. relinking during "Build", when publishing.
`Publish` target triggers `Build` target to run. When publishing, we
don't want to run relinking step during the `Build`, as it will be run
for `Publish` anyway. Earlier there wasn't a good way to differentiate
the two cases of `build` when building, and `build` when publishing, but
now the sdk sets `$(_IsPublishing)=true`, which can be used here.
* fix blazor tests
* Wasm.Build.Tests: Add support for running published blazor projects
`dotnet run` uses the regular build output. Published blazor app, like
when using AOT, needs to be run more "manually" by starting a web server
in the publish folder. This is accomplished here by using the new
xharness command `wasm webserver`.
* Detect runtime assertions in blazor runs
* Update test to track changes
* cleanup
* Disable BlazorPublishRunTest because of https://github.com/dotnet/runtime/issues/82481
* Update test to track changes
* Update xharness dependency
Updating 'Microsoft.DotNet.XHarness.CLI': '1.0.0-prerelease.23117.1' => '1.0.0-prerelease.23151.1' (from build '
20230301.1' of 'https://github.com/dotnet/xharness')
Updating 'Microsoft.DotNet.XHarness.TestRunners.Common': '1.0.0-prerelease.23117.1' => '1.0.0-prerelease.23151.1' (from build '
20230301.1' of 'https://github.com/dotnet/xharness')
Updating 'Microsoft.DotNet.XHarness.TestRunners.Xunit': '1.0.0-prerelease.23117.1' => '1.0.0-prerelease.23151.1' (from build '
20230301.1' of 'https://github.com/dotnet/xharness')
Stephen Toub [Thu, 2 Mar 2023 17:01:06 +0000 (12:01 -0500)]
Add PeriodicTimer.Period property (#82560)
Stephen Toub [Thu, 2 Mar 2023 16:56:53 +0000 (11:56 -0500)]
Move throw out of inlined CompositeFormat helper (#82543)
Either this helper isn't getting inlined because of the throw, or it's getting inlined and increasing the size of all call sites where it is.
Stephen Toub [Thu, 2 Mar 2023 16:41:25 +0000 (11:41 -0500)]
Combine ExecutionContext/CapturedContext fields in ManualResetValueTaskSourceCore (#82181)
There's currently an _executionContext field and a _capturedContext field. Both of these are for non-fast-path. This not only means the struct is larger than is necessary for the common case, it also means when we reset the instance between operations we need to clear an extra field, and it means we have an extra branch on some paths to check both fields.
We can instead combine them into a single field. We allocate an extra tuple object if there's both an ExecutionContext and a scheduler, but this is exceedingly rare: when used as part of awaits, there will never be an ExecutionContext, so this will only happen in situations where someone is directly using the awaiter's OnCompleted (not UnsafeOnCompleted) method and there's a scheduler and ConfigureAwait(false) wasn't used. Such a situation not only is rare, it also already has additional overheads.
This also cleans up a bit about how exceptions are handled and moves more logic out of the generic type to avoid code bloat with generic instantiations.
Kasper Fabæch Brandt [Thu, 2 Mar 2023 16:32:01 +0000 (17:32 +0100)]
Glossary: Change SoS link to documentation and describe origin in description. (Was: Change source for SoS to Wayback Machine link) (#81178)
* Glossary: Change source for SoS to Wayback Machine link
The page seems to have disappeared in the currently archived version of Jason Zander's blog at https://learn.microsoft.com/en-us/archive/blogs/jasonz/ - so replace it with a Wayback Machine link to an archived version.
* Link to official documentation for SOS instead and mention origin of name in the description.
Tomas Weinfurt [Thu, 2 Mar 2023 16:31:38 +0000 (08:31 -0800)]
disable SendFileGetsCanceledByDispose also on Catalyst (#82782)
* disable SendFileGetsCanceledByDispose also on Catalyst
* Update src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
* fix build
---------
Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com>
Stephen Toub [Thu, 2 Mar 2023 16:26:01 +0000 (11:26 -0500)]
Use shared IValueTaskSource implementation in AwaitableSocketAsyncEventArgs (#82147)
The upside here is we don't need a dedicated implementation with complicated logic inside of Socket. The downside is this effectively increases the allocation for a Socket by a few fields, as the shared implementation has a few extra fields that go unused.
Meri Khamoyan [Thu, 2 Mar 2023 15:32:05 +0000 (19:32 +0400)]
Pass wasi invariant mode through env variable (#82707)
Pass wasi invariant mode through env variable
Vlad Brezae [Thu, 2 Mar 2023 14:32:21 +0000 (16:32 +0200)]
[mono][interp] Fix incorrect masking (#82890)
* [mono][interp] Fix incorrect masking
* [mono][interp] Fix warning
Kevin Jones [Thu, 2 Mar 2023 14:31:26 +0000 (09:31 -0500)]
ActiveIssue for BuildInvalidSignatureTwice on mono interpreter. (#82864)
Ilona Tomkowicz [Thu, 2 Mar 2023 14:30:30 +0000 (15:30 +0100)]
Update keywords. (#82896)
Stephen Toub [Thu, 2 Mar 2023 14:22:24 +0000 (09:22 -0500)]
Add MemoryExtensions.AsSpan(string, Index/Range) (#82794)
Miha Zupan [Thu, 2 Mar 2023 14:21:20 +0000 (15:21 +0100)]
Simplify IndexOfAnyAsciiByteValues for needles with 0 on X86 (#82866)
Tanner Gooding [Thu, 2 Mar 2023 13:45:45 +0000 (05:45 -0800)]
Have bool and string implement ISpanParsable<T> (#82836)
Radek Doulik [Thu, 2 Mar 2023 13:33:42 +0000 (14:33 +0100)]
[wasm] Fix intrinsics substitution condition (#82886)
Enable substitutions for SIMD only for AOT and not interpreter
Thays Grazia [Thu, 2 Mar 2023 13:25:52 +0000 (10:25 -0300)]
Avoid trying to get callstack[0] when it's empty like in an instrumentation pause (#82852)
Alexander Köplinger [Thu, 2 Mar 2023 11:15:04 +0000 (12:15 +0100)]
[mono] Move networking code to debugger component (#82785)
The debugger is the only component left in Mono using the networking code, move the code there so we can avoid compiling it into the main runtime and also simplify it a bit.
Pavel Savara [Thu, 2 Mar 2023 09:08:06 +0000 (10:08 +0100)]
[browser] remove unused methods (#82865)
Adeel Mujahid [Thu, 2 Mar 2023 05:50:14 +0000 (07:50 +0200)]
Enable symbol stripping for crossgen2 (#82698)
Mike McLaughlin [Thu, 2 Mar 2023 04:26:55 +0000 (20:26 -0800)]
Add OS/architecture specific CLRDEBUGINFO resource (#82863)
Issue: https://github.com/dotnet/runtime/issues/78282
Jan Kotas [Thu, 2 Mar 2023 04:00:33 +0000 (20:00 -0800)]
Unify Array enumerators between CoreCLR and NativeAOT (#82751)
* Unify Array enumerators between CoreCLR and NativeAOT
Contributes to #82732
Reduces BasicMinimalApi native AOT size on Windows x64 by 68kB
* Update AOT compiler
* Naming convention
Co-authored-by: Stephen Toub <stoub@microsoft.com>
PascalSenn [Thu, 2 Mar 2023 02:34:06 +0000 (03:34 +0100)]
Fixed name of frozen string dictionary files (#82482)
* Fixed name of frozen string dictionary types
* Add missing file renames
dotnet bot [Thu, 2 Mar 2023 02:13:48 +0000 (18:13 -0800)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2125925 (#82869)
Michal Strehovský [Thu, 2 Mar 2023 01:15:31 +0000 (10:15 +0900)]
Try skipping generation of empty method dictionaries (#82591)
Say we're compiling `Foo<__Canon>.Method` for:
```csharp
class Foo<T>
{
static void Method() => GenericMethod<List<T>>();
static void GenericMethod<T>() { }
}
```
In the method body, we're generating a call to `GenericMethod<__Canon>` with a generic dictionary that we looked up from `Foo`s dictionary. But as you can see, the dictionary is empty because `GenericMethod` doesn't do anything with it's T. RyuJIT might even inline it.
The problem is that we computed how the dictionary will look like during scanning and we're forever stuck with instruction to generate a generic dictionary for every `Foo<T>` instantiation.
This is adding an optimization - if during scanning we find out that the dictionary layout of the target method is empty, we instruct RyuJIT to generate a null generic context pointer.
Saves 1.5% on BasicMinimalApi.
Cc @dotnet/ilc-contrib
dotnet bot [Thu, 2 Mar 2023 00:24:07 +0000 (16:24 -0800)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2122151 (#81871)
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
Elinor Fung [Wed, 1 Mar 2023 22:50:04 +0000 (14:50 -0800)]
Implement load_assembly delegate for hosting API (#82797)
Katelyn Gadd [Wed, 1 Mar 2023 22:00:31 +0000 (14:00 -0800)]
[wasm] Implement more jiterpreter opcodes (#82849)
Implement the following opcodes:
* MINT_NEWSTR
* MINT_ARRAY_ELEMENT_SIZE
* MINT_DIV_I8
* MINT_REM_I8
Jakob Botsch Nielsen [Wed, 1 Mar 2023 21:04:39 +0000 (22:04 +0100)]
JIT: Unify arm64 and x64 GT_SELECT handling (#82610)
This unifies GT_SELECT/GT_SELECTCC handling between arm64 and x64. The
arm64 backend no longer uses containment for compare chains; instead,
there is a new GT_CCMP node that both produces and consumes flags, and
lowering can lower GT_AND(op, relop) down to this node.
Koundinya Veluri [Wed, 1 Mar 2023 17:53:50 +0000 (09:53 -0800)]
Check for pending IO in the portable thread pool's worker threads (#82245)
* Check for pending IO in the portable thread pool's worker threads
- When Resource Monitor is attached, some async IO operations are bound to the thread that issued it even though the IO handle is bound to an IOCP. If the thread exits, the async IO operation is aborted. This can lead to hangs or unexpected exceptions.
- Added a check that was missing in the portable thread pool implementation to prevent exiting a worker thread when it has pending IO
Fixes https://github.com/dotnet/runtime/issues/82207
Radek Doulik [Wed, 1 Mar 2023 17:31:15 +0000 (18:31 +0100)]
[wasm] Enable SIMD (#80797)
* [wasm] Enable SIMD
* Let old V8 use simd
Co-authored-by: Ankit Jain <radical@gmail.com>
* [wasm] ManagedToNativeGenerator: Skip unmanaged dlls
.. instead crashing with an exception like:
```
src/mono/wasm/build/WasmApp.Native.targets(296,5): error MSB4018: (NETCORE_ENGINEERING_TELEMETRY=Build) The "ManagedToNativeGenerator" task failed unexpectedly.
System.BadImageFormatException: This PE image is not a managed executable.
at System.Reflection.MetadataLoadContext.LoadFromStreamCore(Stream peStream)
at System.Reflection.MetadataLoadContext.LoadFromAssemblyPath(String assemblyPath)
at PInvokeTableGenerator.Generate(String[] pinvokeModules, String[] assemblies, String outputPath) in /_/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 42
at ManagedToNativeGenerator.ExecuteInternal() in /_/src/tasks/WasmAppBuilder/ManagedToNativeGenerator.cs:line 68
at ManagedToNativeGenerator.Execute() in /_/src/tasks/WasmAppBuilder/ManagedToNativeGenerator.cs:line 53
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
```
The wasm targets currently are not able to differentiate the managed
assemblies from the unmanaged ones. so it needs to be handled here.
* [wasm] WasmApp.Native.targets: do not trigger relinking when WasmEnableSIMD=true
Instead, let the property be effective only for the AOT case.
* Use staging image with newer v8
* [wasm] WasmAppHost: Add support for host arguments
* [wasm] console template: Add --experimental-wasm-simd to node, and remove v8 config as that isn't supported
* [wasm] Pass --experiment-wasm-simd for aot library tests too
* Try to pass full path to v8
Also remove --experimental-wasm-simd option, which shouldn't be needed
for newer v8
* Use docker image for all wasm helix jobs
As we need newer v8
* Set DOTNET_CLI_HOME under workitem payload
The correlation payload is read only
* Revert "Try to pass full path to v8"
This reverts commit
a15b3ef5dcab31b0abe2bc914eee6299df7cf56f.
* Use DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
Let see whether it will avoid all the writes to correlation payload
path
* Set NeedsEMSDKNode to false
To try if we can use newer node in path
* Revert "Set DOTNET_CLI_HOME under workitem payload"
This reverts commit
5dec1aaab403f4cbbd7b0e9f03d965e96efde51c.
* Set DOTNET_CLI_HOME under workitem payload
The correlation payload is read only. And even with
`export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1` we have still many
failures.
* Reverse the test here as we don't relink anymore
* Set _ExtraTrimmerArgs for tests
So that linker substitution files are used
* Put the SIMD/trim related props in separate group
More changes from Ankit
* Add dynamic dependency
* Disable Vector128IsHardwareAcceleratedTest
Til we have the interpreter support in place
* Disable GenericVectorTests.IsHardwareAcceleratedTest
Til we have the interpreter support in place
* Disable check_no_intrinsic_cattr in emit_vector_2_3_4
And add note about opened issue
* [mono] Disable few quaternion intrinsics
For * and / operators as these are not the same as vector operations.
Opened https://github.com/dotnet/runtime/issues/82408 to implement
correct ones in future.
* Change comparison order
* Use stable images
* WBT: Add --engine-arg=--experimental-wasm-simd for node, and v8
* Do not skip dotnet 1st time experience anymore
---------
Co-authored-by: Ankit Jain <radical@gmail.com>
Aleksey Kliger (λgeek) [Wed, 1 Mar 2023 16:03:52 +0000 (11:03 -0500)]
[wasm] Add an internal GC lock API (#82646)
The goal is to provide an API that can be called from JS to block a background GC from moving objects that may be accessed unsafely from JS. Blazor does this during rendering - it traverses a set of rendering objects from JS in order to apply changes to the DOM.
Important notes for consumers of this API:
1. While the runtime GC lock is locked, calling any C# function or doing anything that may trigger managed allocation will block the runtime.
2. In a threaded build, only the main browser thread is allowed to call the `mono_wasm_gc_lock` function
3. The runtime lock is not recursive
4. Background threads initially continue running, so the managed object graph may change even while the GC lock is held (although objects may not move). Background threads could mutate valuetype fields of reachable objects, even while the GC lock is held. However background threads will block as soon as they try to do any allocation.
5. The main browser thread may assume that managed heap objects will not move while the lock is held.
The corresponding aspnetcore API is https://github.com/dotnet/aspnetcore/pull/46909
* add wasm entrypoints to lock the GC from JS
* move gc lock api to INTERNAL object
* enter GC Unsafe before manipulating the locks
This is an exported API, so we're normally in GC Safe mode on entry
Tomas Weinfurt [Wed, 1 Mar 2023 15:59:38 +0000 (07:59 -0800)]
update msquic (#81742)
* update msquic
* Update src/libraries/System.Net.Quic/src/System.Net.Quic.csproj
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
---------
Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
Pavel Savara [Wed, 1 Mar 2023 15:09:21 +0000 (16:09 +0100)]
[wasi+browser] bundle timezones into .wasm (#82250)
Co-authored-by: Ankit Jain <radical@gmail.com>
Pavel Savara [Wed, 1 Mar 2023 14:43:12 +0000 (15:43 +0100)]
[API] OperatingSystem.IsWasi() (#82817)
implement approved API https://github.com/dotnet/runtime/issues/78389
Marie Píchová [Wed, 1 Mar 2023 13:31:36 +0000 (14:31 +0100)]
Fix test throwing from send (#82787)
Marie Píchová [Wed, 1 Mar 2023 13:30:01 +0000 (14:30 +0100)]
[QUIC] Disable failing test on arm machines (#82780)
* Disable failing test on arm machines
* Feedback
Ilona Tomkowicz [Wed, 1 Mar 2023 12:57:24 +0000 (13:57 +0100)]
[browser][icu][libraries] Load full ICU in library tests only when it's necessary (#82619)
* Moved the flag to libs that really need it.
* Remaining libs.
* Property should not be set in ItemsGroup.
* Previos approach did not work, revert and try new one.
* Only placing it here does not trim the assigned value.
* Add comment to the workaround.
Steve [Wed, 1 Mar 2023 12:29:50 +0000 (21:29 +0900)]
Fix build failure in pal_ssl (#82816)
Alexander Köplinger [Wed, 1 Mar 2023 12:13:30 +0000 (13:13 +0100)]
Add more type-forwarders for Xamarin.Android compatibility to mscorlib.dll (#82618)
The legacy Xamarin.Android version of mscorlib.dll differed a bit compared to the .NET Framework mscorlib.dll, mostly because of additions for .NET Standard 2.1 support.
This meant that an assembly which was compiled against that mscorlib expects types there but since we didn't have type-forwarders in our mscorlib.dll shim to point them to the right assembly you'd get a TypeLoadException when running on modern .NET 6 Android.
Fixes https://github.com/dotnet/runtime/issues/82193
Ulrich Weigand [Wed, 1 Mar 2023 11:57:24 +0000 (12:57 +0100)]
[mono] Raise soft RLIMIT_NOFILE on Linux (#82429)
Replace darwin_change_default_file_handles by a new routine increase_descriptor_limit, which mirrors the logic in the CoreCLR INIT_IncreaseDescriptorLimit routine.
Fixes https://github.com/dotnet/runtime/issues/82428.
Pavel Savara [Wed, 1 Mar 2023 11:13:23 +0000 (12:13 +0100)]
[browser] delete unused mono_wasm_* functions (#82767)
* delete unused mono_wasm_get_icudt_name
* remove unused mono_wasm_array_length
* remove unused GlobalizationNative_GetICUDTName
Jakob Botsch Nielsen [Wed, 1 Mar 2023 08:53:57 +0000 (09:53 +0100)]
JIT: Enable interlocked profiling for basic block counts too (#82775)
Maoni Stephens [Wed, 1 Mar 2023 01:48:25 +0000 (17:48 -0800)]
Annotation changes only (part 3) (#82697)
* Annotation changes only (part 3)
+ moved the fields to be at the end of the gc_heap class arranged by their categories - instance fields before static fields. this also makes the gc_heap way easier to read in the debugger (so we don't see static fields mixed with instance fields). I also added in the comment the convention of how I organized each category.
+ made members that should be private actually private - most methods/fields on the gc_heap are private now
+ changed the bookkeeping fields from MAINTAINED to INIT to be more appropriate for regions
+ moved reset_mm_p into gc_heap class.
+ got rid of the frozen_object_p method - this shouldn't have been added, there's already an API on the GCHeap interface that provides this info
+ there are members that really don't need to be public but I'm trying to avoid too many kinds of changes at a time so I left them as public such as gc_started/wait_for_gc_done()/region_info enum. things like WaitLonger/stomp_write_barrier_ephemeral/reserved_memory_limit should really just be gc_heap methods
Brian Bohe [Wed, 1 Mar 2023 01:36:18 +0000 (22:36 -0300)]
Refactoring store liveness update (#80539)
* Unifying var desc and liveness update on storeLclFld/Var
* Updating varDsc home after spill and refactoring
* Adding back function comment
* Forcing inline of store update on liveness
* Fixing format
Stephen Toub [Tue, 28 Feb 2023 22:43:01 +0000 (17:43 -0500)]
Make debug-only SafeHandle _ctorStackTrace coreclr-only (#82376)
Stephen Toub [Tue, 28 Feb 2023 22:21:25 +0000 (17:21 -0500)]
Tweak IndexOfAnyValues.TryGetSingleRange (#82786)
Move the instance creation logic to its callers.
Katelyn Gadd [Tue, 28 Feb 2023 21:13:43 +0000 (13:13 -0800)]
[wasm] Implement partial backward branch support in the Jiterpreter (#82756)
Add partial backward branch support to the Jiterpreter
Disable early trace abort / trace transfer if back branches are enabled, since it impairs looping
Add back branch success rate statistic
Remove ldelem_ref write barrier
Buyaa Namnan [Tue, 28 Feb 2023 17:58:27 +0000 (09:58 -0800)]
Do not use ALC name for AssemblyName (#82754)
Jackson Schuster [Tue, 28 Feb 2023 17:32:29 +0000 (09:32 -0800)]
[ComInterfaceGenerator] Rewrite exception handler if retval is a pointer (#82740)
Andy Ayers [Tue, 28 Feb 2023 16:09:45 +0000 (08:09 -0800)]
JIT: Revise DFS RPO computation (#82752)
Give block postorder numbers their customary meaning: the block's position
in the postorder, not in the reverse postorder.
Rename "InvPostOrder" to the more customary ReversePostorder. Also, compute
preorder numbers.
Preparatory work for running DFS RPO earlier to classify edges.
Stephen Halter [Tue, 28 Feb 2023 15:00:37 +0000 (07:00 -0800)]
Preserve OCE.CancellationToken in StreamPipeReader (#82745)