platform/upstream/dotnet/runtime.git
16 months agoRemove [AO] in SpanHelpers methods (#85819)
Egor Bogatov [Fri, 5 May 2023 16:21:37 +0000 (18:21 +0200)]
Remove [AO] in SpanHelpers methods (#85819)

16 months ago[RISC-V][GC] Use 128gb for regions_range on RISCV64 (#84797)
t-mustafin [Fri, 5 May 2023 15:18:41 +0000 (18:18 +0300)]
[RISC-V][GC] Use 128gb for regions_range on RISCV64 (#84797)

* Set virtual memory limit for RISCV64 SV39

Use 128gb for regions_range cause RISCV64 SV39 memory layout allows to use only 256gb of virtual memory: https://docs.kernel.org/riscv/vm-layout.html#risc-v-linux-kernel-sv39.

* PR feedback

16 months agoSkip displaying raw instruction bytes by default for non-xarch (#85808)
Kunal Pathak [Fri, 5 May 2023 14:57:42 +0000 (07:57 -0700)]
Skip displaying raw instruction bytes by default for non-xarch (#85808)

16 months agoJIT: prepare for instrumentation before incorporating profile counts (#85805)
Andy Ayers [Fri, 5 May 2023 14:44:48 +0000 (07:44 -0700)]
JIT: prepare for instrumentation before incorporating profile counts (#85805)

Otherwise the spanning tree we generate may be biased by the profile data
and not match the spanning tree we generated in Tier0.

Fixes #85799.

16 months ago[LoongArch64] modify the define of `FLOAT_REGISTER_SIZE`. (#85812)
Qiao Pengcheng [Fri, 5 May 2023 13:43:52 +0000 (21:43 +0800)]
[LoongArch64] modify the define of `FLOAT_REGISTER_SIZE`. (#85812)

16 months ago[mono][interp] Fix first arg offset computation for unoptimized newobj (#85787)
Vlad Brezae [Fri, 5 May 2023 12:43:09 +0000 (15:43 +0300)]
[mono][interp] Fix first arg offset computation for unoptimized newobj (#85787)

Instead of obtaining the offset directly, we were computing it as the next available offset (once the arguments were pop'ed), which was not accounting for the case where the first argument was aligned.

16 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 217410...
dotnet bot [Fri, 5 May 2023 12:42:06 +0000 (05:42 -0700)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2174100 (#85802)

16 months ago[wasm] PackedSimd, add floating point methods (#85705)
Radek Doulik [Fri, 5 May 2023 09:30:58 +0000 (11:30 +0200)]
[wasm] PackedSimd, add floating point methods (#85705)

* [wasm] PackedSimd, add floating point methods

* Fix pmax/pmin

16 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230503.5 (#85766)
dotnet-maestro[bot] [Fri, 5 May 2023 00:48:01 +0000 (19:48 -0500)]
Update dependencies from https://github.com/dotnet/arcade build 20230503.5 (#85766)

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.23253.3 -> To Version 8.0.0-beta.23253.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
16 months agoUpdate dependencies from https://github.com/dotnet/roslyn build 20230503.10 (#85771)
dotnet-maestro[bot] [Fri, 5 May 2023 00:47:29 +0000 (19:47 -0500)]
Update dependencies from https://github.com/dotnet/roslyn build 20230503.10 (#85771)

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.7.0-1.23226.15 -> To Version 4.7.0-1.23253.10

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
16 months agoRemove a number of unneeded nullability suppressions. (#85788)
Eirik Tsarpalis [Thu, 4 May 2023 22:13:35 +0000 (01:13 +0300)]
Remove a number of unneeded nullability suppressions. (#85788)

* Fix nullability annotation of the JsonSerializer.Serialize methods.

* Remove a few more suppressions from the implementation.

* Revert annotations in the public APIs.

16 months ago[wasm] Update path in the README (#85794)
Radek Doulik [Thu, 4 May 2023 22:07:35 +0000 (00:07 +0200)]
[wasm] Update path in the README (#85794)

16 months agoConvert the ComWrappers API tests to Xunit-style (#85790)
Jeremy Koritzinsky [Thu, 4 May 2023 22:00:55 +0000 (15:00 -0700)]
Convert the ComWrappers API tests to Xunit-style (#85790)

16 months agoDon't add duplicate suffix in LibraryImport code fix. (#85668)
Jackson Schuster [Thu, 4 May 2023 21:43:03 +0000 (16:43 -0500)]
Don't add duplicate suffix in LibraryImport code fix. (#85668)

16 months agoRevert "SetThreadDpiAwareness for host error dialog (#81930)" (#85773)
Elinor Fung [Thu, 4 May 2023 21:34:20 +0000 (23:34 +0200)]
Revert "SetThreadDpiAwareness for host error dialog (#81930)" (#85773)

This reverts commit 6f36be56480dc0a24a9713df5d81875a9ca2c980.

There is an issue with the Windows TaskDialog where expanding/collapsing the detail area will result in incorrect resizing of the window when the DPI awareness of the process and thread are not the same. Instead of explicitly making the thread starting the dialog DPI aware, we just leave it whatever the process is set to. This means that if the developer specified a manifest that made their application DPI aware, the dialog will be non-blurry, but if the developer did not, it will remain blurry on high DPI.

16 months agoAvoid using two-char search in IndexOfOrdinalIgnoreCase for 1-char values (#85781)
Stephen Toub [Thu, 4 May 2023 20:22:49 +0000 (13:22 -0700)]
Avoid using two-char search in IndexOfOrdinalIgnoreCase for 1-char values (#85781)

16 months ago[wasm] WBT: Disable blazor test due to https://github.com/dotnet/runt… (#85786)
Ankit Jain [Thu, 4 May 2023 19:16:27 +0000 (15:16 -0400)]
[wasm] WBT: Disable blazor test due to https://github.com/dotnet/runt… (#85786)

…ime/issues/85769

test: `Wasm.Build.Tests.Blazor.BuildPublishTests.BlazorBuildRunTest`

16 months agoAdd GenericTypeParameterBuilder implementation and save a generic type into assembly...
Buyaa Namnan [Thu, 4 May 2023 17:13:34 +0000 (10:13 -0700)]
Add GenericTypeParameterBuilder implementation and save a generic type into assembly. (#85658)

* Save a type with generic type parameters

* Update GenericParameterAttribute in test that causing a class contraint

16 months agoMake dependency on lld optional (#85667)
Sven Boemer [Thu, 4 May 2023 16:56:21 +0000 (09:56 -0700)]
Make dependency on lld optional (#85667)

This detects availability of lld by reusing the logic in
`init-compiler.sh`.

16 months ago[NativeAOT] Simplifying access to thread static variables (#84566)
Vladimir Sadov [Thu, 4 May 2023 16:45:24 +0000 (09:45 -0700)]
[NativeAOT] Simplifying access to thread static variables (#84566)

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

- [x] separate "fast" inlinable case . (used for singlemodule, not dynamic cases, when optimizing)
- [x] make the storage for fast threadstatics a single "combo" instance instead of array of instances.

16 months agoSync shared code from aspnetcore (#85748)
github-actions[bot] [Thu, 4 May 2023 15:34:07 +0000 (08:34 -0700)]
Sync shared code from aspnetcore (#85748)

Co-authored-by: JamesNK <JamesNK@users.noreply.github.com>
16 months ago[mono][wasm] Make experimental-gshared-mrgctx really true on WASM AOT. (#85770)
Zoltan Varga [Thu, 4 May 2023 15:19:47 +0000 (11:19 -0400)]
[mono][wasm] Make experimental-gshared-mrgctx really true on WASM AOT. (#85770)

16 months agoJIT: properly scrub SSA from return address buffers (#85746)
Andy Ayers [Thu, 4 May 2023 14:43:34 +0000 (07:43 -0700)]
JIT: properly scrub SSA from return address buffers (#85746)

These can be in SSA and were not getting their SSA numbers cleaned by
`fgResetForSsa`, so in repeat mode they might trigger SSA check failures.

Also changed it so you can dump the SSA number without triggering an
assert.

Fixes #85629

16 months agoAdd mcs support for new FROZEN_ALLOC_ALLOWED jit flag (#85745)
Andy Ayers [Thu, 4 May 2023 14:42:33 +0000 (07:42 -0700)]
Add mcs support for new FROZEN_ALLOC_ALLOWED jit flag (#85745)

16 months agoJIT: Allow forward sub to reorder trees throwing the same single exception (#85647)
Jakob Botsch Nielsen [Thu, 4 May 2023 14:19:20 +0000 (16:19 +0200)]
JIT: Allow forward sub to reorder trees throwing the same single exception (#85647)

Allow forward sub to move a tree past another tree that throws an exception provided that they both throw the same exception.

16 months agoMissing overrides in LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler...
mphelt [Thu, 4 May 2023 13:49:36 +0000 (15:49 +0200)]
Missing overrides in LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler (#85143)

* add missing overrides in LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler (https://github.com/dotnet/runtime/issues/85104)

* Update LoggingUriOutputTests.cs

* Update LoggingHttpMessageHandler.cs

* Update LoggingScopeHttpMessageHandler.cs

* Update LoggingScopeHttpMessageHandler.cs

* Update LoggingUriOutputTests.cs

* Update LoggingScopeHttpMessageHandler.cs

* Update LoggingUriOutputTests.cs

* Update LoggingUriOutputTests.cs

* Update LoggingUriOutputTests.cs

* Update LoggingUriOutputTests.cs

* Update LoggingHttpMessageHandler.cs

* Update LoggingScopeHttpMessageHandler.cs

* Update LoggingHttpMessageHandler.cs

* Update LoggingScopeHttpMessageHandler.cs

* Update LoggingHttpMessageHandler.cs

* Update LoggingHttpMessageHandler.cs

* Update LoggingScopeHttpMessageHandler.cs

* Code style update

* back to private methods

* merge with dotnet/runtime (#7)

16 months agoAnnotate IHtmlString.ToHtmlString's return as nullable (#85742)
Stephen Toub [Thu, 4 May 2023 13:48:58 +0000 (06:48 -0700)]
Annotate IHtmlString.ToHtmlString's return as nullable (#85742)

16 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)

16 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

16 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)

16 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.

16 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.

16 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

16 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.

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

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

16 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

16 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)

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

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

16 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>
16 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

16 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

16 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)

16 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>
16 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

16 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.

16 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().

16 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.

16 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)

16 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)

16 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

16 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

16 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>
16 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.

16 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.

16 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

16 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.

16 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>
16 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.

16 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.

16 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

16 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)

16 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)

16 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

16 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

16 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>
16 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>
16 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)

16 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

16 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

16 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

16 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

16 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.

16 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)

16 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)

16 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

16 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)

16 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

16 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)

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

16 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>
16 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

16 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>
16 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

16 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

16 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)

16 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

16 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)

16 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.

16 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.

16 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.

16 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.

16 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).

16 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

16 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

16 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

16 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

16 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>
16 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)