Alexander Köplinger [Mon, 26 Dec 2022 12:15:55 +0000 (13:15 +0100)]
Fix condition in backport.yml to also trigger on schedule (#79951)
Andrii Kurdiumov [Sun, 25 Dec 2022 23:45:49 +0000 (05:45 +0600)]
Fix type name parsing in NativeAOT (#79963)
Simplified type name parsing was breaking if full name or assembly name has underscode ('_') in it. That breaks referencing `SQLitePCL.Batteries_V2, SQLitePCLRaw.batteries_v2` type inside `Microsoft.Data.Sqlite`
Fixes https://github.com/dotnet/efcore/issues/29725
Jan Kotas [Sun, 25 Dec 2022 19:48:20 +0000 (11:48 -0800)]
Delete token scanning from JIT/EE interface (#79964)
Token scanning was left-over from appdomains. It is not needed and it has subtle bugs that libraries tests started hitting recently.
Fixes #79439
hangy [Fri, 23 Dec 2022 21:40:21 +0000 (22:40 +0100)]
Extend ProcessStartInfo to allow setting LOGON_NETCREDENTIALS_ONLY (#77637)
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Vladimir Sadov [Fri, 23 Dec 2022 21:31:48 +0000 (13:31 -0800)]
Fixing compressed singlefile scenario on osx-arm64 (#79894)
* force 6.0 instead of 3.0 on osx-arm64
* disable legacy test on osx-arm64
* fix osx-arm64 case
* undo unnecessary change
* use MEM_RESERVE_EXECUTABLE on HOST_UNIX
Badre BSAILA [Fri, 23 Dec 2022 20:17:48 +0000 (21:17 +0100)]
Unify FileStreamStrategy seeking (#78984)
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Jan Kotas [Fri, 23 Dec 2022 17:45:27 +0000 (09:45 -0800)]
Fix condition for selecting build pools for official builds (#79779)
This change makes the condition that select Windows vs. Linux build machine identical between official and public builds.
Michal Strehovský [Fri, 23 Dec 2022 17:23:38 +0000 (02:23 +0900)]
Move all of generic virtual method resolution to the type loader (#79925)
* Move all of generic virtual method resolution to the type loader
For whatever reason, the logic that walks the inheritance hierarchy and deals with the differences between interface GVM and class GVM calls was in CoreLib.
Move it to the type loader because we'll need it for #77070.
* Oh the conversion to EEType was important
dotnet-maestro[bot] [Fri, 23 Dec 2022 14:26:05 +0000 (15:26 +0100)]
[main] Update dependencies from dotnet/arcade (#79448)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Alexander Köplinger [Fri, 23 Dec 2022 13:30:06 +0000 (14:30 +0100)]
Dispose underlying stream in TarReader.DisposeAsync() as well (#79920)
* Dispose underlying stream in TarReader.DisposeAsync() as well
Same as https://github.com/dotnet/runtime/pull/79899
* Consolidate duplicated WrappedStream test helpers to Common sources
* Dispose stream passed to WrappedStream
David Cantú [Fri, 23 Dec 2022 12:49:42 +0000 (06:49 -0600)]
Add readmes for @dotnet/area-system-io (#78935)
* Add readmes for @dotnet/area-system-io
* Fix trailing whitespace
* Fix contrib bar for Pipes.AccesControl and UnmanagedMemoryStream
* Remove "We encourage you to add new tests in..." line
* Apply suggestions from code review
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
David Cantú [Fri, 23 Dec 2022 12:18:04 +0000 (06:18 -0600)]
Add readmes for @dotnet/area-extensions-filesystem (#78954)
* Add readmes for @dotnet/area-extensions-filesystem
* Apply suggestions from code review
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Tom Deseyn [Fri, 23 Dec 2022 12:04:19 +0000 (13:04 +0100)]
Process.Unix: while reaping all processes, handle encountering direct children. (#79817)
The process that runs as pid 1 is responsible for reaping orphaned processes.
Since .NET 7, .NET applications running as pid 1 assume this responsibility.
The code meant for reaping orphaned processes didn't account for encountering
direct children. These child processes get reaped without updating
the internal state. When the code later tries to reap such a child process
it causes a FailFast because the process is missing.
Michal Strehovský [Fri, 23 Dec 2022 05:35:38 +0000 (14:35 +0900)]
Fix size regression from enum sorting (#79845)
Use a specialized comparer instead of `Comparer<T>.Default` that brings the implementation of `IComparable.ComparerTo` on everything. Also get rid of the generic virtual method call.
Saves 0.9% on Hello World.
Michal Strehovský [Fri, 23 Dec 2022 04:14:08 +0000 (13:14 +0900)]
Allow preinitializing types with canonical forms (#79384)
* Allow preinitializing types with a canonical form
* Allow preinitializing generics with TypeLoaderAwarePreinitializationPolicy
We blanket disable canonical form preinitialization to keep things working by the policy instead.
* Fix Linq test
Michal Strehovský [Thu, 22 Dec 2022 23:26:05 +0000 (08:26 +0900)]
Avoid delegate allocation in generic cycle detector (#79842)
Removes 1,000,000 (one million) allocations while compiling a hello world. We were allocating a delegate and a closure each time we saw a reference from something generic to something generic.
This replaces the delegate with a manual closure allocated on the stack. The number of stack allocated entries was chosen arbitrarily. The highest recursion we see in CoreLib is for 3 elements, so 4 includes a bit of a buffer.
Maybe it's a tiny bit less readable, but not that much.
Buyaa Namnan [Thu, 22 Dec 2022 23:20:02 +0000 (15:20 -0800)]
Fix diagnostics found with new analyzer - CA1853 (#79896)
* Update src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryBuilder.cs
Co-authored-by: Dan Moseley <danmose@microsoft.com>
Marek Safar [Thu, 22 Dec 2022 18:29:09 +0000 (19:29 +0100)]
Update WasmBase::IsSupported not to use backing field (#79884)
Alexander Köplinger [Thu, 22 Dec 2022 12:57:51 +0000 (13:57 +0100)]
Disable failing outerloop tests with ActiveIssue (#79908)
See https://github.com/dotnet/runtime/issues/79731 and https://github.com/dotnet/runtime/issues/79749 and https://github.com/dotnet/runtime/issues/79820
Mark Plesko [Thu, 22 Dec 2022 12:38:24 +0000 (04:38 -0800)]
More preparation for JIT\Regression test merging (#79697)
This is another collection of changes that can be merged independently of actual test merging. Automated changes were done with the ILTransform tool (started by @trylek, my version at https://github.com/markples/utils/tree/for-PR-dotnet-runtime-79697, commit
6324a32f).
- Remove test JIT/Regression/VS-ia64-JIT/V1.2-Beta1/b102887 (identical to JIT/Regression/VS-ia64-JIT/V1.2-M02/b28077)
- Dedup class names in GitHub_23199
- JIT/Regression/JitBlue/GitHub_23199 used #ifdefs to create 32 and 64 bit versions of the test
- Both versions can run on any host
- Duplicate the test with different names and no ifdefs
- Run both versions on all hosts
- Merge b399444 into one test that handles both cases
- JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b399444 used #ifdefs to create two tests
- Combine both into one test that checks both without #ifdefs
- Delete unused .xml files
- Add RequiresProcessIsolation
- Automated via `ILTransform -prociso`
- Add `<RequiresProcessIsolation>true</RequiresProcessIsolation>` for any test with CLRTestTargetUnsupported, GCStressIncompatible, UnloadabilityIncompatible, JitOptimizationSensitive, TieringTestIncompatible, HeapVerifyIncompatible, IlasmRoundTripIncompatible, SynthesizedPgoIncompatible, or CrossGenTest properties.
- Add `<RequiresProcessIsolation>true</RequiresProcessIsolation>` for any test with CLRTestBashEnvironmentVariable, CLRTestBatchEnvironmentVariable, CLRTestEnvironmentVariable, Content, CMakeProjectReference (not sure about the last two, but they only impact 3 tests and can be examined later)
- Add `<RequiresProcessIsolation>true</RequiresProcessIsolation>` for any test that calls Environment.Exit
- Add comment explaining why RequiresProcessIsolation is set to help with removing them later
- Make entry points public
- Automated via `ILTransform -public`
- Update entry point method (`Main` for C#, whatever is marked `.entrypoint` for IL) to be public
- Update entry point's enclosing type to be public if it exists
- Wrap IL entry points in a new class if one doesn't exist (e.g., CLR-x86-JIT/V1-M09.5-PDC/b10940/b10940a.il)
- Manual fixes for public changes
- These were all C# cases where Main was previously in a non-public type with other public methods that contained non-public types
- Fix in all cases is to just make the other method not public
David Cantú [Thu, 22 Dec 2022 09:36:43 +0000 (03:36 -0600)]
FileSystemWatcher: recreate file/directory before removing it again (#79901)
David Cantú [Thu, 22 Dec 2022 09:27:40 +0000 (03:27 -0600)]
TarReader should dispose underlying stream if leaveOpen is false (#79899)
Nash Barden [Thu, 22 Dec 2022 08:37:19 +0000 (19:37 +1100)]
Int32: Fixed double space in comments for Parse (#79897)
Co-authored-by: Nash Barden <nash.barden@tribetech.com.au>
Eugene Zhirov [Thu, 22 Dec 2022 01:40:38 +0000 (02:40 +0100)]
createdump: only dump committed memory (#79853)
Dumping memory regions as they are listed in /proc/pid/maps
results in increase of RAM usage of the target application
on some Linux kernels.
This change uses /proc/pid/pagemap to check if the page is committed
before adding it to the regions list. As the file is not available on
kernels 4.0 and 4.1 without elevated permissions there's a fallback to
previous behavior.
Tlakaelel Axayakatl Ceja [Thu, 22 Dec 2022 01:24:07 +0000 (17:24 -0800)]
Remaining feedback from ILLink merge (#79677)
* Remaining feedback from ILLink merge
Move ILLink MSBuild dependencies into Versions.props MSBuild section, and use a consistent MSBuild version
Update the readme from linker to state is a project and not a repository
Uses a live build of ilasm instead of relying on prebuilt bits from Microsoft.NET.Sdk.IL
Remove a unnecesary DefineConstant that is imported via SDK
Avoid having hardcoded package versions
Removes the illink PATENTS.txt, runtime's PATENTS.txt already takes into account Mono given that it has a mono partition
Michal Strehovský [Wed, 21 Dec 2022 21:59:33 +0000 (06:59 +0900)]
Switch to the new ARM64 Helix queues (#77764)
michel-codekapitein [Wed, 21 Dec 2022 18:00:23 +0000 (19:00 +0100)]
Fix deviating XMLDoc for HostingEnvExtensions (#79708)
XMLDoc was still pointing to the obsolete EnvironmentName instead of Environments.
Co-authored-by: Michel Trouwborst <michel@jump.nl>
Tanner Gooding [Wed, 21 Dec 2022 17:49:57 +0000 (09:49 -0800)]
Avoid a race condition in restoring the GenerateHWIntrinsicTests_* projects (#79861)
Viktor Hofer [Wed, 21 Dec 2022 16:32:37 +0000 (17:32 +0100)]
Update packaging.targets (#79881)
Miha Zupan [Wed, 21 Dec 2022 16:16:52 +0000 (17:16 +0100)]
Remove Mono SpanHelpers workaround (#79821)
Brian Surowiec [Wed, 21 Dec 2022 13:04:44 +0000 (08:04 -0500)]
Fix class summary (#79872)
Adam Sitnik [Wed, 21 Dec 2022 11:29:15 +0000 (12:29 +0100)]
New ASCII APIs (#75012)
Co-authored-by: Levi Broderick <levib@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
Adeel Mujahid [Wed, 21 Dec 2022 10:31:08 +0000 (12:31 +0200)]
Remove bash dependency from init-compiler.sh (#77304)
dotnet-maestro[bot] [Wed, 21 Dec 2022 09:23:17 +0000 (10:23 +0100)]
[main] Update dependencies from dotnet/cecil (#79274)
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Bruce Forstall [Wed, 21 Dec 2022 03:18:57 +0000 (19:18 -0800)]
Fix build for DUMP_GC_TABLES defined in Release (#79835)
* Fix build for DUMP_GC_TABLES defined in Release
* Formatting
Bruce Forstall [Wed, 21 Dec 2022 03:18:08 +0000 (19:18 -0800)]
Fix Checked/Release asm diffs (#79844)
Code inside a `#ifdef DEBUG` had a side-effect not visible to
Release builds. Pull that code out of the `#ifdef`.
Fixes #79560
Katelyn Gadd [Tue, 20 Dec 2022 23:23:14 +0000 (15:23 -0800)]
Wasm jiterpreter cleanup and bug fixes pt. 4 (#79324)
* Instead of jitting interp_entry wrappers for every entry point, record a hit count for each one and then queue it for JIT compilation once it's hit enough times
* Add prefs controlling interp entry queue thresholds
* Add support for using imported globals for pointer constants (to enable future threading/caching), off by default
* Use base 36 for jiterpreter import names to save space
Anton Firszov [Tue, 20 Dec 2022 19:58:25 +0000 (20:58 +0100)]
Fix ConnectAsync with buffer on Windows (#79669)
Fixes #79654
Thays Grazia [Tue, 20 Dec 2022 19:28:33 +0000 (16:28 -0300)]
Fixing generating a signal when running on release mode (#79822)
Jan Vorlicek [Tue, 20 Dec 2022 18:23:25 +0000 (19:23 +0100)]
Make DacValidateMD more resilient to invalid MethodDesc (#79846)
The DacValidateMD is not resilient to invalid MethodDesc that contains
NULL in its m_pMethTab field. It was found when using the ClrMD in the
BenchmarkDotNet disassembler code which is trying to find if some constants
in the code represent MethodDesc so that it can dump the related method
name.
This change fixes it by checking the MethodTable after it is extracted
from the MethodDesc. There are two values that are not translated between
the target and the debugger sides - NULL and -1. So I have added handling
both as invalid there.
Adeel Mujahid [Tue, 20 Dec 2022 16:39:07 +0000 (18:39 +0200)]
Use `init-os-and-arch.sh` in mono samples recipes (#78055)
Jan Dupej [Tue, 20 Dec 2022 13:34:12 +0000 (14:34 +0100)]
[mono][aot] Fixed decompose_flag propagation, addresses #79710 (#79849)
Jan Dupej [Tue, 20 Dec 2022 12:18:38 +0000 (13:18 +0100)]
[mono][llvm] Added a null-check for 2-dim array access (#79450)
* [mono][llvm] Added a null-check for 2-dim array accessors, addressing #79022
* [mono][llvm] Adding a regression test for issue https://github.com/dotnet/runtime/issues/79022
* [mono][llvm] Null check for 2D arrays is now more DRY.
* [mono][llvm] Null-checking on 2D array access, removed restriction to LLVM.
Adam Sitnik [Tue, 20 Dec 2022 09:29:18 +0000 (10:29 +0100)]
Update manual console tests after recent ReadKey rewrite, fixes #78467 (#79811)
Jan Vorlicek [Tue, 20 Dec 2022 04:30:45 +0000 (05:30 +0100)]
Fix ldarg_i test (#79834)
When changing the test recently, I have missed the conv.i4 that I should
have removed from the preexisting code. The test was passing when
`runincontext` was passed to the coreclr test run, so I have incorrectly
assumed that it will work in regular runs too.
Michal Strehovský [Mon, 19 Dec 2022 22:34:07 +0000 (07:34 +0900)]
Skip parsing types in ILLinkTrim.Descriptors if not needed (#79803)
We should not even be using this parser (#79802). It's surprisingly slow to use this.
This saves about 10% of wallclock time when compiling Hello World (yes, I can't believe my measurements either). We parse the descriptors for the purposes of manifest resources pretty late in the single threaded phase.
Michal Strehovský [Mon, 19 Dec 2022 22:33:16 +0000 (07:33 +0900)]
Use LockFreeReaderHashtable for some of the NodeCaches (#79805)
Not replacing everything because the only reason this has better perf than `ConcurrentDictionary` is that the API surface is totally unergonomic. These are the heaviest hitters.
Mitchell Hwang [Mon, 19 Dec 2022 20:13:55 +0000 (15:13 -0500)]
[mono] Export unmanagedcallersonly method symbols (#79424)
* [mono] Add export_symbols_outfile parameter
[mono] Export EntryPoint of methods decorated with UnmanagedCallersOnlyAttribute to specified export_symbols_outfile
* [mono] Create export file and export symbols iff there are specified EntryPoints
* [task] Bootstrap export-symbols-outfile mono aot compiler option to MonoAOTCompiler Task
* Format symbols based on platform
* Address feedback
* Check for exportsymbols when EnableUnmanagedCallersOnlyMethodsExport is true
SingleAccretion [Mon, 19 Dec 2022 18:28:01 +0000 (21:28 +0300)]
Fix ObjectAllocator assert (#79813)
Tanner Gooding [Mon, 19 Dec 2022 16:26:21 +0000 (08:26 -0800)]
Dynamic generate hwintrinsic tests (#79552)
* Changing the Arm hardware intrinsic tests to be dynamically generated
* Changing the General hardware intrinsic tests to be dynamically generated
* Changing the X86 hardware intrinsic tests to be dynamically generated
* Minor additional cleanup of the hwintrinsic generation files
* Ignore a warning about SelfContained mismatch on an unreferenced project
* Ensure the GenerateHWIntrinsicsTests projects are restored for Mono builds
* UseAppHost=true for GenerateHWIntrinsicTests
* Workaround the issue with parallel builds
* Fixing the VectorDotTest template to correctly compute the sum
Anton Firszov [Mon, 19 Dec 2022 15:28:55 +0000 (16:28 +0100)]
Do not overallocate SocketAddress.Buffer (#78860)
* do not overallocate SocketAddress.Buffer
* make sure CopyAddressSizeIntoBuffer and GetAddressSizeOffset are only accessible as System.Net.Sockets internals on Windows
Michal Strehovský [Mon, 19 Dec 2022 14:44:31 +0000 (23:44 +0900)]
Pass metadata pointers to RyuJIT (#79806)
RyuJIT started asking about names a lot more than it used to. Pass it UTF-8 pointers from metadata instead of UTF-16-converted, then UTF-8 converted, and pinned byte buffers.
Michal Strehovský [Mon, 19 Dec 2022 14:36:07 +0000 (23:36 +0900)]
Cache DocumentUrl in PortablePdbSymbolReader (#79804)
This uses the exact same strategy as the unmanaged reader (`Dictionary` with a `lock` around `this`).
Viktor Hofer [Mon, 19 Dec 2022 11:14:42 +0000 (12:14 +0100)]
Make sure that NS2.0 source generators are built (#79810)
97a51ccdb147992b80d427b83a77caa967d275b4 regressed the inclusion of source generators in the targeting pack as the `netstandard2.0` inner build was never chosen by the sfx-gen.proj traversal project. Noticed in the SDK consumption PR: https://github.com/dotnet/sdk/pull/29406
xtqqczze [Mon, 19 Dec 2022 11:10:20 +0000 (11:10 +0000)]
Use Unsafe.NullRef (#79589)
Gregg Miskelly [Mon, 19 Dec 2022 02:29:18 +0000 (18:29 -0800)]
Add instructions for disabling VS signature validation (#79777)
In Visual Studio 17.5, Visual Studio will start enforcing signature validation for DAC and DBI. This adds documentation on how to disable this for folks using daily or private builds.
Vlad Brezae [Sun, 18 Dec 2022 12:43:31 +0000 (14:43 +0200)]
Remove mono specific SpanHelpers (#79215)
* Revert "[Mono] Restore old code to solve the recent SpanHelpers regressions (#75917)"
This reverts commit
254844a700179bb3b39149db1946691e3696d6fc.
* [System.Span] Refactor hot loop code
This would replace code like
```
load
b.neq
add
ret
load
b.neq
add
ret
load
....
```
with
```
load
b.eq
load
b.eq
load
...
```
This makes the code more compact in the hot loop, reduces overall code size and thus improves performance. This pattern is widely used and it was also used before with Span lookups.
* [mono][interp] Replace compare + brfalse/brtrue with single conditional branch
* [mono][interp] Dump in/out links for bblocks during verbose logging
* [mono][interp] Improve detection of dead bblocks
Before we were marking bblocks as dead if they had their in_count 0. This is not enough however, since it doesn't account for loops. We now do a full traversal of the bblock graph to detect unreachable bblocks.
* [mono][interp] Reorder bblocks to facilitate propagation of values
Consider for example the following pattern used commonly with conditional branches:
```
br.s [nil <- nil], BB0
...
ceq0.i4 [32 <- 40],
br.s [nil <- nil], BB1
BB0: ldc.i4.0 [32 <- nil],
BB1: brfalse.i4.s [nil <- 32], BB_EXIT
BB2: ldstr [56 <- nil], 2
```
This commit reorders this code to look like:
```
br.s [nil <- nil], BB0
...
ceq0.i4 [32 <- 40],
brfalse.i4.s [nil <- 32], BB_EXIT
br.s [nil <- nil], BB2
BB0 ldc.i4.0 [32 <- nil],
BB1: brfalse.i4.s [nil <- 32], BB_EXIT
BB2: ldstr [56 <- nil], 2
```
This means we will have duplicated brfalse instructions, but every basic block reaching the conditional branch will have information about the condition. For example ceq0.i4 + brfalse is equivalent to brtrue, ldc.i4.0 + brfalse is equivalent to unconditional branch. After other future optimizations applied on the bblocks graph, like removal, merging and propagation of target, the resulting code in this example would look like:
```
br.s [nil <- nil], BB_EXIT
...
brtrue.i4.s [nil <- 40], BB_EXIT
BB2: ldstr [56 <- nil], 2
```
Which is a great simplification over the original code.
* [mono][interp] Don't optimize out bblocks that are tiering patchpoint targets
Even though they can be become unreachable in the current method, they can still be called when the unoptimized method gets tiered at this point.
Add assert to prevent such issues in the future.
* [mono][interp] Make bblock reordering more conservative
If we are unlikely to gain anything from propagating the condition (if we don't have information about any of the condition operand vars), simply avoid the optimization.
* [mono][interp] Add basic removal of unused defines
If we store in a var and this var is not used and redefined by the end of the basic block, then we can clear the original store.
* [mono][interp] Clear unused defines of local only vars
We detect if a var's value never escapes the definition of a bblock. We mark such vars and clear unused definitions of that var from other bblocks.
* [mono][interp] Propagate target branches
If a bblock contains only an unconditional br, then all bblocks branching into it can just call the target directly instead.
* [mono][interp] Add super instruction for (var + ct1) * ct2
This pattern is used in low level unsafe code when using (var + ct1) as an index into an array, where ct2 is the sizeof of array element.
Also fix diplay of two shorts when dumping instructions.
* [mono][interp] Add new ldind super instruction
These new instructions can apply addition and multiplication with constant to the offset var.
madelson [Sat, 17 Dec 2022 22:44:50 +0000 (17:44 -0500)]
Ensure that OptionsCache only permits creating a single options instance per name (#79639)
fix https://github.com/dotnet/runtime/issues/79529
Michal Strehovský [Sat, 17 Dec 2022 15:28:28 +0000 (00:28 +0900)]
Speed up resolving members of types (#79784)
When constructing type system representation of a type member, we need two things - the token of the member, and type system representation of the owning type.
We have a couple places where we iterate members on a type - in those places, we already have a type system representation of the owning type. Shortcut the codepath that would recompute this information.
Günther Foidl [Sat, 17 Dec 2022 15:25:52 +0000 (16:25 +0100)]
Fixed relative links in Memory-model.md (#79785)
Alexander Köplinger [Sat, 17 Dec 2022 11:39:38 +0000 (12:39 +0100)]
[mono] Disable a few outerloop tests and update issue numbers (#79759)
Jakob Botsch Nielsen [Sat, 17 Dec 2022 09:10:43 +0000 (10:10 +0100)]
JIT: Fix indir flags propagation for a couple of cases (#79751)
SetIndirExceptionFlags expects only unary indirs (reads) and does not
handle other cases correctly. Add an assert for it and fix the users.
Only fgMorphStoreDynBlock had the bug since gtUpdateNodeOperSideEffects
assumes the caller will propagate effect flags from operands afterwards.
Extracted from early liveness PR.
Fix #79750
Jakob Botsch Nielsen [Sat, 17 Dec 2022 09:10:20 +0000 (10:10 +0100)]
JIT: Fix switch peeling flags propagation (#79748)
Otherwise we could propagate overlapping flags that change meaning.
Extracted from early liveness PR.
Jakob Botsch Nielsen [Sat, 17 Dec 2022 09:09:56 +0000 (10:09 +0100)]
JIT: Clean up some old style walks and QMARK validation (#79747)
* JIT: Clean up some old style walks
Extracted from early liveness PR. Also small visitor change.
* Remove dead code, more cleanup
Jakob Botsch Nielsen [Sat, 17 Dec 2022 09:08:11 +0000 (10:08 +0100)]
Delete some commented tests (#79742)
* (Re)enable some SysV pinvoke tests
Fix #4680
* Delete tests instead
Miha Zupan [Sat, 17 Dec 2022 04:58:41 +0000 (05:58 +0100)]
Avoid boxing in DeferredDisposableLifetime (#79778)
* Avoid boxing in DeferredDisposableLifetime
* Move `typeof` lookup behind the if check
Tanner Gooding [Fri, 16 Dec 2022 22:05:39 +0000 (14:05 -0800)]
Ensure that `TryGetContainableHWIntrinsicOp` is non-mutating (#79363)
* Ensure that `TryGetContainableHWIntrinsicOp` is non-mutating
* Applying formatting patch
* Ensure BuildOperandUses handles CreateScalarUnsafe being contained
* Ensure CreateScalarUnsafe is only contained for regOptional when the op1 type is a floating-point
* Directly check that op1 is contained/regOptional
* Ensure FusedMultiplyAdd rechecks CreateScalarUnsafe containment after removing NEG nodes
* Ensure BroadcastScalarToVector doesn't regress containable scenarios
* Applying formatting patch
DeepakRajendrakumaran [Fri, 16 Dec 2022 21:56:50 +0000 (13:56 -0800)]
Fixes #79558: (#79681)
INS_movd can represent either movd or movq(https://github.com/dotnet/runtime/issues/47943).
As such, this is a special case and we need to calculate inputSize based on emitAttr.
Jan Vorlicek [Fri, 16 Dec 2022 21:18:47 +0000 (22:18 +0100)]
Fix failing coreclr tests in `runincontext` mode (#79705)
* Fix unloadability tests with `runincontext`
This change makes the run of coreclr tests with `runincontext` argument
pass without any errors. It disables couple of tests incompatible with
unloadability and one test with known unloadability issue
(https://github.com/dotnet/runtime/issues/79588).
It also fixes two COM interop tests that were not releasing a wrapper,
which blocked the ability to unload it.
* Fix the JIT il tests instead of disabling
Jan Kotas [Fri, 16 Dec 2022 20:18:44 +0000 (12:18 -0800)]
Change the default for ilc compiler architecture (#79761)
The host architecture for the ilc compiler package should default to .NET SDK architecture that the build is running under.
Fixes #79253
Tomas Weinfurt [Fri, 16 Dec 2022 19:58:54 +0000 (11:58 -0800)]
improve SendFileGetsCanceledByDispose test (#79718)
Tomas Weinfurt [Fri, 16 Dec 2022 19:57:59 +0000 (11:57 -0800)]
disable SslStream_AllowRenegotiation_False_Throws (#79730)
Tomas Weinfurt [Fri, 16 Dec 2022 19:56:58 +0000 (11:56 -0800)]
add EventSource log to alpn on macOS (#79737)
Vladimir Sadov [Fri, 16 Dec 2022 19:26:07 +0000 (11:26 -0800)]
Memory model document. (#75790)
* Created memory-model.md
* addresses some comments
* More details and samples.
* Fix trailing whitespaces.
* More trailing whitespace
* More trailing whitespace.
* Apply suggestions from code review (typos)
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
* replaced references to CLR with ".NET runtime"
* Addressed some PR review feedback
* Moved to specs folder
* More addressing PR feedback
* Volatile/Interlocked methods are atomic
* Better notes about atomicity of pointers
* Apply suggestions from code review
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Addressing more PR feedback
* Updated singleton sample for more clarity.
* Trailing whitespace.
* Move data dependent reads to general section
* Compat disambiguation note on object assignments.
* Apply suggestions from code review
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* No dots at title ends
* "Data-dependent" spelled with dash consistently
* Apply suggestions from code review
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Apply suggestions from code review
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
* Apply suggestions from code review
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* order of object assignment and data-dependent memory accesses
* Listed primitive types.
* Briefly explained motivations for the treatment of memory access sideeffects.
* Update docs/design/specs/Memory-model.md
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Link to the data-dependent accesses and compiler optimizations followup issue.
* removed unnecessary `[`
* Update docs/design/specs/Memory-model.md
* Trailing whitespace
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Eirik Tsarpalis [Fri, 16 Dec 2022 18:44:06 +0000 (20:44 +0200)]
Add nullable reference type annotations to System.Text.Json source gen (#79613)
* Add nullability annotaitons to sourcegen components.
* Move sourcegen testing from Roslyn4.0 to Roslyn4.4.
* Fix accessibility modifiers
* Allow source generators to multi-target
* Binplace only netstandard2.0 compiled source generators
* Use live NetCoreAppCurrent tfm
* Update Directory.Build.targets
* Pick correct analyzer asset for consumption
* Fix build
* Revert "Move sourcegen testing from Roslyn4.0 to Roslyn4.4."
This reverts commit
fe7857066040ddf0ef632c135e83e49b097c28f7.
* Make analyzer P2Ps choose the right asset
* PR feedback
* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs
* Make source generator target an LKG
* Update project-guidelines.md
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
Bruce Forstall [Fri, 16 Dec 2022 18:29:43 +0000 (10:29 -0800)]
Improve spmi diffs summary report (#79725)
1. In the overall summary, if base/diff MISSED are the same,
only display a single number.
2. Also display MISSED count as percentage of total MISSED
3. Display "same size" count in improvements/regressions table
Ahmet Ibrahim AKSOY [Fri, 16 Dec 2022 15:18:59 +0000 (16:18 +0100)]
Enable SendRecvPollSync_TcpListener_Socket Test (#79145)
Michal Strehovský [Fri, 16 Dec 2022 15:04:29 +0000 (00:04 +0900)]
Avoid touching `NameMangler` during scanning (#79738)
When we're running in a scan-only mode (such as when running trimming tests), we were still computing mangled names for things because two nodes eagerly needed them. This structures things a bit differently so that we can finish scanning without ever touching the `NameMangler`.
This is also an improvement for end user scenarios because we really don't need them during scanning (we avoid the work), and we don't have to hold on to a useless string for who knows how many GC collections.
Zoltan Varga [Fri, 16 Dec 2022 14:13:18 +0000 (09:13 -0500)]
[mono][interp] Allow passing vtypes with a single scalar field to native code using the faster code path. (#79686)
This affects types like ObjectHandleOnStack which are passed to icalls.
Šimon Rozsíval [Fri, 16 Dec 2022 12:28:57 +0000 (13:28 +0100)]
[Android] Fix SslStream.IsMutuallyAuthenticated (#79601)
* Implement CertificateValidationPal.IsLocalCertificateUsed on Android
* Enable test on Android
* Update comment
Viktor Hofer [Fri, 16 Dec 2022 11:20:37 +0000 (12:20 +0100)]
Upgrade .NET Framework queue (#79667)
* Upgrade .NET Framework queue
* Update helix-queues-setup.yml
Shay Rojansky [Fri, 16 Dec 2022 09:18:07 +0000 (10:18 +0100)]
Look up Queryable operator MethodInfos without MakeGenericMethod (#79717)
For NativeAOT compatibility, better speed.
Closes #79199
Michal Strehovský [Fri, 16 Dec 2022 09:00:44 +0000 (18:00 +0900)]
Avoid hydrating type system entities for all of CoreLib (#79732)
Instead of `foreach (TypeInModule) foreach (MethodOnType) CheckCustomAttribute` do a `foreach (CustomAttribute)`.
Saves about 30 ms wallclock time.
Radek Doulik [Fri, 16 Dec 2022 08:50:03 +0000 (09:50 +0100)]
[wasm] Improve SIMD vector equality operator (#79719)
Improve the code we emit for vector equality. Instead of using multiple shuffles, use alltrue instructions
i8x16.all_true(a: v128) -> i32
i16x8.all_true(a: v128) -> i32
i32x4.all_true(a: v128) -> i32
i64x2.all_true(a: v128) -> i32
That saves size and greatly improves performance. For example Span's SequenceEqual improves like this on chrome.
| measurement | old | new |
|-:|-:|-:|
| Span, SequenceEqual bytes | 0.0087ms | 0.0021ms |
| Span, SequenceEqual chars | 0.0174ms | 0.0042ms |
The dotnet.wasm size drops by cca 20kbytes for bench sample.
The code diff:
```
> wa-diff -d -f corlib_System_SpanHelpers_SequenceEqual_byte__byte__uintptr dotnet.old.wasm dotnet.new.wasm
...
v128.load [SIMD]
i8x16.eq [SIMD]
- local.tee $4
+ i8x16.all.true [SIMD]
- local.get $4
- i8x16.shuffle 0x00000000000000000f0e0d0c0b0a0908 [SIMD]
- local.get $4
- v128.and [SIMD]
- local.tee $4
- local.get $4
- i8x16.shuffle 0x00000000000000000000000007060504 [SIMD]
- local.get $4
- v128.and [SIMD]
- local.tee $4
- local.get $4
- i8x16.shuffle 0x00000000000000000000000000000302 [SIMD]
- local.get $4
- v128.and [SIMD]
- local.tee $4
- local.get $4
- i8x16.shuffle 0x00000000000000000000000000000001 [SIMD]
- local.get $4
- v128.and [SIMD]
- i8x16.extract.lane.u 0 [SIMD]
i32.eqz
if
...
```
Michal Strehovský [Fri, 16 Dec 2022 06:04:56 +0000 (15:04 +0900)]
Skip nested types in `EcmaModule.GetType` (#79734)
Opened this methods because I saw it in the profiler, but I think this is a correctness issue. Might help perf. Didn't measure.
Michal Strehovský [Fri, 16 Dec 2022 06:04:19 +0000 (15:04 +0900)]
Do not run recursive cycle detection on debug builds (#79735)
These add pretty significant overhead to inner loop. Leaving the code in if we ever need to debug the algorithm.
Michal Strehovský [Fri, 16 Dec 2022 06:03:17 +0000 (15:03 +0900)]
Make MethodDesc.IsStaticConstructor more efficient (#79733)
This is called a lot from reflection-dataflow-related places.
Mike McLaughlin [Fri, 16 Dec 2022 05:41:28 +0000 (21:41 -0800)]
Need to ensure the symbol table and symbol string table for the dylinker (#79728)
module is part of the core dump for the dump readers. They still need
to look up the "dyld_all_image_infos" symbol.
Jakob Botsch Nielsen [Thu, 15 Dec 2022 20:20:21 +0000 (21:20 +0100)]
JIT: Refactor gtExtractSideEffList (#79611)
Inline gtBuildCommaList (this is the only usage) and build it in the
right order to allow doing it during the walk. Also fix propagation of
GTF_DEBUG_NODE_MORPHED flag.
Fix #79543
Vladimir Sadov [Thu, 15 Dec 2022 18:56:15 +0000 (10:56 -0800)]
[NativeAOT] Thin locks (#79519)
* switch to managed thread ID in Lock
* fattening the lock
* __declspec(selectany)
* few tweaks
* fairness
* more room for thread ids
* remove CurrentNativeThreadId
* couple fixes
* fix win-arm64 build
* win-arm64 build , another try
* Apply suggestions from code review
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* fix after renaming
* do not report successful spin if thread has waited
* keep extern and undo mangling of tls_CurrentThread in asm
* use SyncTable indexer in less perf-sensitive places.
* GetNewHashCode just delegate to shared random
* Apply suggestions from code review
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* unchecked const conversion
* some refactoring comments and typos
* min number of spins in the backoff
* moved CurrentManagedThreadIdUnchecked to ManagedThreadId
* Use `-1` to report success and allow using element #1 in the SyncTable
* use threadstatic for managed thread ID
* check before calling RhGetProcessCpuCount
* use 0 as default thread ID
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
SingleAccretion [Thu, 15 Dec 2022 17:00:10 +0000 (20:00 +0300)]
Do not avoid LCL_FLDs for indirectly accessed locals (#77980)
They will have to be DNERed anyway.
SingleAccretion [Thu, 15 Dec 2022 16:57:21 +0000 (19:57 +0300)]
Disallow `IND<struct>` except as a source of `STORE_DYN_BLK` (#74784)
* Don't create IND<struct> for InitializeArray
* Don't create IND<struct> in STORE_DYN_BLK morph
* Don't create IND<struct> for FIELDs
* Simplify code
* Delete "ADDR(FIELD)" wrapping for struct args
* Fix refanytype import
* Fix fwd sub
* Fix non-null prop
* Simplify impAssignStruct
* Simplify "impNormStructVal" more
Steve Pfister [Thu, 15 Dec 2022 16:39:13 +0000 (08:39 -0800)]
[iOS][tvOS] Skip NullableTests.ClassWithDictionariesWithNullableValues (#79675)
The test is failing on device and is tracked by https://github.com/dotnet/runtime/issues/79583
Pavel Savara [Thu, 15 Dec 2022 15:52:03 +0000 (16:52 +0100)]
[wasm] fix aotProfiler init (#79651)
Zoltan Varga [Thu, 15 Dec 2022 15:43:29 +0000 (10:43 -0500)]
[mono] Initial support for unloadable ALCs (#77399)
* [mono] Add LoaderAllocator type, whose instances are used to
detect whenever a collectible ALC has managed references.
* [mono] Add an implicit GC reference between objects allocated from a collectible ALC and its LoaderAllocator object.
* [mono] Add a new hash table which is similar to MonoGHashTable, but it doesn't keep the key/value objects alive by itself.
* [mono] Add a keepalive field to some reflection objects to keep the alc alive if user code
holds a reference to them. Change the reflection hashes in MonoMemoryManager to weak hashes
so the hashes themselves don't keep the alc alive.
* Fix reflection hashes.
* [mono] Optimize the case when mono_method_get_signature_checked () is called with a non-zero context and a non-generic signature.
* Free memory manager caches.
* [mono] Store static variables with GC references in collectible alcs
on the GC heap.
Normally, static variables are stored in an array inside MonoVTable
which is registered as a GC root. For collectible alcs, this would
not work, since GC references in these arrays would keep the alc alive.
Instead, store them in arrays referenced by the LoaderAllocator object.
This assumes the static variables will no longer be accessed after
the LoaderAllocator object dies.
* Add basic unload functionality.
* Fix weak hashes.
* Free MonoJitInfos belonging to unloaded memory managers.
* Avoid returning collectible types from mono_metadata_get_shared_type ().
* Add docs.
* Fix the build.
* Fix the build.
* Disable unloading for now.
Michal Strehovský [Thu, 15 Dec 2022 15:37:00 +0000 (00:37 +0900)]
Delete MetadataType from the runtime type system (#79693)
Casts to `MetadataType` will never succeed in the runtime type system. We had some.
* Making it so that `InstantiatedType` and `CanonType` derive from `DefType` instead of `MetadataType` in the runtime type system.
* Moved some things into dotfiles.
Jan Vorlicek [Thu, 15 Dec 2022 14:06:03 +0000 (15:06 +0100)]
Fix WXORX issue in EEClass::Destruct (#79696)
While investigating failures of some coreclr tests when running in an
unloadable context, I've hit AV in EEClass::Destruct in one of the
tests. The reason is that we are missing ExecutableWriterHolder when
updating refCount on pDelegateEEClass->m_pInstRetBuffCallStub.
This change fixes it.
Adeel Mujahid [Thu, 15 Dec 2022 10:17:53 +0000 (12:17 +0200)]
Fix perf. regression caused by signed/unsigned comp (#79137)
Pavel Savara [Thu, 15 Dec 2022 09:02:55 +0000 (10:02 +0100)]
[wasm] WasmDebugLevel in samples (#79644)
* do not enable debugging is samples in release mode because it disables interp optimizations
* feedback from @thaystg and @radical
Michal Strehovský [Thu, 15 Dec 2022 05:36:17 +0000 (14:36 +0900)]
Do not generate cctor info on generic definition `MethodTable` (#79689)
This is already wrong, irrespective of #79384.