Stephen Toub [Mon, 6 Mar 2023 21:40:15 +0000 (16:40 -0500)]
Allow PeriodicTimer to have an infinite timeout (#82986)
* Allow PeriodicTimer to have an infinite timeout
When PeriodicTimer was introduced, we prohibited infinite timeouts as they made no sense: you couldn't change the period after construction, so creating a PeriodicTimer with an infinite timeout meant creating an instance that would never tick. But now that we've added a Period property with a setter that allows changing the period, infinite timeouts do make sense: as with Timer, they can be used as a mechanism to stop and start the timer, e.g. creating the PeriodicTimer with infinite and only in response to some later action updating its Period to start it.
* Update PeriodicTimer.cs
Stephen Toub [Mon, 6 Mar 2023 21:39:52 +0000 (16:39 -0500)]
Add IPAddress ISpanFormattable/Parsable implementations (#82913)
* Add IPAddress ISpanFormattable/Parsable implementations
* Address PR feedback
Tomáš Rylek [Mon, 6 Mar 2023 21:27:43 +0000 (22:27 +0100)]
Fix for GitHub issue 76673 and regression test - incorrect static virtual method resolution (#76724)
The issue tracks incorrect ordering of static virtual method lookup
methods in the CoreCLR runtime. According to the default interface
implementation ECMA 335 addendum, default interface implementation
resolution should only be used after the "old rules" failed to
resolve the method. In other words resolution on classes must go
first.
In the pre-existing implementation the for loop used to traverse
the chain of base classes was incorrectly combining
resolution on classes with default interface implementation
resolution. The fix is to walk the entire chain of base classes
first and only if that fails, attempt the default interface
implementation resolution.
Kevin Jones [Mon, 6 Mar 2023 21:06:14 +0000 (16:06 -0500)]
Use SecurityTransforms for RSA+PSS (#82728)
* Use SecurityTransforms for RSAPSS
* Code review feedback
Fan Yang [Mon, 6 Mar 2023 20:55:38 +0000 (15:55 -0500)]
[Mono] Add initial arm64 hardware intrinsics support for mini JIT (#82420)
* Initial change to make intrinsics work with mini JIT on arm64
* Fix alignment issue and add size getter functions
* Review feedback and refactor
* Fix align
* Fix issue with big offset
* Fix build warning
* Add intrinsics for get_One
* Add xconst to mdesc
* Fix MONO_PATCH_INFO_X128
* Stop the simd and fp registers sharing
* Stop v64 from emitting simd intrinsics
* Move between SIMD registers
* Adjust filter logic
* Keep the filter logic under non-llvm
* Uncomment
Kevin Jones [Mon, 6 Mar 2023 20:51:00 +0000 (15:51 -0500)]
Use output size helpers for cryptographic primitives (#82800)
Zoltan Varga [Mon, 6 Mar 2023 20:17:12 +0000 (15:17 -0500)]
[wasi] More cross compiler fixes. (#82911)
Katelyn Gadd [Mon, 6 Mar 2023 19:54:53 +0000 (11:54 -0800)]
Implement INITBLK and CPBLK in the Jiterpreter (#83033)
Jackson Schuster [Mon, 6 Mar 2023 19:46:13 +0000 (11:46 -0800)]
Share all "Compiles" tests from VTableIndexStubGenerator with ComInterfaceGenerator (#82657)
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
Andy Ayers [Mon, 6 Mar 2023 19:13:49 +0000 (11:13 -0800)]
JIT: initial implementation of profile synthesis (#82926)
Implements a profile synthesis algorithm based on the classic Wu-Larus
paper (Static branch frequency and program profile analysis, Micro-27,
1994), with a simple set of heuristics.
First step is construction of a depth-first spanning tree (DFST) for the
flowgraph, and corresponding reverse postorder (RPO). Together these drive
loop recognition; currently we only recognize reducible loops. We use DFST
(non-) ancestry as a proxy for (non-) domination: the dominator of a node
is required to be a DFST ancestor. So no explicit dominance computation is
needed. Irreducible loops are noted but ignored. Loop features like entry,
back, and exit edges, body sets, and nesting are computed and saved.
Next step is assignment of edge likelihoods. Here we use some simple local
heuristics based on loop structure, returns, and throws. A final heuristic
gives slight preference to conditional branches that fall through to the
next IL offset.
After that we use loop nesting to compute the "cyclic probability" $cp$ for
each loop, working inner to outer in loops and RPO within loops. $cp$ summarizes
the effect of flow through the loop and around loop back edges. We cap $cp$ at
no more than 1000. When finding $cp$ for outer loops we use $cp$ for inner
loops.
Once all $cp$ values are known, we assign "external" input weights to method
and EH entry points, and then a final RPO walk computes the expected weight
of each block (and, via edge likelihoods, each edge).
We use the existing DFS code to build the DFST and the RPO, augmented by
some fixes to ensure all blocks (even ones in isolated cycles) get numbered.
This initial version is intended to establish the right functionality, enable
wider correctness testing, and to provide a foundation for refinement of the
heuristics. It is not yet as efficient as it could be.
The loop recognition and recording done here overlaps with similar code
elsewhere in the JIT. The version here is structural and not sensitive to IL
patterns, so is arguably more general and I believe a good deal simpler than
the lexically driven recognition we use for the current loop optimizer.
I aspire to reconcile this somehow in future work.
All this is disabled by default; a new config option either enables using
synthesis to set block weights for all root methods or just those without PGO
data.
Synthesis for inlinees is not yet enabled; progress here is blocked by #82755.
Andrew Au [Mon, 6 Mar 2023 18:48:49 +0000 (10:48 -0800)]
Fix special sweep issue for workstation (#81248)
Bruce Forstall [Mon, 6 Mar 2023 16:48:38 +0000 (09:48 -0700)]
Simplify fgDfsReversePostorderHelper (#83018)
Andy Ayers [Mon, 6 Mar 2023 16:10:52 +0000 (08:10 -0800)]
Fixes for partial compilation of methods (#80635)
* don't block GC while waiting for PC continuation to jit
* fix flow cleanup at partial compilation point
Katelyn Gadd [Mon, 6 Mar 2023 15:58:44 +0000 (07:58 -0800)]
Fix cknull_ptr value tracking being incorrect for address-taken locals (#83006)
Jakob Botsch Nielsen [Mon, 6 Mar 2023 14:32:03 +0000 (15:32 +0100)]
JIT: Assume allocations succeed (#82961)
We call a NOMEM function when allocations fail that is already marked as
no-return, but at least MSVC is not able to pick up on this fact. The
result is that all operator new calls end up with an unnecessary null
check. This adds a COMPILER_ASSUME to allow compilers to recognize
that allocations never fail.
There was also a workaround for an old VSW bug that I've removed.
Egor Bogatov [Mon, 6 Mar 2023 11:36:59 +0000 (12:36 +0100)]
Enable more intrinsics for tier0 (#83002)
Michal Strehovský [Mon, 6 Mar 2023 11:14:52 +0000 (20:14 +0900)]
Update Microsoft.NETCore.Native.targets (#83024)
DeepakRajendrakumaran [Mon, 6 Mar 2023 06:03:21 +0000 (22:03 -0800)]
Initial support for zmm in .NET (#80960)
* Adding simd64 and zmm types.
* Adding other infrastructure to lower/emit code for simd64.
* Lowering + workarounds for simd64 constants.
* Fix lowering logic for Create().
* Save/restore for zmm
* Add ToDo comments for AVX512BW
* Separate AVX512F and AVX512BW + Fix disassembly.
* Review changes.
* Fixing throughput issue.
* Additional Review comments.
* Setting 'EnableIncompleteISAClass="1"' for relevant CI runs.
* Removing 64 bit flags + correcting check.
* Apply formatting patch
---------
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Will Smith [Sun, 5 Mar 2023 23:54:18 +0000 (15:54 -0800)]
[JIT] Fixed improper peephole zero-extension removal when cdq/cwde instructions are involved (#82733)
* Fixed improper peephole zero-extension removal when cdq/cdqe/cwde instructions are involved
* Update regression test
* Formatting
* Handle cdq differently
* Handle cdq differently
* Handle cdq differently
* Take into account cmpxchg
* Take into account cmpxchg
* Feedback
* Added emitIsInstrWritingToReg. Removed the previously added function.
* Remove function from header
* Quick fix
* Added comment
* Formatting
* Feedback
* Fix build
Stephen Toub [Sun, 5 Mar 2023 23:36:44 +0000 (18:36 -0500)]
Fix BitConverter.ToXx error message (#82987)
The current message ("Destination array is not long enough to copy all the items in the collection. Check array index and length."), which is otherwise used by CopyTo methods, makes no sense in these APIs. :)
Mike McLaughlin [Sun, 5 Mar 2023 17:50:49 +0000 (09:50 -0800)]
Add NT_SIGINFO NOTE to ELF dumps (#82449)
* Add NT_SIGINFO NOTE to ELF dumps
Linux Watson needs this to better triage ELF dumps.
Add CreateDumpOptions helper struct to pass all the command options around. Add the
"--code", "--errno", "--address" command line options used to fill the NT_SIGINFO
NOTE. The runtime passes to createdump on a crash.
Added "ExceptionType" field to "Parameters" section of the Linux crash report json.
* Add NT_SIGINFO define
* Code review feedback
Adeel Mujahid [Sun, 5 Mar 2023 16:40:20 +0000 (18:40 +0200)]
Replace remaining instances of COMPlus with DOTNET (#82985)
* Replace remaining instances of COMPlus with DOTNET
* Fix heading in RyuJIT tutorial
Stephen Toub [Sun, 5 Mar 2023 05:11:19 +0000 (00:11 -0500)]
Replace some unnecessary use of CompareInfo (#82988)
Anywhere we're explicitly passing Ordinal or OrdinalIgnoreCase, the actual culture data is ignored. We can just use the relevant string/span methods directly.
dotnet-maestro[bot] [Sun, 5 Mar 2023 05:07:43 +0000 (23:07 -0600)]
Update dependencies from https://github.com/dotnet/msquic build
20230303.1 (#82979)
System.Net.MsQuic.Transport
From Version 8.0.0-alpha.1.23124.1 -> To Version 8.0.0-alpha.1.23153.1
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Bruce Forstall [Sat, 4 Mar 2023 20:55:37 +0000 (13:55 -0700)]
Clean up run.sh documentation (#82983)
Add line about build configuration.
Fix illink syntax help.
Simplify a couple cases that just set environment variables.
dotnet-maestro[bot] [Sat, 4 Mar 2023 20:54:28 +0000 (14:54 -0600)]
Update dependencies from https://github.com/dotnet/roslyn build
20230304.2 (#82980)
Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
From Version 4.6.0-3.23153.1 -> To Version 4.6.0-3.23154.2
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Stephen Toub [Sat, 4 Mar 2023 19:18:02 +0000 (14:18 -0500)]
Fix invariant check in DateTimeParse (#82971)
dotnet-maestro[bot] [Sat, 4 Mar 2023 18:35:49 +0000 (12:35 -0600)]
Update dependencies from https://github.com/dotnet/arcade build
20230303.1 (#82978)
Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
From Version 8.0.0-beta.23152.1 -> To Version 8.0.0-beta.23153.1
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Zoltan Varga [Sat, 4 Mar 2023 15:36:11 +0000 (10:36 -0500)]
[mono] Fix Hello World sample. (#82977)
Bruce Forstall [Sat, 4 Mar 2023 10:33:03 +0000 (03:33 -0700)]
Remove dead link (#82972)
Egor Bogatov [Sat, 4 Mar 2023 09:40:21 +0000 (10:40 +0100)]
Enable JitDasmWithAlignmentBoundaries and JitDasmWithAddress in Release (#82666)
Omair Majid [Sat, 4 Mar 2023 07:07:20 +0000 (02:07 -0500)]
Add RID for Fedora 39 (#82185)
The changes to runtime.json and runtime.compatibility.json were
generated by tooling.
David Wrighton [Sat, 4 Mar 2023 04:50:07 +0000 (20:50 -0800)]
Fix the multicore performance of mapping from an instruction pointer to a MethodDesc (#79021)
Mapping from an instruction pointer to a MethodDesc is a critical component of the runtime used in many places, notably diagnostics, slow path delegate creation, and stackwalking.
This change provides a dramatic improvement in the performance of that logic through several techniques.
1. The mapping from IP to range of interesting memory is done via a tree structure resembling that of a page table. The result of this is that in addition to reducing the locking logic, the cost of looking up in the presence of many different loaded assemblies will be reduced to a nearly constant time.
2. That tree structure is configured so that when accessing memory which will never be freed in the lifetime of the process, the memory can be accessed without taking any locks whatsoever.
3. The code map is enhanced to include not only the code generated by the JIT/R2R code, but also to include the fixup and stub precode stubs.
4. In addition, performance improvement was done to improve the performance of slow path delegate creation in particular, by reordering which checks are done, and by writing a simplified signature parse routine for computing the number of arguments to a function.
Performance of this was tested in both the EH stackwalking scenario as well as the delegate slow path creation scenario, but the delegate logic is what will be most visible when this is checked in. (See PR #79471 for details of the additional changes necessary to take advantage of this work when doing EH) (#8393 describes the potential product impact of just improving the delegate slow path creation code)
For the delegate creation scenario the perf impact was measured to be quite substantial. These numbers are in ms to create a constant number of delegates on each thread used. Smaller is better. The test was run on a 6 core machine.
| Threads | Without fix | With this PR
| ------------- | ------------- | ----- |
| 1 | 840 | 313|
| 2 | 1977 | 316 |
| 3 | 3290 | 325 |
| 4| 4259 | 344 |
| 5 | 5140 | 351 |
| 6 | 5872 | 374|
| 7 | 6463 | 442|
| 8 | 7046 | 499|
| 9 | 7648 | 547|
| 10 | 8241 | 627|
| 11 | 8851 | 749|
| 12 | 9595 | 773|
Fixes #8393
Katelyn Gadd [Sat, 4 Mar 2023 01:07:20 +0000 (17:07 -0800)]
[wasm] Improve jiterpreter trace entry point selection heuristic (#82604)
This PR adjusts the jiterpreter's heuristic that decides where it's best to put entry points:
* Adds a requirement that entry points be at least a certain distance apart, since in some cases we can end up with trace entry points right next to each other, which isn't very useful and adds overhead. (Backwards branch targets are exempted from this so loops will still JIT properly).
* If we fail to create a trace exactly located at a backwards branch target, continue trying at blocks afterward. This should help in the rare case where the body of a loop begins with an unsupported instruction.
* When considering how long a trace actually is, we treat conditional aborts (like calls and throws) separately from ignored and supported instructions, so they don't count towards the overall size of the trace. These instructions aren't actually doing any useful work and if executed the trace will exit, so it's better not to consider them when deciding whether a trace is worth compiling.
This PR also manually inlines trace entry logic.
Stephen Toub [Sat, 4 Mar 2023 01:06:29 +0000 (20:06 -0500)]
Trim some overheads for "r"/"o" DateTime parsing (#82925)
We were doing some unnecessary work on these fast paths.
I also noticed and cleaned up an unnecessary delegate involved in Hebrew number parsing.
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)