platform/upstream/dotnet/runtime.git
15 months agoUnsubscribe from codegen-coreclr notifications (#85124)
Kunal Pathak [Fri, 21 Apr 2023 05:32:37 +0000 (22:32 -0700)]
Unsubscribe from codegen-coreclr notifications (#85124)

15 months ago[wasm] WBT: Re-enable previously disabled test (#85009)
Ankit Jain [Fri, 21 Apr 2023 03:58:41 +0000 (23:58 -0400)]
[wasm] WBT: Re-enable previously disabled test (#85009)

15 months agoBlock Runtime_84693 with the issue #85081 (#85123)
Tomáš Rylek [Fri, 21 Apr 2023 03:24:43 +0000 (05:24 +0200)]
Block Runtime_84693 with the issue #85081 (#85123)

15 months ago[wasm] Detect constant-size cpblk copies in the jiterpreter and unroll them into...
Katelyn Gadd [Fri, 21 Apr 2023 02:43:07 +0000 (19:43 -0700)]
[wasm] Detect constant-size cpblk copies in the jiterpreter and unroll them into raw moves (#85125)

This slightly improves performance for Number.Formatting WriteXXXDigits

15 months agoLowering Vector512() methods : comparison + shift (#84942)
DeepakRajendrakumaran [Fri, 21 Apr 2023 02:40:53 +0000 (19:40 -0700)]
Lowering Vector512() methods : comparison + shift (#84942)

* LessThan(), LessThanOrEqual(), GreaterThan(), GreaterThanOrEqual() + corresponding *ANY(), *ALL() and ConditionaSelect()
ShiftLeft, ShiftRight, ShiftRightArithmetic

* Update src/coreclr/jit/lowerxarch.cpp : review comment

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
---------

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
15 months agoJettison vxsort support in the GC when optimizing for size (#85036)
Michal Strehovský [Fri, 21 Apr 2023 00:49:36 +0000 (09:49 +0900)]
Jettison vxsort support in the GC when optimizing for size (#85036)

Vxsort comes with precomputed tables that are more than 100 kB in size.

Jettison them when optimizing for size. Hello world with optimize for size + invariant globalization is now 1.08 MB.

Fixes #84749.

15 months agoJsonConsoleFormatter: keep escaped line breaks for Exceptions #83726 (#84972)
Bernhard Danecker [Thu, 20 Apr 2023 23:38:02 +0000 (01:38 +0200)]
JsonConsoleFormatter: keep escaped line breaks for Exceptions #83726 (#84972)

15 months agoSimplify `impSIMDPopStack` and delete a quirk from `gtNewLoadValueNode` (#85070)
SingleAccretion [Thu, 20 Apr 2023 22:59:54 +0000 (01:59 +0300)]
Simplify `impSIMDPopStack` and delete a quirk from `gtNewLoadValueNode` (#85070)

15 months agoAcclerate `Vector512` multiply and divide. (#84941)
anthonycanino [Thu, 20 Apr 2023 22:27:37 +0000 (15:27 -0700)]
Acclerate `Vector512` multiply and divide. (#84941)

* Accelerate Vector512 multiply.

* Accelerate Vector512 divide.

* Small build fix.

* Fix accidental removal for Vector256_op_division.

* Review edits.

* Assert fix.

---------

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
15 months agoUse SetOper instead of ChangeOper in ContainCheckCompare (#85076)
Will Smith [Thu, 20 Apr 2023 19:02:40 +0000 (12:02 -0700)]
Use SetOper instead of ChangeOper in ContainCheckCompare (#85076)

15 months ago[wasm] Disable failing AOT tests to get CI green again (#85111)
Ankit Jain [Thu, 20 Apr 2023 18:09:35 +0000 (14:09 -0400)]
[wasm] Disable failing AOT tests to get CI green again (#85111)

* [wasm] Disable failing AOT test - System.Collections.Immutable

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

* [wasm] Disable failing AOT tests - System.Runtime.Serialization.Xml*

- System.Runtime.Serialization.Xml.Tests
- System.Runtime.Serialization.Xml.ReflectionOnly.Tests

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

15 months agoFix dumping of block op kinds (#85101)
SingleAccretion [Thu, 20 Apr 2023 17:50:35 +0000 (20:50 +0300)]
Fix dumping of block op kinds (#85101)

15 months agoAccelerate Vector512 `ConvertToSingle` and `ConvertToInt32`. (#84932)
anthonycanino [Thu, 20 Apr 2023 17:20:46 +0000 (10:20 -0700)]
Accelerate Vector512 `ConvertToSingle` and `ConvertToInt32`. (#84932)

* Accelerate Vector512 `ConvertToSingle` and `ConvertToInt32`.

* Moving intrinsics to proper place.

15 months agoDo not surface resolver exceptions when running ancestor type resolution (#85108)
Eirik Tsarpalis [Thu, 20 Apr 2023 17:18:02 +0000 (18:18 +0100)]
Do not surface resolver exceptions when running ancestor type resolution (#85108)

15 months agoRemove missed iOSMobileNet6 runtimeType check. (#85075)
Parker Bibus [Thu, 20 Apr 2023 17:14:17 +0000 (10:14 -0700)]
Remove missed iOSMobileNet6 runtimeType check. (#85075)

15 months ago[mono] add internal WebWorkerEventLoop utility class (#84492)
Aleksey Kliger (λgeek) [Thu, 20 Apr 2023 15:04:43 +0000 (11:04 -0400)]
[mono] add internal WebWorkerEventLoop utility class (#84492)

This is part of https://github.com/dotnet/runtime/issues/84489 - landing support for async JS interop on threadpool threads in multi-threaded WebAssembly.

Provides two pieces of functionality:

1. A keepalive token that can be used to prevent the current POSIX thread from terminating when it returns from its thread start function, or from an invocation from the JS event loop.  When the last keepalive token is destroyed (assuming Emscripten isn't keeping the thread alive for other reasons) it will terminate as if by calling `pthread_exit` and the webworker will be made available to other threads

2. A `HasUnsettledInteropPromises` property that peeks `_js_owned_object_table` to see if there are any promises created by the interop subsystem that have not been fulfilled or rejected yet.

* [mono] add internal WebWorkerEventLoop utility class

Provides two pieces of functionality:

1. A keepalive token that can be used to prevent the current POSIX
thread from terminating when it returns from its thread start
function, or from an invocation from the JS event loop.  When the last
keepalive token is destroyed (assuming Emscripten isn't keeping the
thread alive for other reasons) it will terminate as if by calling
`pthread_exit` and the webworker will be made available to other
threads

2. A `HasUnsettledInteropPromises` property that peeks
`_js_owned_object_table` to see if there are any promises created by
the interop subsystem that have not been fulfilled or rejected yet.

* Use a per-thread unsettled promise count

for mono_wasm_eventloop_has_unsettled_interop_promises we
can't use the _js_owned_object_table size because it contains
other interop objects, not just promises

* remove old emscripten keepalive workaround hack

* Add a more general getter for JS interop to keep a webworker alive

And link to #85052 for more details

* fixup docs

15 months ago[browser] bump System.Text.Json timeout (#85041)
Pavel Savara [Thu, 20 Apr 2023 13:53:56 +0000 (15:53 +0200)]
[browser] bump System.Text.Json timeout (#85041)

* bump System.Text.Json timeout to 45 minutes
* feedback

15 months ago[LoongArch64] amend the gcinfo. (#85092)
Qiao Pengcheng [Thu, 20 Apr 2023 12:36:45 +0000 (08:36 -0400)]
[LoongArch64] amend the gcinfo. (#85092)

15 months ago[mono][jit] Adding Vector128.GetElement as intrinsic in arm64. (#84929)
Jan Dupej [Thu, 20 Apr 2023 12:00:54 +0000 (14:00 +0200)]
[mono][jit] Adding Vector128.GetElement as intrinsic in arm64. (#84929)

* Adding Vector128.GetElement.

* Cases with 32b and smaller elements are now spill+load.

* Addressed review comments.

* Code cleanup.

15 months agoObsolete some protected, unused members of Regex{Runner} (#84812)
Stephen Toub [Thu, 20 Apr 2023 10:14:25 +0000 (06:14 -0400)]
Obsolete some protected, unused members of Regex{Runner} (#84812)

15 months agoReduce regex test suite time (#84865)
Stephen Toub [Thu, 20 Apr 2023 10:14:03 +0000 (06:14 -0400)]
Reduce regex test suite time (#84865)

On my machine, depending on the order in which the tests end up running, the suite takes anywhere between 50 seconds and 130 seconds.  With these changes, it's fairly consistently around 50 seconds.  The majority of the time is spent in building new Regex instances with the source generator. This change just applies to a few of the test classes with _lots_ of test cases the same batching-in-the-source-generator approach we've taken in other test classes.

15 months agoImprove docs for the linker analyzer tool (#84833)
Vitek Karas [Thu, 20 Apr 2023 09:17:29 +0000 (02:17 -0700)]
Improve docs for the linker analyzer tool (#84833)

The instructions were valid only for Xamarin projects which run linker during build.
.NET Console projects only run linker during publish, so the instructions need to look different.

15 months ago[LoongArch64] revert the modification about the LA64's PageSize by #83632. (#84960)
Qiao Pengcheng [Thu, 20 Apr 2023 08:20:25 +0000 (04:20 -0400)]
[LoongArch64] revert the modification about the LA64's PageSize by #83632. (#84960)

* [LoongArch64] revert the modification about
the LA64's PageSize by #83632.

* keep the comment by CR.

15 months agoSync shared code from aspnetcore (#85090)
github-actions[bot] [Thu, 20 Apr 2023 07:51:55 +0000 (15:51 +0800)]
Sync shared code from aspnetcore (#85090)

Co-authored-by: JamesNK <JamesNK@users.noreply.github.com>
15 months ago[mono][metadata] Fix lookup of matching interface method with covariant returns ...
Vlad Brezae [Thu, 20 Apr 2023 07:19:06 +0000 (10:19 +0300)]
[mono][metadata] Fix lookup of matching interface method with covariant returns (#84160)

* [mono][metadata] Fix lookup of matching interface method with covariant returns

When a class is implementing an interface, we lookup up a matching method (with exact signature) in the class methods and inherited virtual methods. This doesn't handle the situation where the interface was matching a virtual method declared in one of the parents, which was then overriden with a covariant return method. If that is the case, the covariant return method is considered as the implementation of the interface method.

* Add test

15 months agoImplement function pointer type support (#85031)
Michal Strehovský [Thu, 20 Apr 2023 05:25:38 +0000 (14:25 +0900)]
Implement function pointer type support (#85031)

Implements function pointer type support in the compiler, runtime, and reflection stack.

Contributes to #71883.

* Introduce a new kind of `MethodTable` for function pointers in the compiler.
* Remove function pointer type blocking from various places in the compiler.
* Generate a new summary table so we can construct/deconstruct function pointer types at runtime.
* Update metadata format so that we can capture calling conventions and distinguish managed/unmanaged function pointers in metadata.
* Update `MethodTable` reader.
* Update casting logic in the runtime.
* Update BCL (arrays, TypedReference, etc.)
* Update reflection stack: representation of the type, parsing metadata, invoke, field get/set
* Enable applicable tests.

Not implemented yet: the modified type stuff, runtime type loader support.

15 months agobump emsdk manually (#85084)
Larry Ewing [Thu, 20 Apr 2023 04:57:35 +0000 (23:57 -0500)]
bump emsdk manually (#85084)

15 months agoAdd TimeProvider.GetElapsedTime(long) overload (#85078)
Tarek Mahmoud Sayed [Thu, 20 Apr 2023 02:53:40 +0000 (19:53 -0700)]
Add TimeProvider.GetElapsedTime(long) overload (#85078)

15 months agoAdd a dedicated Ascii.IsValid path (#84881)
Miha Zupan [Thu, 20 Apr 2023 00:14:19 +0000 (02:14 +0200)]
Add a dedicated Ascii.IsValid path (#84881)

* Add dedicated Ascii.IsValid path

* Remove wrong assert

* Use for loop instead of chasing end byref

* Add an extra assert

* Use nuint in loop for [0, 3] elements

* Remove leftover byref increment

15 months agoVarious fixes for consecutive registers found with jitstressregs (#84824)
Kunal Pathak [Thu, 20 Apr 2023 00:05:59 +0000 (17:05 -0700)]
Various fixes for consecutive registers found with jitstressregs (#84824)

* restore the upper vector at the use of GT_FIELD_LIST

* Introduce isLiveAtConsecutiveRegistersLoc and fix #84747

This method will track if the defs/uses are live at the same location as
where the consecutive registers were allocated. If yes, it will skip the
constraint imposition on it during JitStressRegs

* Handle tracking of previously assigned register for copyReg

When we have copyReg that was just restored or previously assigned
to a different register, also track it as live at the location so
it doesn't get allocated again for different refposition at the same
location.

* fix the release build errors

* Mark consecutive refpositions registers as busy

* Update the comments

* Stop stresslimiting registerAssignment and instead limit the free registers

Under JitStressRegs, there are multiple ways in which consecutive registers demand
cannot be met. So skip restricting the registers for `registerAssignment` of a refPosition
(which are allowable candidates that can be assigned to the given refposition). Instead
limit the free registers to alternate under stress mode, so we can verify the code if it
can handle situation where it needs to pick from a mix of free/busy registers.

* Introduce updateRegsFreeBusyState() for common trackign

* Update comment

* misc. changes

* review feedback

15 months agoAvoid allocations when adding existing items to the blob heap. (#81059)
Theodore Tsirpanis [Wed, 19 Apr 2023 23:31:44 +0000 (02:31 +0300)]
Avoid allocations when adding existing items to the blob heap. (#81059)

* Add `BlobDictionary`.

* Use `BlobDictionary` in `MetadataReader` and optimize the simple cases.

* Optimize adding blobs from UTF-16 strings and from blob builders.

* Delete `ByteSequenceComparer`.

* Fix compiler errors.

* Clean-up `BlobDictionary`; move it, make it non-generic and streamline its API.

* Don't try to copy the blob builder's contents to a stack-allocated buffer.
The blob builder's default starting size is 256 bytes; the same as the stack-alllocated buffer, and making it bigger does not have any benefit since such large blobs are rare.

15 months agoDisallow `BLK<SIMD>` (#84868)
SingleAccretion [Wed, 19 Apr 2023 21:28:07 +0000 (00:28 +0300)]
Disallow `BLK<SIMD>` (#84868)

* Add an assert

* Move gtNewStructVal/gtNewBlkIndir/gtNewIndir

From compiler.hpp to gentree.cpp.

Motivation: more methods are to come and the header file is very large already.

* Generalize "gtNewStructVal" to avoid diffs

* Stop producing BLK<SIMD>

* Fix some regressions

The IND(COMMA) -> COMMA(IND) transformation decanonicalizes array
access as it is only performed on "uses" (i. e. not stores).

Simply do not do this for SIMD types. Evidently, this unblocks some if conversions.

* Fix gtNewZeroCon

* Fix regressions related to SIMD promotion

Preserve the behavior of setting the "is used in a SIMD intrinsic" flag.

Will bring additional positive diffs due to the "ldobj" change.

15 months agoImprove DateTime{Offset} formatting further in a variety of cases (#84963)
Stephen Toub [Wed, 19 Apr 2023 21:23:20 +0000 (17:23 -0400)]
Improve DateTime{Offset} formatting further in a variety of cases (#84963)

* Improve DateTime{Offset} formatting further in a variety of cases

- Utf8Formatter special-cases 'G' / the default format. By moving that specialized implementation into DateTimeFormat, we can benefit from it from DateTime{Offset}.ToString/TryFormat as well.  This was the last custom formatting routine in Utf8Formatter.  As part of deleting two Utf8Formatter.Date.* files, I also changed the TryFormatDateTimeL shim function to go directly to TryFormatR rather than going through the wrapping TryFormat function.

- The "s" and "u" formats are also reasonably popular and have a fixed pattern that's not sensitive to culture.  By writing custom routines for those, we can not only speed them up, but also restructure the calling code to avoid needing the FormatIntoBuilder for some default/G cases.

- The above requires being able to check whether a provider is invariant, but DateTimeFormatInfo.InvariantInfo and CultureInfo.InvariantCulture.DateTimeFormat actually returned different instances.  I made them the same instance, such that we can now just compare against DateTimeFormatInfo.InvariantInfo to handle the 99.9% case of checking whether a DTFI represents the invariant culture.  This also make access to DTFI.InvariantInfo faster, as it's now just returning a static readonly field rather than a lazily-initialized volatile field.

- For "U", we were allocating a new DateTimeFormatInfo and GregorianCalendar (and supporting strings) on every formatting, resulting in ~1K of allocation.  I fixed it to only allocate when necessary, which is rare.

- Removed some bounds checking in ParseRepeatPattern and various DateTimeFormatInfo.GetXx helpers

- Removed a % from 'h' handling in FormatCustomized.

- Plus a few renames and changing DateTimeOffsetPattern to not access a lazily-initialized property on every iteration of the search loop.

- And Tarek noticed one place we were appending an unchecked char that could have been non-ASCII, so I fixed that to check appropriately.

* Address PR feedback

* Fix TryFormat optimization

15 months agoEnsure vextractf64x4 and vextracti64x4 aren't marked DstDstSrc (#85030)
Tanner Gooding [Wed, 19 Apr 2023 20:38:27 +0000 (13:38 -0700)]
Ensure vextractf64x4 and vextracti64x4 aren't marked DstDstSrc (#85030)

15 months agoRemove more unnecessary scenarios from HWIntrinsic test templates and fix timeout...
Tanner Gooding [Wed, 19 Apr 2023 20:38:13 +0000 (13:38 -0700)]
Remove more unnecessary scenarios from HWIntrinsic test templates and fix timeout/failure (#85026)

* Remove unnecessary scenarios from other HWIntrinsic templates

* Remove ClsVar scenarios from HWIntrinsic test templates

* Removing ClassLclFld scenarios from the HWIntrinsic test templates

* Divide the original striping between the split hwintrinsic test projects

* Minor formatting change to trigger JIT tests

* Allow Avx512 tests to run in Pri0

* Ensure that crossgen correctly handles the VL nested class

* Fixing an issue with NI_AVX512F_ConvertToVector256Int32 for TYP_DOUBLE

* Fixing a couple small test failures that were masked

* Fix a mistyped intrinsic id

15 months agoFix typo in debugging-runtime.md (#85060)
Jasper [Wed, 19 Apr 2023 19:31:41 +0000 (21:31 +0200)]
Fix typo in debugging-runtime.md (#85060)

I believe this is a typo. The subset isn't recognized by build.cmd and git grep find nothing for corelibnative except this line.

15 months agoRemove unused helix queue definitions (#85018)
Jeremy Koritzinsky [Wed, 19 Apr 2023 19:30:16 +0000 (12:30 -0700)]
Remove unused helix queue definitions (#85018)

15 months agoReduce the trim requirements on MetadataUpdateHandlerAttribute (#84369)
Badre BSAILA [Wed, 19 Apr 2023 18:20:25 +0000 (20:20 +0200)]
Reduce the trim requirements on MetadataUpdateHandlerAttribute (#84369)

15 months agoFix a number of issues related to boxed value serialization (#84768)
Eirik Tsarpalis [Wed, 19 Apr 2023 17:45:20 +0000 (18:45 +0100)]
Fix a number of issues related to boxed value serialization (#84768)

* Remove unspeakable type support form serialization overloads accepting an explicit `Type` parameter.

* Honor polymorphism metadata when serializing boxed polymorphic values.

* Support boxed root value serialization in source generators that don't supply metadata for `object`.

* Address feedback

15 months agoRevert "[mono][aot] Enable deduplication of runtime invoke wrappers (#84304)" (#85048)
Milos Kotlar [Wed, 19 Apr 2023 17:12:46 +0000 (19:12 +0200)]
Revert "[mono][aot] Enable deduplication of runtime invoke wrappers (#84304)" (#85048)

This reverts commit 0a204f53780858d5206b80f8bb71d5829c828d03.

15 months agoFix build -alltargets on Windows (#85039)
Mark Plesko [Wed, 19 Apr 2023 17:07:39 +0000 (10:07 -0700)]
Fix build -alltargets on Windows (#85039)

15 months ago[workloads] Bump .NET 7 Package Version (#84956)
Steve Pfister [Wed, 19 Apr 2023 15:30:01 +0000 (11:30 -0400)]
[workloads] Bump .NET 7 Package Version (#84956)

15 months ago[mono][jit] Improve mono_print_ins (). (#85011)
Zoltan Varga [Wed, 19 Apr 2023 15:06:24 +0000 (11:06 -0400)]
[mono][jit] Improve mono_print_ins (). (#85011)

Print more information for instructions which are not in the cpu-<arch>.mdesc files.

15 months agoFix HTTP3 header decoder buffer allocation (#78862)
Bruno Blanes [Wed, 19 Apr 2023 15:00:35 +0000 (12:00 -0300)]
Fix HTTP3 header decoder buffer allocation (#78862)

* Add test for literal field without name reference

* Fix header name buffer allocation

* Add more tests

* Unified QPackDecoderTest test files

* Fix variable name

* Fixed HPackDecoder and ported QPack tests

* Feedback

---------

Co-authored-by: ManickaP <mapichov@microsoft.com>
15 months ago[mono][sgen] Fix GetTotalMemory (#84480)
Vlad Brezae [Wed, 19 Apr 2023 14:56:06 +0000 (17:56 +0300)]
[mono][sgen] Fix GetTotalMemory (#84480)

The previous code was iterating over all blocks, and their freelist, without checking if the block has been swept in the first place. This would lead to incorrect size computation if the block wasn't swept and undefined behavior when racing with concurrent sweep.

15 months agoFix illumos-x64 build (#85006)
Adeel Mujahid [Wed, 19 Apr 2023 13:28:14 +0000 (16:28 +0300)]
Fix illumos-x64 build (#85006)

15 months ago[browser] JSObject thread affinity assertions (#84981)
Pavel Savara [Wed, 19 Apr 2023 13:13:33 +0000 (15:13 +0200)]
[browser] JSObject thread affinity assertions (#84981)

Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
15 months agoDelete `GT_STORE_OBJ` (#84951)
SingleAccretion [Wed, 19 Apr 2023 10:34:24 +0000 (13:34 +0300)]
Delete `GT_STORE_OBJ` (#84951)

* Rationalization

* General lowering

* General LSRA

* XARCH backend

* ARMARCH backend

* LA64 backend

* RISCV64 backend

* General IR support

15 months agoAddress a couple `TODO-ADDR`s (#84906)
SingleAccretion [Wed, 19 Apr 2023 10:31:48 +0000 (13:31 +0300)]
Address a couple `TODO-ADDR`s (#84906)

* Add GTF_EXCEPT handling to gtNewField[Addr]Node

* Delete a not-needed condition

* Delete RewriteSIMDIndir

15 months ago[browser] Make JSExport worker thread friendlier (#83680)
Pavel Savara [Wed, 19 Apr 2023 10:14:46 +0000 (12:14 +0200)]
[browser] Make JSExport worker thread friendlier (#83680)

Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
15 months agoAdd binary parsing support to integer types (#84998)
Stephen Toub [Wed, 19 Apr 2023 09:58:27 +0000 (05:58 -0400)]
Add binary parsing support to integer types (#84998)

* Add binary parsing support to integer types

* Fix a couple of tests

15 months agoFix unrollings on AVX1-only machines (#84946)
Egor Bogatov [Wed, 19 Apr 2023 09:44:20 +0000 (11:44 +0200)]
Fix unrollings on AVX1-only machines (#84946)

15 months ago[browser] trimming of `LegacyExports` with `WasmEnableLegacyJsInterop` (#83664)
Pavel Savara [Wed, 19 Apr 2023 09:25:05 +0000 (11:25 +0200)]
[browser] trimming of `LegacyExports` with `WasmEnableLegacyJsInterop` (#83664)

15 months ago[main] Update dependencies from dotnet/arcade (#84987)
dotnet-maestro[bot] [Wed, 19 Apr 2023 09:20:25 +0000 (11:20 +0200)]
[main] Update dependencies from dotnet/arcade (#84987)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
15 months ago[main] Update dependencies from dotnet/roslyn-analyzers (#84992)
dotnet-maestro[bot] [Wed, 19 Apr 2023 09:19:24 +0000 (11:19 +0200)]
[main] Update dependencies from dotnet/roslyn-analyzers (#84992)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
15 months agoPrivate API for RefreshMemoryLimit (#83707)
Andrew Au [Wed, 19 Apr 2023 04:18:46 +0000 (21:18 -0700)]
Private API for RefreshMemoryLimit (#83707)

15 months ago[mono][wasm] Avoid stripping the runtimes built by the make targets in src/mono/wasm...
Zoltan Varga [Wed, 19 Apr 2023 04:06:12 +0000 (00:06 -0400)]
[mono][wasm] Avoid stripping the runtimes built by the make targets in src/mono/wasm. (#85021)

15 months agoUpdating XML doc comments for hardware intrinsics to include VEX and EVEX forms ...
Tanner Gooding [Wed, 19 Apr 2023 03:23:49 +0000 (20:23 -0700)]
Updating XML doc comments for hardware intrinsics to include VEX and EVEX forms (#84892)

* Updating XML doc comments for hardware intrinsics to include VEX and EVEX forms

* Fixing a formatting issue

* Ensure all changes are actually committed

* Apply suggestions from code review

Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com>
* Add back a using that got removed in the merge

---------

Co-authored-by: Clinton Ingram <clinton.ingram@outlook.com>
15 months agoIncrease the opcode value for opcodes where the jiterpreter is able to unroll fixed...
Katelyn Gadd [Wed, 19 Apr 2023 01:39:34 +0000 (18:39 -0700)]
Increase the opcode value for opcodes where the jiterpreter is able to unroll fixed-size sets and moves (#85007)

15 months agoReduce the number of hwintrinsic tests by removing no longer interesting scenarios...
Tanner Gooding [Wed, 19 Apr 2023 01:35:44 +0000 (18:35 -0700)]
Reduce the number of hwintrinsic tests by removing no longer interesting scenarios (#85008)

* Reduce striping for HWIntrinsic tests now that they're filtered a bit more

* Reduce the number of hwintrinsic tests by removing no longer interesting scenarios

* Minor comment change to trigger test runs

15 months agoDisable TLS field access for Arm (#84954)
Kunal Pathak [Tue, 18 Apr 2023 23:28:05 +0000 (16:28 -0700)]
Disable TLS field access for Arm (#84954)

* Disable TLS field access for Arm

* Update src/coreclr/jit/helperexpansion.cpp

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Revert "Add issues.targets entries for four tests failing on Windows arm (#84943)"

This reverts commit 80ce3b666823f2855b678307850e719a5f7366af.

---------

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
15 months agoAvoid unnecessary array allocation in DateTimeParse (#84964)
Stephen Toub [Tue, 18 Apr 2023 23:22:21 +0000 (19:22 -0400)]
Avoid unnecessary array allocation in DateTimeParse (#84964)

When using DateTime{Offset}.ParseExact with a culture that employs genitive month names, the public DateTimeFormatInfo.AbbreviatedMonthGenitiveNames and DateTimeFormatInfo.MonthGenitiveNames properties are being accessed to get a string[] of the month names, but those properties clone.  If we instead access the internal non-cloning version, we save on an array allocation on each parse.

15 months agoDon't contain operands for intrinsics when generating a jmp table fallback (#84933)
Tanner Gooding [Tue, 18 Apr 2023 23:19:39 +0000 (16:19 -0700)]
Don't contain operands for intrinsics when generating a jmp table fallback (#84933)

15 months agoAdd config binder generator to ASP.NET Core transport pack (#84436)
Layomi Akinrinade [Tue, 18 Apr 2023 23:18:36 +0000 (16:18 -0700)]
Add config binder generator to ASP.NET Core transport pack (#84436)

15 months agoRevert Deflater/Inflater changes around SafeHandle initialization (#85001)
Stephen Toub [Tue, 18 Apr 2023 23:18:02 +0000 (19:18 -0400)]
Revert Deflater/Inflater changes around SafeHandle initialization (#85001)

Deflater/Inflater's ctor calls a P/Invoke that initializes a SafeHandle.  Previously this was being done to directly initialize a field, but I'd changed that months ago due to it leaving a handle for finalization.  What I failed to notice, however, was that these types themselves defined finalizers, and those finalizers expected that SafeHandle field to have been initialized; now that it's not, if a rare zlib initialization error occurs (e.g. zlib couldn't be found/loaded), the finalizer may crash the process due to an unhandled null reference exception.

For Deflater, it'd be possible to just call GC.SuppressFinalize(this) inside the existing catch block that's disposing of the SafeHandle in the event of an exception.  But it's more complicated for Inflater, where the SafeHandle might be recreated during the Inflater's lifetime, and thus the existing catch block is inside of a helper method that's used from more than just the ctor, and we shouldn't be suppressing finalization in that case.

So, rather than do something complicated for the small gains this provided (it was part of a much larger sweep to clean up non-disposed SafeHandles), I've just reverted these cases.

15 months agoFix running tests against our DNNE'd NativeExports project to work in NativeAOT ...
Jeremy Koritzinsky [Tue, 18 Apr 2023 23:14:37 +0000 (16:14 -0700)]
Fix running tests against our DNNE'd NativeExports project to work in NativeAOT (#84578)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
15 months ago[JIT] ARM32/ARM64 - Fixed zero/sign-extension for `GT_STORE_LCL_VAR` in codegen ...
Will Smith [Tue, 18 Apr 2023 19:42:00 +0000 (12:42 -0700)]
[JIT] ARM32/ARM64 - Fixed zero/sign-extension for `GT_STORE_LCL_VAR` in codegen (#84716)

* Try to zero-extend if it is possible

* Added test

* Fix arm32 as well

* Remove branch check for arm32. Added more specific check for arm64.

* Remove unwanted code

* Trying to fix build

* use general register check

* Update Runtime_84693.cs

15 months agoExpose AVX512 variants of SSE-SSE4.2 instructions (#84909)
Tanner Gooding [Tue, 18 Apr 2023 19:29:14 +0000 (12:29 -0700)]
Expose AVX512 variants of SSE-SSE4.2 instructions (#84909)

* Ensure already exposed AVX512 APIs are in the right ISAs

* Exposing Add and Subtract for AVX512F and AVX512BW

* Exposing Abs for AVX512F, AVX512F.VL, and AVX512BW

* Exposing AddSaturate and SubtractSaturate for AVX512BW

* Expose AlignRight and Average for AVX512BW

* Expose ConvertToVector* for AVX512F and AVX512BW

* Expose Divide, Multiply, MultiplyAddAdjacent, MultiplyLow, and MultiplyHigh for AVX512F, AVX512BW, AVX512DQ, and AVX512DQ.VL

* Expose DuplicateEvenIndexed and DuplicateOddIndexed in Avx512F

* Expose LoadAlignedVector512NonTemporal in Avx512F

* Expose Max and Min for Avx512F, Avx512F.VL, and Avx512BW

* Expose PackSignedSaturate and PackUnsignedSaturate for Avx512BW

* Expose ShiftLeftLogical, ShiftLeftLogical128BitLane, ShiftRightArithmetic, ShiftRightLogical, and ShiftRightLogical128BitLane for Avx512F, Avx512F.VL, and Avx512BW

* Expose Shuffle, ShuffleLow, and ShuffleHigh for Avx512F and Avx512BW

* Expose Sqrt and SumAbsoluteDifferences for Avx512F and Avx512BW

* Expose UnpackLow and UnpackHigh for Avx512F and Avx512BW

* Ensure Avx2.Shuffle correctly handles containment for pshufb

* Apply formatting patch

* Fixing a couple of minor asserts

* Ensure TYP_DOUBLE is correctly handled for arithmetic right shift

* Work around an SPMI failure with the baseline

* Fixing some test logic to account for "per lane" operations on 512-bit vectors

* Ensure we don't fail for 64-bit vector multiplication on 32-bit

15 months agowhen applying/removing breapoints, try PAGE_EXECUTE_WRITECOPY as well (#84965)
Vladimir Sadov [Tue, 18 Apr 2023 19:07:58 +0000 (12:07 -0700)]
when applying/removing breapoints, try PAGE_EXECUTE_WRITECOPY as well (#84965)

15 months agoSplit PortableThreadPool.WorkerThread start and loop body (#84490)
Aleksey Kliger (λgeek) [Tue, 18 Apr 2023 18:29:11 +0000 (14:29 -0400)]
Split PortableThreadPool.WorkerThread start and loop body (#84490)

This is Part 1 of https://github.com/dotnet/runtime/issues/84489 - landing support for async JS interop on threadpool threads in multi-threaded WebAssembly.

We will need to start the threadpool worker threads on the browser in a special way, such that they can exit back to the JS event loop, and use callbacks to run the worker loop body.

The current PR splits into a separate file the logic for starting threadpool worker threads, and the outer loop that waits for the semaphore that signals that work is available for the worker. The loop body (to be shared with the callback-based approach in a future PR) remains in PortableThreadPool.WorkerThread.cs as several new toplevel functions.

Current PR is just refactoring existing code. No functional change.

* Split PortableThreadPool.WorkerThread start and loop body

   For browser-wasm we will need to start the worker thread in a special way, and use callbacks to run the loop body.

   Current PR is just refactoring existing code. No functional change.

* Change loop to use return instead of break

* rename utility method to ShouldExitWorker

15 months ago[tests] Stand up iOS arm runtime tests and enable tracing/eventpipe tests (#79169)
Mitchell Hwang [Tue, 18 Apr 2023 17:46:32 +0000 (13:46 -0400)]
[tests] Stand up iOS arm runtime tests and enable tracing/eventpipe tests (#79169)

Stand up iOS arm runtime tests and enable tracing/eventpipe tests

---------

Co-authored-by: Nathan Ricci <naricc@microsoft.com>
Co-authored-by: Milos Kotlar <kotlarmilos@gmail.com>
15 months agoPublish Aggregated Values For `Counter` and `UpDownCounter` For System.Diagnostics...
kkeirstead [Tue, 18 Apr 2023 17:15:24 +0000 (10:15 -0700)]
Publish Aggregated Values For `Counter` and `UpDownCounter` For System.Diagnostics.Metrics (#84846)

15 months agoFix OperatingSystemTest.TestIsOSPlatform_MacCatalyst (#84842)
Alexander Köplinger [Tue, 18 Apr 2023 16:36:42 +0000 (18:36 +0200)]
Fix OperatingSystemTest.TestIsOSPlatform_MacCatalyst (#84842)

It got broken by 3d160bc247960bb255bb45421f422d6bd543f2e2 because the assert wasn't updated.
Changed the code to verify the iOS/Catalyst conditions explicitly so this doesn't happen again.

15 months ago[browser] Minimal blazor.boot.json integration (#84296)
Marek Fišera [Tue, 18 Apr 2023 15:56:48 +0000 (17:56 +0200)]
[browser] Minimal blazor.boot.json integration (#84296)

15 months agoBump expected Dwarf warning count (#84980)
Jan Kotas [Tue, 18 Apr 2023 15:45:10 +0000 (08:45 -0700)]
Bump expected Dwarf warning count (#84980)

Fixes #84979

15 months agoFix R2R test build (#84952)
Sven Boemer [Tue, 18 Apr 2023 15:03:49 +0000 (08:03 -0700)]
Fix R2R test build (#84952)

887c043eb94be364188e2b23a87efa214ea57f1e broke the outerloop R2R
jobs, because the x64 musl build became a cross build, but the
R2R test compilation did not use the x64 glibc hosted crossgen2.

Fixed by using the crossgen2 that is built during the cross-components
build, when cross-targeting.

15 months agoAdd binary support to number formatting (#84889)
Stephen Toub [Tue, 18 Apr 2023 14:49:47 +0000 (10:49 -0400)]
Add binary support to number formatting (#84889)

* Add binary support to number formatting

* Fix inlining of Convert.ToString

It's now typically inlined by the JIT if toBase is a const.

15 months agoSplit the MergedTestWrapper for the HWIntrinsic tests so we can actually filter per...
Tanner Gooding [Tue, 18 Apr 2023 14:48:38 +0000 (07:48 -0700)]
Split the MergedTestWrapper for the HWIntrinsic tests so we can actually filter per platform (#84959)

* Split the MergedTestWrapper for the HWIntrinsic tests so we can actually filter per platform

* Small formatting change to force JIT tests to run

* Further split x86 hwintrinsic tests into X86, X86_Avx, and X86_Avx512

15 months ago[LoongArch64] Fix the compiling errors for aligned and definiations. (#84971)
Qiao Pengcheng [Tue, 18 Apr 2023 14:08:22 +0000 (10:08 -0400)]
[LoongArch64] Fix the compiling errors for aligned and definiations. (#84971)

15 months ago[LoongArch64] fix the CMakeLists which destroyed by RISCV #82381. (#84970)
Qiao Pengcheng [Tue, 18 Apr 2023 14:06:23 +0000 (10:06 -0400)]
[LoongArch64] fix the CMakeLists which destroyed by RISCV #82381. (#84970)

15 months agoOSDescription.Linux: return a user-friendly name based on /etc/os-release. (#83976)
Tom Deseyn [Tue, 18 Apr 2023 12:10:43 +0000 (14:10 +0200)]
OSDescription.Linux: return a user-friendly name based on /etc/os-release. (#83976)

* OSDescription.Linux: return a user-friendly name based on /etc/os-release.

* Use FileCleanupTestBase.

* Avoid some allocations by using Span.

* expectedName can be null.

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Break when we encounter PRETTY_NAME.

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
15 months ago[main] Update dependencies from dotnet/roslyn-analyzers (#84708)
dotnet-maestro[bot] [Tue, 18 Apr 2023 07:36:21 +0000 (09:36 +0200)]
[main] Update dependencies from dotnet/roslyn-analyzers (#84708)

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

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23207.2 -> To Version 3.3.5-beta1.23212.1

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

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23207.2 -> To Version 3.3.5-beta1.23213.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
15 months ago[browser][non-icu] `HybridGlobalization` SortKey (#84621)
Ilona Tomkowicz [Tue, 18 Apr 2023 07:32:31 +0000 (09:32 +0200)]
[browser][non-icu] `HybridGlobalization` SortKey (#84621)

* Throw on SortKey.

* Fix NLS tests.

* Do not add these files for WASI.

* Removed WASI from targets.

* Run tests with HG only on browser, rename.

* Missing WASI removal.

* General docs fix.

* Storing exception text as resource string.

15 months agoFix Environment.GetCommandLineArg for AOT compiled libraries (#84953)
Jan Kotas [Tue, 18 Apr 2023 05:52:02 +0000 (22:52 -0700)]
Fix Environment.GetCommandLineArg for AOT compiled libraries (#84953)

Made the implementation shared between standard CoreCLR and native AOT

Fixes #84944

15 months agoFix Type.GetType for global type names with leading '.' (#84957)
Jan Kotas [Tue, 18 Apr 2023 05:51:19 +0000 (22:51 -0700)]
Fix Type.GetType for global type names with leading '.' (#84957)

Ignore leading '.' for global typenames for compatibility with earlier .NET versions.

Fixes #84644

15 months agoAdjust managed type system for new function pointer handling (#84819)
Michal Strehovský [Tue, 18 Apr 2023 03:11:52 +0000 (12:11 +0900)]
Adjust managed type system for new function pointer handling (#84819)

After #81006, the calling convention is no longer part of the type system identity of a function pointer type - it serves more like a modopt as far as the type system is concerned. The type system only cares whether the pointer is managed or not. Adjust the managed type system accordingly:

* If we're reading/representing a standalone method signature, read it as usual. Calling convention is available in flags/modopts.
* If we're reading/representing a function pointer type, collapse the calling convention information into the managed/unmanaged bit only.

15 months ago[RISC-V] Disable corelib crossgen2 (#84781)
Dong-Heon Jung [Tue, 18 Apr 2023 02:32:35 +0000 (11:32 +0900)]
[RISC-V] Disable corelib crossgen2 (#84781)

15 months agoStart running Loader and Interop tests for NativeAOT (#84404)
Michal Strehovský [Tue, 18 Apr 2023 02:18:01 +0000 (11:18 +0900)]
Start running Loader and Interop tests for NativeAOT (#84404)

These are the most interesting ones to cover in regular testing.

15 months agoReconfigure the HWIntrinsic tests to run more selectively (#84948)
Tanner Gooding [Mon, 17 Apr 2023 23:29:15 +0000 (16:29 -0700)]
Reconfigure the HWIntrinsic tests to run more selectively (#84948)

* Increase the number of stripes to use in stress for HardwareIntrinsics tests

* Reconfigure the HWIntrinsic tests to run more selectively

* Fix a _ro.csproj

15 months agofix aarch64+clang compilation errors (#84947)
lexi-nadia [Mon, 17 Apr 2023 23:24:04 +0000 (19:24 -0400)]
fix aarch64+clang compilation errors (#84947)

* don't use the gcc workaround on clang

clang doesn't need it, and clang also doesn't support the `optimize`
attribute.

* cast _zzq_default to a 64-bit type

Otherwise, clang complains that "value-size does not match register size",
since the 32-bit value (generally a literal 0) doesn't match the 64-bit
x3 register.

15 months agoAdd issues.targets entries for four tests failing on Windows arm (#84943)
Tomáš Rylek [Mon, 17 Apr 2023 22:55:02 +0000 (00:55 +0200)]
Add issues.targets entries for four tests failing on Windows arm (#84943)

After several fixes and additions to issues.targets I'm now seeing
a relatively limited set of tests failing on Windows arm with
a nullref tracked under

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

This should finally let us see a green outerloop run despite the
fact that some additional rare failures still remain, I've seen
a few in the runs from the last couple of days.

Thanks

Tomas

15 months agoRe-enable gc-sections with lld for NativeAOT (#84935)
Sven Boemer [Mon, 17 Apr 2023 22:49:02 +0000 (15:49 -0700)]
Re-enable gc-sections with lld for NativeAOT (#84935)

* Revert "Revert "Write linker script for lld to enable gc-sections (#84493)""

This reverts the revert of commit 3ab663e128e233ad1f4a1a4a0df64b08a846bcd5.
The revert of that commit was included in 887c043eb94be364188e2b23a87efa214ea57f1e.

* Lower the lld version requirement

* Adjust dwarfdump baseline

---------

Co-authored-by: Adeel <3840695+am11@users.noreply.github.com>
15 months agoDeduplicate Binary Integer parsing logic (#84582)
Tanner Gooding [Mon, 17 Apr 2023 22:28:40 +0000 (15:28 -0700)]
Deduplicate Binary Integer parsing logic (#84582)

* Deduplicate TryNumberToInt*

* Deduplicate TryParseInt*IntegerStyle parsing methods

* Deduplicate TryParseInt*HexNumberStyle

* Deduplicate TryParseInt*Number

* Deduplicate TryParseInt*

* Deduplicate ParseInt*

* Deduplicate some more binary integer parsing logic

* Ensure the right overflow message is used for binary integer parsing

* Ensure HasTrailingCharsZero handling is in the right spot

* Resolving PR feedback

* Revert using the public throw helpers

15 months agoMemory Diagnostics: GC Bookkeeping (#84454)
Lee Culver [Mon, 17 Apr 2023 21:09:56 +0000 (14:09 -0700)]
Memory Diagnostics: GC Bookkeeping (#84454)

* Add ISOSMemoryEnum and HandleTable enum

* Update comment

* Add GC Bookkeeping data to the dac

- bookkeeping_covered_start is now compiled into all versions of the GC, instead of just with USE_REGIONS.  This allows us to find the base address of the allocated memory for GC Bookkeeping.
- Added dac enumeration of GC Bookkeeping.

* Add assert

* Add support for free gc regions

* Don't require card_table_element_layout

* Fix issue with naming in request

* Remote DEFINE_MISSING_FIELD from dac

We should never have missing fields in the dac.  This is a leftover from
previous code.

* Whitespace fix

* Break if we loop

* Fix static_assert

* Segment fixes

When using segments, update bookkeeping_covered_start and card_table_info.size when we update the card table.

* Defensive coding

Check how many times we loop through memory to guard against heap corruption.

* free_region fixes

* Remove hardcoding of region list

* Fix gcc warnings

* Remove unneeded #define

* Add freeable_soh_segment/freeable_uoh_segment

* Add more card table checks

* Fix field definition issue

* Fix pointer issue

* Fix compile issue

* Rename bookkeeping_covered_start to bookkeeping_start

* Update src/coreclr/debug/daccess/daccess.cpp

Co-authored-by: Andrew Au <cshung@gmail.com>
* Code review feedback

* Remove unused parameter

* Add heap number

---------

Co-authored-by: Andrew Au <andrewau@microsoft.com>
Co-authored-by: Andrew Au <cshung@gmail.com>
15 months agoFix JIT use of BitScan* APIs (#84915)
Bruce Forstall [Mon, 17 Apr 2023 21:05:07 +0000 (14:05 -0700)]
Fix JIT use of BitScan* APIs (#84915)

* Fix JIT use of BitScan* APIs

windows.h defines the BitScan* APIs with a leading underscore
and includes `#define` definitions of non-underscore versions
to the underscore versions.

This is annoying in the JIT, where we have a BitOperations class that
uses these same names; the class members end up with leading underscores
and it confuses Visual Studio source browsing.

In the JIT, `#undef` the windows.h underscore defines. Define pass-through
non-underscore functions to call the actual functions. (We need to always
call the non-underscore versions because that is what is defined in the PAL.)
Replace usage of bitposition.h in the JIT and remove it from utilcode.h
(only one other place in the CLR uses it and they already include it.)

* Fixes

1. Remove unused genFindHighestBit
2. Remove genFindLowestReg
3. Remove BitScanForwardPtr
4. Put BitScanForward64/BitScanReverse64 under `HOST_64BIT`

15 months agoFix nativeaot libraries test cross-build (#84870)
Sven Boemer [Mon, 17 Apr 2023 20:43:19 +0000 (13:43 -0700)]
Fix nativeaot libraries test cross-build (#84870)

15 months agoIntegrate compression from StaticWebAssets (#84924)
Marek Fišera [Mon, 17 Apr 2023 20:24:50 +0000 (22:24 +0200)]
Integrate compression from StaticWebAssets (#84924)

15 months agoEnable AVX-512 for string/span Equals/StartsWith (#84885)
Egor Bogatov [Mon, 17 Apr 2023 18:40:18 +0000 (20:40 +0200)]
Enable AVX-512 for string/span Equals/StartsWith (#84885)

15 months ago[JIT] ARM64 - Combine `cmp` and shift ops into a single `cmp` op (#84605)
Will Smith [Mon, 17 Apr 2023 18:32:38 +0000 (11:32 -0700)]
[JIT] ARM64 - Combine `cmp` and shift ops into a single `cmp` op (#84605)

* Combine compare and shift ops into a single compare op

* Fix comment

* Expanding IsContainableBinaryOp.

* Remove commented code

* Added more cases

* Update codegenarm64.cpp

* Feedback

* Feedback

15 months agoAdd status code and exception info to System.Net.Http events (#84036)
Miha Zupan [Mon, 17 Apr 2023 17:12:21 +0000 (19:12 +0200)]
Add status code and exception info to System.Net.Http events (#84036)

* Add status code and exception info to System.Net.Http events

* Update HttpTelemetry fake