platform/upstream/dotnet/runtime.git
18 months agoIncrease number of nrgctx-trampolines (#85759)
Milos Kotlar [Thu, 4 May 2023 13:30:12 +0000 (16:30 +0300)]
Increase number of nrgctx-trampolines (#85759)

18 months agoKeep `this` alive across the native call for VTable-based source-generation (#85723)
Jeremy Koritzinsky [Thu, 4 May 2023 12:54:08 +0000 (05:54 -0700)]
Keep `this` alive across the native call for VTable-based source-generation (#85723)

* Keep `this` alive across the native call for VTable-based source-generation

18 months agoAdd negative test for creating instances of function pointers (#85709)
Jan Kotas [Thu, 4 May 2023 12:22:02 +0000 (05:22 -0700)]
Add negative test for creating instances of function pointers (#85709)

18 months agoJIT: Refactor physical promotion in preparation of generalized assignment decompositi...
Jakob Botsch Nielsen [Thu, 4 May 2023 10:11:14 +0000 (12:11 +0200)]
JIT: Refactor physical promotion in preparation of generalized assignment decomposition (#85728)

This refactors the physical promotion to make the generalized assignment
decomposition PR more manageable to review.

* Pull Replacement and ReplaceVisitor into the header
* Introduce promotiondecomposition.cpp that deals with handling
  assignments, and move relevant code from promotion.cpp to this file
* Rename StatementList -> DecompositionStatementList and unnest it
* Rename Replacement::Name -> Replacement::Description which is more fitting

Also adds some more JITDUMPs when picking promotions, but otherwise
should not affect behavior.

18 months agoEnable more ILLink tests in NativeAOT (#85651)
Vitek Karas [Thu, 4 May 2023 07:59:13 +0000 (00:59 -0700)]
Enable more ILLink tests in NativeAOT (#85651)

Product fixes:
* Fix tracking of arrays in NativeAOT
* Fix handling of arrays in ILLink

Test fixes:
* Consider reflection enabled methods as marked (even if they don't have an entrypoint, like interface methods)
* Fix where to look for ilasm
* Better handling of compiled dependenceis
* Ignore some more compiler generated code (which can't be marked as kept)

Enables several more data flow tests from linker for AOT as well.
Updates some bug links to point to runtime repo.

18 months agoExpose various floating-point intrinsics for Avx512F and Avx512DQ (#85716)
Tanner Gooding [Thu, 4 May 2023 02:44:24 +0000 (19:44 -0700)]
Expose various floating-point intrinsics for Avx512F and Avx512DQ (#85716)

* Expose GetExponent and GetMantissa for Avx512F

* Expose Reciprocal14 and ReciprocalSqrt14 for Avx512F

* Expose RoundScale and Scale for Avx512F

* Expose Fixup for Avx512F + Range and Reduce for Avx512DQ

* Ensure the RMW handling for Fixup avoids allocating a register

* Ensure the NI_AVX512F_Fixup handling in isRMWHWIntrinsic compiles

* Ensure vrange is marked as INS_Flags_IsDstDstSrcAVXInstruction

* Apply formatting patch

* Ensure vfixupimm is correctly handled in the JIT

* Ensure FixupScalar only checks the first element when doing RMW validation

18 months agoRevert "[NativeAOT] Do not strip exported symbols from executables on Apple platforms...
Jan Kotas [Thu, 4 May 2023 02:27:44 +0000 (19:27 -0700)]
Revert "[NativeAOT] Do not strip exported symbols from executables on Apple platforms (#85293)" (#85601)

This reverts commit 32ecd85d057f4c49e7972ee44c314e1ad7392192.

18 months agoFix TimeZoneInfo Perf (#85615)
Tarek Mahmoud Sayed [Thu, 4 May 2023 02:00:56 +0000 (19:00 -0700)]
Fix TimeZoneInfo Perf (#85615)

18 months agoFix GetNonGCHeapBounds (#85702)
Egor Bogatov [Thu, 4 May 2023 00:38:33 +0000 (02:38 +0200)]
Fix GetNonGCHeapBounds (#85702)

18 months ago[NativeAOT] Use inline relocs for win-arm64 INLINE_GETTHREAD (#85689)
Vladimir Sadov [Wed, 3 May 2023 23:54:24 +0000 (16:54 -0700)]
[NativeAOT] Use inline relocs for win-arm64 INLINE_GETTHREAD (#85689)

* trying to use inline reloc for win-arm64 tls

* remove arm64 INLINE_GETTHREAD_CONSTANT_POOL

* introduce INLINE_GET_TLS_VAR for win-arm64

* delete unused GetThread.asm files

18 months agoFix building ReferenceTrackerRuntime.cpp in Interop tests (#85682)
Omair Majid [Wed, 3 May 2023 23:00:11 +0000 (19:00 -0400)]
Fix building ReferenceTrackerRuntime.cpp in Interop tests (#85682)

18 months agoRename IndexOfAnyValues to SearchValues (#85686)
Miha Zupan [Wed, 3 May 2023 22:19:11 +0000 (00:19 +0200)]
Rename IndexOfAnyValues to SearchValues (#85686)

18 months agoSimplify SelectArrayIterator method (#85695)
Stephen Toub [Wed, 3 May 2023 20:51:32 +0000 (13:51 -0700)]
Simplify SelectArrayIterator method (#85695)

18 months agoAdd back IHtmlString to System.Web.HttpUtility (#85673)
Stephen Toub [Wed, 3 May 2023 20:51:09 +0000 (13:51 -0700)]
Add back IHtmlString to System.Web.HttpUtility (#85673)

* Add back IHtmlString to System.Web.HttpUtility

* Update src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
---------

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
18 months ago[wasm] Use the docker images with floating tags (#85388)
Radek Doulik [Wed, 3 May 2023 20:29:59 +0000 (22:29 +0200)]
[wasm] Use the docker images with floating tags (#85388)

We switched it temporarily to specific version around 3.1.34 bump,
so get back to floating tags again

18 months agoFix AreFlagsSetToZeroCmp and AreFlagsSetForSignJumpOpt to not consider unsupported...
Tanner Gooding [Wed, 3 May 2023 19:27:49 +0000 (12:27 -0700)]
Fix AreFlagsSetToZeroCmp and AreFlagsSetForSignJumpOpt to not consider unsupported formats (#85714)

* Fix AreFlagsSetToZeroCmp to not consider unsupported formats

* Also fix AreFlagsSetForSignJumpOpt

18 months agoJIT: Improve block unrolling, enable AVX-512 (#85501)
Egor Bogatov [Wed, 3 May 2023 19:19:44 +0000 (21:19 +0200)]
JIT: Improve block unrolling, enable AVX-512 (#85501)

18 months ago[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/emsdk...
dotnet-maestro[bot] [Wed, 3 May 2023 19:05:16 +0000 (21:05 +0200)]
[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/emsdk dotnet/hotreload-utils (#85704)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
18 months agoDelete `GT_FIELD` (#85568)
SingleAccretion [Wed, 3 May 2023 18:30:49 +0000 (21:30 +0300)]
Delete `GT_FIELD` (#85568)

* Delete GT_FIELD

* GenTreeField -> GenTreeFieldAddr

18 months agoAdd new SafeHandleMarshaller type to provide out-of-generator marshalling support...
Jeremy Koritzinsky [Wed, 3 May 2023 18:28:53 +0000 (11:28 -0700)]
Add new SafeHandleMarshaller type to provide out-of-generator marshalling support. (#85419)

Fixes #74035

We can't remove the built-in marshalling support from the generator yet, but once the out-of-band packages we ship don't support .NET 6. we can remove the built-in support that emits the marshalling code in the stub. I believe the .NET 9 packages won't support .NET 6, so once we snap for .NET 9 and update how we ship the packages, we can clean this up.

This PR also adds a requested feature to the SafeHandle marshaller: If the call to native code fails, we'll call Dispose() on the pre-allocated handle to avoid leaking it to the finalizer queue.

18 months agoChange default CFB feedback size for DES
Kevin Jones [Wed, 3 May 2023 18:21:22 +0000 (14:21 -0400)]
Change default CFB feedback size for DES

The previous default value, 64, doesn't work for DES because .NET only supports CFB8 for DES. Further, this more closely aligns the behavior of DES.Create() from .NET Framework to .NET, as DESCryptoServiceProvider also had a default feedback size of 8.

This change sets the default feedback size to 8, which is the only value that worked anyway, so it isn't a breaking change.

Types derived from DES will continue to have a default feedback size of 64, which is the default value for .NET Framework derived types. We are only changing the default for DESImplementation returned by DES.Create().

18 months agoRemove S.Sec.Crypto.Algorithms package dependency (#85701)
Viktor Hofer [Wed, 3 May 2023 18:00:09 +0000 (20:00 +0200)]
Remove S.Sec.Crypto.Algorithms package dependency (#85701)

* Remove S.Sec.Crypto.Algorithms package dependency

Contributes to https://github.com/dotnet/runtime/issues/85641

System.Security.Cryptography.Algorithms/4.3.1 is being referenced in a
few .NET Framework builds. The reference to that package is undesirable
as it brings in the entire netstandard 1.x dependency graph.

The only type used from that package is IncrementalHash which isn't
available as a public API in .NET Framework before 4.7.1. Because of
that, polyfill the netfx code in with minor changes to the source to
make the analyzers happy.

18 months ago[browser] es6 test main (#85542)
Pavel Savara [Wed, 3 May 2023 17:43:05 +0000 (19:43 +0200)]
[browser] es6 test main (#85542)

18 months agoDirectory.Build.props: restore previous behavior when targetting 'other' TargetOSes...
Tom Deseyn [Wed, 3 May 2023 17:13:51 +0000 (19:13 +0200)]
Directory.Build.props: restore previous behavior when targetting 'other' TargetOSes from Windows. (#85246)

18 months agoClean up dead code in ILCompiler targets (#85618)
Sven Boemer [Wed, 3 May 2023 16:46:09 +0000 (09:46 -0700)]
Clean up dead code in ILCompiler targets (#85618)

- The logic for referencing ILCompiler as an MSBuild SDK should no longer be needed because we use PackageReference.
- IlcCalledViaPackage should always be true

18 months agoArm64: Add back the annotation in JitDisasm with the local var (+offset) (#85671)
Kunal Pathak [Wed, 3 May 2023 15:05:11 +0000 (08:05 -0700)]
Arm64: Add back the annotation in JitDisasm with the local var (+offset) (#85671)

* track 2nd variable offset

* display frame references for 2nd variable

* revert a change

* revert a change

* jit formnat

* fix after merge-conflict

* Consolidate ResetLclILoffs()

* fix gcc error

* fix gcc errors in arm/arm64

18 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230503.3 (#85703)
dotnet-maestro[bot] [Wed, 3 May 2023 14:32:10 +0000 (16:32 +0200)]
Update dependencies from https://github.com/dotnet/arcade build 20230503.3 (#85703)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
18 months agoMove DispatchMap pointer to MethodTable (#85698)
Michal Strehovský [Wed, 3 May 2023 13:49:18 +0000 (22:49 +0900)]
Move DispatchMap pointer to MethodTable (#85698)

Sending this for consideration. The old approach also had an advantage. Wouldn't be the end of the world if we keep that.

Before this PR, accessing dispatch map involved:
* Reading optional fields to find the field with the right tag
* The optional field contained an integer index into a table
* The index was used to index into a dispatch map table to find a pointer to the actual dispatch map
* We then followed the pointer to get to the dispatch map.

The advantage of this scheme is smaller working set (MethodTable is smaller), but this assumes the MethodTable has other optional fields (because we still need a pointer to the optional fields). Turns out most MethodTables only need optional fields pointer because of the dispatch map and if we move them to MethodTable, we no longer need an optional field pointer.

This PR simply moves the dispatch map pointer to MethodTable.

I'm seeing another 15 kB saving on BasicMinimalApi. Plus the code looks simpler.

18 months agoJIT: Fix liveness for partial defs of parent locals (#85654)
Jakob Botsch Nielsen [Wed, 3 May 2023 13:06:54 +0000 (15:06 +0200)]
JIT: Fix liveness for partial defs of parent locals (#85654)

Partial defs in liveness are modelled as full uses of all fields and
then a full def of the entire local. The logic that handled fields
directly got that right, but the logic that handled parent locals did
not.

For example, for IR like

```
------------ BB18 [045..046), preds={BB16} succs={BB19}

***** BB18
STMT00096 ( INL10 @ 0x01F[E-] ... ??? ) <- INL04 @ ??? <- INLRT @ 0x045[E-]
N003 (  5,  4) [000403] -A------R--                         ▌  ASG       byref
N002 (  3,  2) [000402] D------N---                         ├──▌  LCL_VAR   byref  V73 tmp45
N001 (  1,  1) [000401] -----------                         └──▌  LCL_VAR   long   V43 tmp15

***** BB18
STMT00097 ( INL10 @ 0x026[E-] ... ??? ) <- INL04 @ ??? <- INLRT @ 0x045[E-]
N003 (  5,  4) [000407] -A------R--                         ▌  ASG       int
N002 (  3,  2) [000406] D------N---                         ├──▌  LCL_VAR   int    V74 tmp46
N001 (  1,  1) [000405] -----------                         └──▌  LCL_VAR   int    V42 tmp14

***** BB18
STMT00072 ( INL04 @ 0x073[--] ... ??? ) <- INLRT @ 0x045[E-]
N007 ( 14, 14) [000627] -A---------                         ▌  COMMA     void
N003 (  7,  7) [000623] -A------R--                         ├──▌  ASG       byref
N002 (  3,  4) [000621] U------N---                         │  ├──▌  LCL_FLD   byref (P) V12 loc3         [+16]
                                                            │  ├──▌    ref    field V12._managedArray (fldOffset=0x0) -> V57 tmp29
                                                            │  ├──▌    long   field V12._allocatedMemory (fldOffset=0x8) -> V58 tmp30
                                                            │  ├──▌    byref  field V12._reference (fldOffset=0x10) -> V59 tmp31
                                                            │  ├──▌    int    field V12._length (fldOffset=0x18) -> V60 tmp32
N001 (  3,  2) [000622] -----------                         │  └──▌  LCL_VAR   byref  V73 tmp45
N006 (  7,  7) [000626] -A------R--                         └──▌  ASG       int
N005 (  3,  4) [000624] U------N---                            ├──▌  LCL_FLD   int   (P) V12 loc3         [+24]
                                                               ├──▌    ref    field V12._managedArray (fldOffset=0x0) -> V57 tmp29
                                                               ├──▌    long   field V12._allocatedMemory (fldOffset=0x8) -> V58 tmp30
                                                               ├──▌    byref  field V12._reference (fldOffset=0x10) -> V59 tmp31
                                                               ├──▌    int    field V12._length (fldOffset=0x18) -> V60 tmp32
N004 (  3,  2) [000625] -----------                            └──▌  LCL_VAR   int    V74 tmp46
```

we would see

```
BB18 USE(6)={V58 V57 V59 V60 V42 V43        }
     DEF(2)={                        V73 V74}
```

which is obviously incorrect as V57-V60 are all defined under this
model. This would lead to an assert in SSA since SSA did treat this as a
def.

18 months agoSupport building a mono-based .NET Runtime on x64 (#68424)
Omair Majid [Wed, 3 May 2023 13:05:49 +0000 (09:05 -0400)]
Support building a mono-based .NET Runtime on x64 (#68424)

We now have some architectures (eg, s390x and ppc64le) that produce a .NET runtime that looks and feels like any other .NET runtime, except it's using Mono instead of CoreCLR under the hood.

However, it's only possible to produce this Mono-based .NET runtime on s390x/ppc64le. That makes it hard to test this set up on other architectures. Issues that affect the mono build on all architectures - such as #66594 become harder to fix and verify because of this unnecessary architecture requirement.

Fix that by adding a flag to the top-level build.sh (and also to the msbuild projects) to make it possible to produce a .NET runtime with Mono on any platform.

The default configuration is unchanged: we still produced CoreCLR-based .NET runtime on x64 and a Mono-based runtime on s390x/ppc64le.

Fixes: #62440

18 months ago[browser][non-icu] `HybridGlobalization` faster encoding for change case. (#85516)
Ilona Tomkowicz [Wed, 3 May 2023 12:47:16 +0000 (14:47 +0200)]
[browser][non-icu] `HybridGlobalization` faster encoding for change case. (#85516)

* This speeds it up ~twice.

* JS's decoder always changes the codepoint.

* @kg's optimization idea.

18 months agoAllocate Array.Empty<> on a frozen segment (NonGC heap) (#85559)
Egor Bogatov [Wed, 3 May 2023 09:41:34 +0000 (11:41 +0200)]
Allocate Array.Empty<> on a frozen segment (NonGC heap) (#85559)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
18 months agoShuffle some `MethodTable` flags (#85634)
Michal Strehovský [Wed, 3 May 2023 07:05:50 +0000 (16:05 +0900)]
Shuffle some `MethodTable` flags (#85634)

* `IDynamicInterfaceCastableFlag` cannot be set on types that have a component size, so move it from the valuable location in `Flags` to `FlagsEx`.
* Move `HasSealedVTableEntriesFlag` from rare flags to flags. This flag is not so rare. All async state machine types set it, for example.
* Delete `IsAbstractClassFlag`. This was introduce in .NET Native for `GetUninitializedObject` since accessing `Type.IsAbstract` could trigger a `MissingMetadataException` there. We got rid of that concept in NativeAOT because it cannot be reconciled with ILLink trimming. Rewrite the code to use `Type.IsAbstract`.

Saves 15 kB on BasicMinimalApis, which is nice. Also makes things faster since we avoid reading optional fields and rare flags.

18 months agoAvoid S.R.I.RuntimeInformation package dependency (#85642)
Viktor Hofer [Wed, 3 May 2023 06:11:29 +0000 (08:11 +0200)]
Avoid S.R.I.RuntimeInformation package dependency (#85642)

Contributes to https://github.com/dotnet/runtime/issues/85641

System.Runtime.InteropServices.RuntimeInformation/4.3.0 is being
referenced in a few .NET Framework builds. The reference to that package
is undesirable as it brings in the entire netstandard1.x dependency
graph.

Instead, use System.Environment.OSVersion which returns "Microsoft
Windows NT" on .NET Framework, Mono and .NETCoreApp runtimes.

18 months agoImplement Micrososoft.Bcl.Cryptography without System.Security.Cryptography.Algorithm...
Kevin Jones [Wed, 3 May 2023 06:05:42 +0000 (02:05 -0400)]
Implement Micrososoft.Bcl.Cryptography without System.Security.Cryptography.Algorithms (#85683)

* Implement Micrososoft.Bcl.Cryptography without System.Security.Cryptography.Algorithms

* Assert data written

* Call Initialize on the right thing

18 months agofix mistake in timespan calculation (#85677)
Pavel Savara [Wed, 3 May 2023 05:32:39 +0000 (07:32 +0200)]
fix mistake in timespan calculation (#85677)

18 months ago[wasm] Use monotonic clock in wasm, emscripten has it now (#85660)
Katelyn Gadd [Wed, 3 May 2023 04:12:02 +0000 (21:12 -0700)]
[wasm] Use monotonic clock in wasm, emscripten has it now (#85660)

Use monotonic clock on wasm, emscripten added it after we initially disabled it for that target
Update mono-os-mutex.h to note that we have working monotonic clock in wasm now (but not wasi, because of some other dependencies)

18 months agoSkip stp/ldp only for unwind portion of prolog/epilog (#85657)
Kunal Pathak [Wed, 3 May 2023 03:28:18 +0000 (20:28 -0700)]
Skip stp/ldp only for unwind portion of prolog/epilog (#85657)

* Skip stp/ldp only for unwind portion of prolog/epilog

* Rename unwindarm.cpp -> unwindarmarch.cpp

* review feedback

18 months ago[JIT] ARM64 - Fix Assertion failed 'node->OperIs(GT_DIV, GT_UDIV, GT_MOD)' during...
Will Smith [Wed, 3 May 2023 03:06:04 +0000 (20:06 -0700)]
[JIT] ARM64 - Fix Assertion failed 'node->OperIs(GT_DIV, GT_UDIV, GT_MOD)' during 'Lowering nodeinfo' (#85664)

* Rename LowerConstIntDivOrMode to TryLowerConstIntDivOrMod with an out parameter for the next node to lower

* Add test case

* Simplify test

* Add extra assert

18 months ago[main] Update dependencies from dotnet/roslyn-analyzers (#85518)
dotnet-maestro[bot] [Wed, 3 May 2023 02:49:09 +0000 (21:49 -0500)]
[main] Update dependencies from dotnet/roslyn-analyzers (#85518)

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230427.3

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23225.2 -> To Version 3.3.5-beta1.23227.3

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230501.1

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23225.2 -> To Version 3.3.5-beta1.23251.1

* Fix another CA1854 warning

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Buyaa Namnan <bunamnan@microsoft.com>
18 months ago[main] Update dependencies from dotnet/llvm-project dotnet/runtime dotnet/xharness...
dotnet-maestro[bot] [Wed, 3 May 2023 02:47:02 +0000 (21:47 -0500)]
[main] Update dependencies from dotnet/llvm-project dotnet/runtime dotnet/xharness dotnet/hotreload-utils dotnet/cecil (#85538)

* Update dependencies from https://github.com/dotnet/llvm-project build 20230428.1

runtime.linux-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.win-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.win-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.ObjWriter
 From Version 14.0.0-alpha.1.23224.3 -> To Version 14.0.0-alpha.1.23228.1

* Update dependencies from https://github.com/dotnet/runtime build 20230501.1

Microsoft.NET.ILLink.Tasks , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , System.Text.Json
 From Version 8.0.0-preview.4.23221.1 -> To Version 8.0.0-preview.5.23251.1

* Update dependencies from https://github.com/dotnet/xharness build 20230502.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.23228.3 -> To Version 1.0.0-prerelease.23252.1

* Update dependencies from https://github.com/dotnet/hotreload-utils build 20230501.2

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 8.0.0-alpha.0.23226.3 -> To Version 8.0.0-alpha.0.23251.2

* Update dependencies from https://github.com/dotnet/cecil build 20230502.1

Microsoft.DotNet.Cecil
 From Version 0.11.4-alpha.23224.2 -> To Version 0.11.4-alpha.23252.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
18 months agoAdd `count` and `sum` to Histogram for System.Diagnostics.Metrics (#85595)
kkeirstead [Wed, 3 May 2023 02:27:07 +0000 (19:27 -0700)]
Add `count` and `sum` to Histogram for System.Diagnostics.Metrics (#85595)

18 months ago[wasi] Disable failing tests to get CI green (#85681)
Ankit Jain [Wed, 3 May 2023 02:14:58 +0000 (22:14 -0400)]
[wasi] Disable failing tests to get CI green (#85681)

* [wasi] Disable failing tests in System.Runtime.Serialization.Xml.Tests

Issue: https://github.com/dotnet/runtime/issues/82967, and https://github.com/dotnet/runtime/issues/73961

* [wasi] Disable failing test

System.Runtime.Serialization.Xml.ReflectionOnly.Tests:DataContractSerializerTests.DCS_MemoryStream_Deserialize_CompatibleWithFullFramework

Issue: https://github.com/dotnet/runtime/issues/73961

* [wasi] Disable tests failing depending on tmp fs

System.Runtime.Serialization.Xml.ReflectionOnly.Tests, and System.Runtime.Serialization.Xml.Tests
Test: DataContractSerializerTests.DCS_FileStreamSurrogate

Issue: https://github.com/dotnet/runtime/issues/85690

18 months ago[wasm] WBT: Renable blazor lazy loading test (#85685)
Ankit Jain [Wed, 3 May 2023 01:18:01 +0000 (21:18 -0400)]
[wasm] WBT: Renable blazor lazy loading test (#85685)

.. and fix test to work for non-webcil case.

Fixes issue: https://github.com/dotnet/runtime/issues/85354

18 months agooffers the synchronous part of start and stop in IHostedService to run concurrently...
Badre BSAILA [Wed, 3 May 2023 01:00:40 +0000 (03:00 +0200)]
offers the synchronous part of start and stop in IHostedService to run concurrently (#85191)

* offers the synchronous part of start and stop in IHostedService to run concurrently

* pass cancellation token to Task.Run

* fix cancellation token  issue and eliminate a lambda

18 months ago[wasm] Disable some System.Net.Http.Functional.Tests (#85678)
Ankit Jain [Wed, 3 May 2023 00:58:53 +0000 (20:58 -0400)]
[wasm] Disable some System.Net.Http.Functional.Tests (#85678)

.. for AOT.

https://github.com/dotnet/runtime/issues/71877

18 months agoFix add/edit for generic methods scenario (#85655)
Aaron Robinson [Tue, 2 May 2023 21:37:05 +0000 (14:37 -0700)]
Fix add/edit for generic methods scenario (#85655)

Ensure the canonical MethodTable is always used.

18 months ago[mono] Implement Vector128.Shuffle using tbl1 on arm64. (#85553)
Zoltan Varga [Tue, 2 May 2023 21:04:55 +0000 (23:04 +0200)]
[mono] Implement Vector128.Shuffle using tbl1 on arm64. (#85553)

18 months agoJIT: Fix modelling of exceptions thrown by INDEX_ADDR (#85646)
Jakob Botsch Nielsen [Tue, 2 May 2023 20:28:23 +0000 (22:28 +0200)]
JIT: Fix modelling of exceptions thrown by INDEX_ADDR (#85646)

18 months agoMove assignment rationalization to before the late helper expansion phases (#85585)
SingleAccretion [Tue, 2 May 2023 20:09:53 +0000 (23:09 +0300)]
Move assignment rationalization to before the late helper expansion phases (#85585)

* Flags dump for STOREIND

* gtNewAssignNode assert

* Call morphing

* GenTree::GetLayout fixup

* If Conversion

* Tail duplication

* Costing

* Move assignment rationalization before GC Poll insertion

* Block morphing (part 1)

* Block morphing: switch dst<->src around

* Finish block morphing

* Helper expansion phases

* Fix formatting

18 months agoenable ntlm tests on RHEL7 again (#85633)
Tomas Weinfurt [Tue, 2 May 2023 19:50:39 +0000 (12:50 -0700)]
enable ntlm tests on RHEL7 again (#85633)

18 months ago[wasi] Combine `main` function for the default and single file bundle (#85617)
Ankit Jain [Tue, 2 May 2023 18:39:46 +0000 (14:39 -0400)]
[wasi] Combine `main` function for the default and single file bundle (#85617)

.. case.

This was prompted by https://github.com/dotnet/runtime/issues/85616
where running `Invariant.Tests` breaks with:

```
Running /root/helix/work/correlation/wasmtime/wasmtime --dir=. --env=DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true dotnet.wasm WasmTestRunner managed/Invariant.Tests.dll -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing

Unhandled Exception:
System.ArgumentException: Invalid argument 'managed/Invariant.Tests.dll'.
   at SimpleWasmTestRunner.Main(String[] args)
   at SimpleWasmTestRunner.<Main>(String[] args)
```

- This broke because of a recent change due to which setting
  `InvariantGlobalization=true` meant `WasmBuildNative=true`
- But this did not trigger single file bundle
- And the build ended up relinking a dotnet.wasm but using the
  single-file bundle `main` function.

Instead, we combine the two main functions and switch between the
behavior depending on compile time defines.

Fixes https://github.com/dotnet/runtime/issues/85616

18 months agoRemove SelfContained from pack (#85636)
Marek Fišera [Tue, 2 May 2023 18:38:27 +0000 (20:38 +0200)]
Remove SelfContained from pack (#85636)

18 months agoImplement ICorProfilerInfo14::GetNonGCHeapBounds (#85434)
Egor Bogatov [Tue, 2 May 2023 18:10:44 +0000 (20:10 +0200)]
Implement ICorProfilerInfo14::GetNonGCHeapBounds (#85434)

18 months ago[main] Update dependencies from dnceng/internal/dotnet-optimization (#85470)
dotnet-maestro[bot] [Tue, 2 May 2023 17:27:38 +0000 (19:27 +0200)]
[main] Update dependencies from dnceng/internal/dotnet-optimization (#85470)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
18 months agoRemove unnecessary dependency in M.Bcl.TimeProvider (#85639)
Viktor Hofer [Tue, 2 May 2023 16:48:09 +0000 (18:48 +0200)]
Remove unnecessary dependency in M.Bcl.TimeProvider (#85639)

see https://github.com/dotnet/runtime/pull/84235/files#r1182370236

18 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230426.4 (#85459)
dotnet-maestro[bot] [Tue, 2 May 2023 16:39:55 +0000 (18:39 +0200)]
Update dependencies from https://github.com/dotnet/arcade build 20230426.4 (#85459)

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.23224.5 -> To Version 8.0.0-beta.23226.4

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
18 months agoAddress misc feedback for config binder implementation (#84737)
Layomi Akinrinade [Tue, 2 May 2023 15:18:41 +0000 (11:18 -0400)]
Address misc feedback for config binder implementation (#84737)

* Move type graph specs into subfolder

* Address misc feedback for config binder implementation

18 months agoRemove unnecessary dependencies in System.Text.Json (#85640)
Viktor Hofer [Tue, 2 May 2023 14:28:08 +0000 (16:28 +0200)]
Remove unnecessary dependencies in System.Text.Json (#85640)

* Remove unnecessary dependencies in System.Text.Json

The `System.ValueTuple` dependency is already provided in-box in .NET Standard and therefore the down-level applicable package doesn't need to be referenced.

* Update System.Text.Json.csproj

* Update Versions.props

18 months ago[JIT] X64 Fix - Handle 'imul' instruction variants to determine if a register was...
Will Smith [Tue, 2 May 2023 14:22:58 +0000 (07:22 -0700)]
[JIT] X64 Fix - Handle 'imul' instruction variants to determine if a register was written to (#85610)

18 months ago[mono][debugger] Support step over and pause multiple times in same line but differen...
Thays Grazia [Tue, 2 May 2023 12:51:17 +0000 (09:51 -0300)]
[mono][debugger] Support step over and pause multiple times in same line but different columns (#85484)

* Support step over and pause multiple times in a like like this: for (int i = 0; i < 10; i++)

* Fix name on wasm code.

* Adding support to new message MDBGPROT_CMD_STACK_FRAME_GET_COUNT

* Changing position of create_file_to_check_memory_address function

* Adding another command   MDBGPROT_CMD_STACK_FRAME_GET_PARAMETERS_COUNT

* Fix arguments count

18 months agoEnsure zroSimd12Elm3 is explicitly nulled out (#85625)
Tanner Gooding [Tue, 2 May 2023 11:34:35 +0000 (04:34 -0700)]
Ensure zroSimd12Elm3 is explicitly nulled out (#85625)

18 months agoComWrappers test that allocate object can't inline (#85583)
Aaron Robinson [Tue, 2 May 2023 10:35:24 +0000 (03:35 -0700)]
ComWrappers test that allocate object can't inline (#85583)

* ComWrappers test that allocate object can't inline

There are some JIT stress settings that aggressively
inline functions, regardless of size/complexity. This
inlining can perturb the subtle GC assumptions
inherent in the COM wrappers tests.

18 months agoJIT: Prefer block copies for unenregisterable locals even with GC pointers (#85620)
Jakob Botsch Nielsen [Tue, 2 May 2023 10:29:09 +0000 (12:29 +0200)]
JIT: Prefer block copies for unenregisterable locals even with GC pointers (#85620)

This comment seems outdated/wrong, the backend's block copy strategy
when GC pointers are involved is highly tuned and often no helper is
necessary at all.

18 months ago[mono][jit] ArmBase methods are now intrinsic. (#85458)
Jan Dupej [Tue, 2 May 2023 09:19:46 +0000 (11:19 +0200)]
[mono][jit] ArmBase methods are now intrinsic. (#85458)

* ArmBase methods are now intrinsic.

* Arm.Yield maps to a NOP.

* Adding hint operation for arm64's yield.

18 months agoAllow emitting function pointers in TypeSystemMetadataEmitter (#85626)
Michal Strehovský [Tue, 2 May 2023 06:41:32 +0000 (15:41 +0900)]
Allow emitting function pointers in TypeSystemMetadataEmitter (#85626)

This is handled. It's unclear to me why it was disallowed.

Unfortunately, this means `IlcGenerateMstatFile` is going to be completely broken in .NET 8 Preview 4.

18 months agoMake generic composition information more efficient (#85623)
Michal Strehovský [Tue, 2 May 2023 06:40:30 +0000 (15:40 +0900)]
Make generic composition information more efficient (#85623)

Before this PR, we tracked information about generic composition of a `MethodTable` this way:

* Each generic instance `MethodTable` had a pointer to the generic definition `MethodTable`.
* Each generic instance `MethodTable` had a pointer to its generic composition: a variable sized data structure that had a small header (number of elements, a flag whether it's variant), followed by pointers to `MethodTable`s of components, optionally followed by variance information for each argument.

This works, but it's not particularly efficient, especially in light of some facts that didn't exist at the time this scheme was introduced.

In particular:

* The number of generic parameters can be obtained from the generic definition, no need to duplicate it into instances.
* The variance information can be obtained from the generic definition, no need to duplicate it into instances.
* It makes no sense to indirect to a single-element list - the list can be bypassed if arity is 1.

This PR addresses all of the above.

Saves about 0.5% in size for BasicMinimalApi, improves startup (the composition no longer needs to be dehydrated because it's relative pointers now), and improves working set (the composition stuff accounted for 100 kB of private dehydrated working set in BasicMinimalApi).

18 months agoFix new warnings found with CA1854 improvement. (#85613)
Buyaa Namnan [Tue, 2 May 2023 04:25:00 +0000 (21:25 -0700)]
Fix new warnings found with CA1854 improvement. (#85613)

* Fix new warnings found with CA1854 improvement

18 months agoFix Helix command lines error code handling (#85622)
Bruce Forstall [Tue, 2 May 2023 04:13:17 +0000 (21:13 -0700)]
Fix Helix command lines error code handling (#85622)

The `HelixCommandLines` group must not call `exit` on the script
or the HelixPostCommands and potentially other injected commands
will not run.

Instead, figure out what the exit code should be, and set it properly
(as `ERRORLEVEL` on Windows or `$?` on non-Windows).

Fixes #85621

18 months agoCleanup some xarch emit logic (#85536)
Tanner Gooding [Tue, 2 May 2023 00:34:35 +0000 (17:34 -0700)]
Cleanup some xarch emit logic (#85536)

* Ensure floating-point codegen uses the VEX aware path

* Fix `IF_RRW_RRW_CNS` to be `IF_RWR_RRD_CNS`

* Fixup emitfmtsxarch.h to have a more consistent layout

* Allow querying the scheduling info for an insFormat

* Ensure the new insFormats are handled

* Ensure we consistently use `emitInsModeFormat`

* Ensure instructions which write to a mask register are EVEX only

* Improve REX.W handling for EVEX only instructions

* Ensure that instructions use the right update mode and tuple type

* Apply formatting patch

* Ensure DstSrcSrc is still handled correctly

* Ensure BLSI/BLSR are still handled in emitOutputAM

* Use static_assert_no_msg

* Fixing the disassembly for IF_RRW_SHF

* Fixing the IF check for shld/shrd on x86

* Use the correct name: inst_RV_TT_IV

* Ensure the 4 operand insFormats include the necessary constant

* Resolve an insFormat check on x86

* Ensure other SIMD code paths are VEX aware

* Improve throughput by using a less expensive emitSizeOfInsDsc

* Apply formatting patch

* Ensure emitSizeOfInsDsc_CNS is used for RWR_RRD_*RD_CNS

* Ensure genSimd12UpperClear uses `andps` for the pre-SSE4.1 path

18 months agoDependencyGraphViewer: Fix catastrophic designer fail for NodeForm (#84539)
Mitch Capper (they, them) [Mon, 1 May 2023 22:42:06 +0000 (15:42 -0700)]
DependencyGraphViewer: Fix catastrophic designer fail for NodeForm (#84539)

Fixes experimental designer failure due to having multiple classes in
NodeForm.cs.

Fixes #84538

18 months agoSupport encoding `TypedReference`s in signatures. (#85360)
Theodore Tsirpanis [Mon, 1 May 2023 22:26:58 +0000 (01:26 +0300)]
Support encoding `TypedReference`s in signatures. (#85360)

* Add `SignatureTypeEncoder.TypedReference`.

* Stop failing when encoding a `PrimitiveTypeCode.TypedReference`.
Since we have a dedicated method for typed references, there is no reason to prohibit it.

* Update the documentation of `SignatureTypeEncoder`.

Co-authored-by: Buyaa Namnan <buyankhishig.namnan@microsoft.com>
18 months agoRemove a RequiresProcessIsolation which is not required. (#85606)
Zoltan Varga [Mon, 1 May 2023 22:14:38 +0000 (00:14 +0200)]
Remove a RequiresProcessIsolation which is not required. (#85606)

18 months agoFix typo in SafeHandle.cs (#85607)
Edouard Choinière [Mon, 1 May 2023 21:33:58 +0000 (17:33 -0400)]
Fix typo in SafeHandle.cs (#85607)

Fixes #85593
Change `providng` to `providing` in a comment.

18 months agoSave interfaces implementations and nested types (#85596)
Buyaa Namnan [Mon, 1 May 2023 20:52:13 +0000 (13:52 -0700)]
Save interfaces implementations and nested types (#85596)

* Save interfaces implemented and nested type

18 months agoNativeAOT instruction for NixOS (#81485)
WhiteBlackGoose [Mon, 1 May 2023 20:30:06 +0000 (22:30 +0200)]
NativeAOT instruction for NixOS (#81485)

* NativeAOT instruction for NixOS

* Update compiling.md

* Reworded

* Update src/coreclr/nativeaot/docs/compiling.md

---------

Co-authored-by: Andy Gocke <angocke@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
18 months agoEnsure that IF_*WR_RRD formats support 4-byte SIMD instructions (#85594)
Tanner Gooding [Mon, 1 May 2023 20:22:55 +0000 (13:22 -0700)]
Ensure that IF_*WR_RRD formats support 4-byte SIMD instructions (#85594)

* Ensure that IF_*WR_RRD formats support 4-byte SIMD instructions

* Apply formatting patch

18 months agoCompare host using OrdinalIgnoreCase instead of InvariantCultureIgnoreCase (#85574)
Gérald Barré [Mon, 1 May 2023 19:43:38 +0000 (15:43 -0400)]
Compare host using OrdinalIgnoreCase instead of InvariantCultureIgnoreCase (#85574)

18 months agoJIT: one phi arg per pred (#85546)
Andy Ayers [Mon, 1 May 2023 18:56:14 +0000 (11:56 -0700)]
JIT: one phi arg per pred (#85546)

Revise SSA to add one phi arg per pred instead of one phi arg per ssa def.
This unlocks some cases for redundant branch opts.

In some pathological cases we may see extremely long phi arg lists. Will
keep an eye out for that and perhaps modify the strategy if we end up
with hundreds or thousands of phi args.

Addresses an issue noted in #48115.

18 months agoReenable a test which doesn't seem to fail any more. (#85576)
Zoltan Varga [Mon, 1 May 2023 18:34:58 +0000 (20:34 +0200)]
Reenable a test which doesn't seem to fail any more. (#85576)

Re: https://github.com/dotnet/runtime/pull/82663.

18 months agoUpdate dependencies from https://github.com/dotnet/roslyn build 20230426.15 (#85460)
dotnet-maestro[bot] [Mon, 1 May 2023 18:20:45 +0000 (13:20 -0500)]
Update dependencies from https://github.com/dotnet/roslyn build 20230426.15 (#85460)

18 months agoSet lvSingleDef for non TYP_REF locals (#85398)
Michał Petryka [Mon, 1 May 2023 17:54:00 +0000 (19:54 +0200)]
Set lvSingleDef for non TYP_REF locals (#85398)

* Set lvSingleDef for non TYP_REF locals

* Apply suggestions from code review

Co-authored-by: Andy Ayers <andya@microsoft.com>
* Rewrite an if

---------

Co-authored-by: Andy Ayers <andya@microsoft.com>
18 months agoFix trimmability issues in Quic test (#85579)
Michal Strehovský [Mon, 1 May 2023 16:58:14 +0000 (01:58 +0900)]
Fix trimmability issues in Quic test (#85579)

18 months agoEnable regex to use IndexOf(..., OrdinalIgnoreCase) for prefix searching (#85438)
Stephen Toub [Mon, 1 May 2023 16:56:20 +0000 (12:56 -0400)]
Enable regex to use IndexOf(..., OrdinalIgnoreCase) for prefix searching (#85438)

As one of its many ways of finding the next possible match starting location, Regex recognizes a string known to start the expression and uses IndexOf to find it.  With this change, it can also do so for OrdinalIgnoreCase.  With improvements to IndexOf(..., OrdinalIgnoreCase), this now yields significantly faster searches through longer inputs, in addition to leading to simpler code in source generated regexes.

18 months agofix: Change severity for SYSLIB1006 to Info instead of warning (#85581)
Shreyas Jejurkar [Mon, 1 May 2023 15:45:46 +0000 (21:15 +0530)]
fix: Change severity for SYSLIB1006 to Info instead of warning (#85581)

18 months agoRevert "[mono][llvm] Enable the cold calling conv on osx/linux. (#83519)" (#85554)
Zoltan Varga [Mon, 1 May 2023 15:42:23 +0000 (17:42 +0200)]
Revert "[mono][llvm] Enable the cold calling conv on osx/linux. (#83519)" (#85554)

This reverts commit a2acc6c6529fc25ed350b239efe459b08b0310a6.

Revert this as it causes an assert on osx.

18 months agoImprove vectorization of IndexOf(chars, StringComparison.OrdinalIgnoreCase) (#85437)
Stephen Toub [Mon, 1 May 2023 14:36:52 +0000 (10:36 -0400)]
Improve vectorization of IndexOf(chars, StringComparison.OrdinalIgnoreCase) (#85437)

* Improve vectorization of IndexOf(chars, StringComparison.OrdinalIgnoreCase)

Use the same general "Algorithm 1: Generic SIMD" that we do for StringComparison.Ordinal, adapter for OrdinalIgnoreCase.

* Fix duplicate local

18 months agoDo not set pre-decided consecutive registers as busy (again) (#85566)
Kunal Pathak [Mon, 1 May 2023 12:29:50 +0000 (05:29 -0700)]
Do not set pre-decided consecutive registers as busy (again) (#85566)

18 months agoFix processing of x86 test results (#82301)
SwapnilGaikwad [Mon, 1 May 2023 12:29:28 +0000 (13:29 +0100)]
Fix processing of x86 test results (#82301)

18 months agoRemove cached Type instances (#85557)
Huo Yaoyuan [Mon, 1 May 2023 11:57:34 +0000 (19:57 +0800)]
Remove cached Type instances (#85557)

* Remove the Type cache in Convert

* Remove Type cache in MaskedTextProvider

* Remove Type cache in DataSetUtil

* Remove Type cache in ResourceManager

* Remove Type cache in XmlBinaryReader

* Remove Type cache in XsltConvert

* Remove Type cache in DataTypeImplementation

* Introduce a local variable for typeof(string)

18 months agoTranslate AV in RhpByRefAssignRef to NullReferenceException (#85575)
Michal Strehovský [Mon, 1 May 2023 11:56:46 +0000 (20:56 +0900)]
Translate AV in RhpByRefAssignRef to NullReferenceException (#85575)

Fixes dotnet/runtimelab#197.

Ran into this again when curiosity made my try a newly added JIT test with NativeAOT.

18 months ago[mono][aot] Refactor deduplication to use enum instead of flags (#85384)
Milos Kotlar [Mon, 1 May 2023 11:36:32 +0000 (14:36 +0300)]
[mono][aot] Refactor deduplication to use enum instead of flags (#85384)

* Use enum instead of multiple dedup flags

18 months agoDelete finally blocks in EcmaSignatureParser (#85577)
Michal Strehovský [Mon, 1 May 2023 10:17:01 +0000 (19:17 +0900)]
Delete finally blocks in EcmaSignatureParser (#85577)

These lightweight structs are not meant to be reusable.

18 months agoEmission and reading of custom modifiers (#85504)
Michal Strehovský [Mon, 1 May 2023 10:16:39 +0000 (19:16 +0900)]
Emission and reading of custom modifiers (#85504)

Fixes #71883.

* Emit custom modifiers to the native metadata format
* Read custom modifiers at runtime
* Bugfix in the type loader

18 months agoSplit assignment rationalization into a separate phase (#85180)
SingleAccretion [Mon, 1 May 2023 10:04:12 +0000 (13:04 +0300)]
Split assignment rationalization into a separate phase (#85180)

* General IR support

* Introduce GTK_STORE

And make "OperIsStore" means exactly these opers:
 GT_STORE_LCL_VAR
 GT_STORE_LCL_FLD
 GT_STOREIND
 GT_STORE_BLK

Notable: GT_STORE_DYN_BLK is excluded as it does
not follow conventions of all other stores (e. g.
is VOID-typed) and acts more like opaque atomic
operations instead.

Also fix an old bug with gtNodeHasSideEffects.

* Fix OperExceptions

* Introduce and use gtNewStoreLclFldNode

* gtNewStoreLclVar -> gtNewStoreLclVarNode

* Use OperIsAnyLocal in more places

* Introduce ASG rationalization phase

* Introduce switch for stress-morphing

* Fix formatting

18 months agoJIT: Make optAssertionPropGlobal_RelOp less conservative for side-effects (#85532)
Egor Bogatov [Mon, 1 May 2023 08:37:51 +0000 (10:37 +0200)]
JIT: Make optAssertionPropGlobal_RelOp less conservative for side-effects (#85532)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
18 months agoDelete more type equivalence logic (#85507)
Michal Strehovský [Mon, 1 May 2023 04:40:42 +0000 (13:40 +0900)]
Delete more type equivalence logic (#85507)

* Delete more type equivalence logic

In .NET Native times we could have a situation where two different `MethodTable` pointers represented the same type. This could happen for cloned types, or structurally equivalent parameterized types. The cloned type concept was never used in Native AOT. The structural equivalence disappeared in https://github.com/dotnet/runtimelab/commit/0ef7bd6cfe129f4c308f5d6dae1eccf48c3cdff4. Neither of those seems useful. So getting rid of some of the vestiges.

* Delete more stuff

* Remember statically present pointer and mdarrays

18 months agoDelete `arrayArgumentsFound` logic from type loader (#85509)
Michal Strehovský [Mon, 1 May 2023 04:39:37 +0000 (13:39 +0900)]
Delete `arrayArgumentsFound` logic from type loader (#85509)

I think this was handling a situation where we're trying to find an existing `MethodTable` for `Foo<SomeType[]>` and such `MethodTable` does statically exist but we didn't have a mapping table entry for `SomeType[]` and we couldn't get a `MethodTable` for it, even though it statically exists in the image. Since the compiler optimization to skip emitting this mapping got commented out, it wasn't actually possible to end up in a situation where we wouldn't know how to find a `MethodTable` for an existing array at runtime. We therefore don't need the slow path that tries to find the type without having `MethodTable`s for all generic arguments.

18 months agoReplace InvariantCulture comparison with Ordinal (#85572)
Gérald Barré [Sun, 30 Apr 2023 23:12:57 +0000 (19:12 -0400)]
Replace InvariantCulture comparison with Ordinal (#85572)

18 months agoReduce overheads of Regex.Replace with a text replacement string (#85564)
Stephen Toub [Sun, 30 Apr 2023 22:59:34 +0000 (18:59 -0400)]
Reduce overheads of Regex.Replace with a text replacement string (#85564)

* Reduce overheads of Regex.Replace with a text replacement string

If the replacement string doesn't contain any backreferences, we can reduce the overheads involved in processing the replacement.  Rather than storing a list of `ReadOnlyMemory<char>` segments for every portion of the original string or replacement, we can just store a list of `(int offset, int count)` pairs; if the offset is non-negative it refers to the original string, and if it's negative, it means to use the whole replacement.  We can also avoid evaluating the rules each time, and since we're not storing string references into the arrays, we don't need to clear the arrays before returning them to the pool.

* Replace builders with more generic StructListBuilder