platform/upstream/dotnet/runtime.git
19 months agoRevert "Revert Allow some intrinsics in Tier0" (#82354)
Egor Bogatov [Mon, 20 Feb 2023 14:00:07 +0000 (15:00 +0100)]
Revert "Revert Allow some intrinsics in Tier0" (#82354)

19 months agoUnify type instantiations in reflection emit (#81518)
Buyaa Namnan [Mon, 20 Feb 2023 10:31:48 +0000 (02:31 -0800)]
Unify type instantiations in reflection emit (#81518)

19 months agoUpdate NativeAOT build integration targets to include ioslike platforms (#82086)
Milos Kotlar [Mon, 20 Feb 2023 09:09:49 +0000 (10:09 +0100)]
Update NativeAOT build integration targets to include ioslike platforms (#82086)

* Adjust Native AOT build integration targets to include ioslike platforms

* Exclude <NativeFramework Include=GSS /> for tvOS[simulator]

* Exclude System.Globalization.Native and System.Security.Cryptography.Native.OpenSsl for iOS platforms

* Exclude System.Globalization.Native and System.Security.Cryptography.Native.OpenSsl for iOSLike platforms
---------

Co-authored-by: Filip Navara <filip.navara@gmail.com>
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
19 months agoTiny speedup to HasGenericVirtualMethods (#82383)
Michal Strehovský [Mon, 20 Feb 2023 08:06:59 +0000 (17:06 +0900)]
Tiny speedup to HasGenericVirtualMethods (#82383)

This avoids materializing/resolving non-virtual methods.

19 months ago[main] Update dependencies from dotnet/llvm-project dotnet/icu dotnet/xharness dotnet...
dotnet-maestro[bot] [Mon, 20 Feb 2023 03:29:46 +0000 (21:29 -0600)]
[main] Update dependencies from dotnet/llvm-project dotnet/icu dotnet/xharness dotnet/runtime-assets (#82206)

* Update dependencies from https://github.com/dotnet/llvm-project build 20230214.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.23113.3 -> To Version 14.0.0-alpha.1.23114.1

* Update dependencies from https://github.com/dotnet/runtime-assets build 20230213.1

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Data.Common.TestData , System.Drawing.Common.TestData , System.Formats.Tar.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 8.0.0-beta.23110.1 -> To Version 8.0.0-beta.23113.1

* Update the min and max warnings with the debugging fixes

* Update dependencies from https://github.com/dotnet/icu build 20230216.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.2.23113.1 -> To Version 8.0.0-preview.2.23116.1

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

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

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Andy Gocke <andy@commentout.net>
19 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230217...
dotnet-maestro[bot] [Mon, 20 Feb 2023 03:23:57 +0000 (21:23 -0600)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230217.2 (#82343)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23116.1 -> To Version 3.3.5-beta1.23117.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
19 months agoEnable EventPipe when EventSource is enabled (#82200)
Lakshan Fernando [Mon, 20 Feb 2023 02:51:15 +0000 (18:51 -0800)]
Enable EventPipe when EventSource is enabled (#82200)

19 months agoConvert a few more byte[]s to u8s (#82358)
Stephen Toub [Mon, 20 Feb 2023 00:58:55 +0000 (19:58 -0500)]
Convert a few more byte[]s to u8s (#82358)

19 months agoFix ISOSDacInterface::TraverseLoaderHeap (#82371)
Lee Culver [Mon, 20 Feb 2023 00:02:23 +0000 (16:02 -0800)]
Fix ISOSDacInterface::TraverseLoaderHeap (#82371)

* Revert "Fix sos.eeheap's LoaderCodeHeap sizes (#67885)"

This reverts commit 1ad94b3487b4a3a88ed71d1ccc5b9d04384718f0.

* Define ISOSDacInterface13

* Implement ISOSDacInterface13

* Enumerate the vtable_heap in DacDbiInterfaceImpl::EnumerateMemRangesForLoaderAllocator

* Increase bounds check

19 months agoRefactor computing lvaLongVars/lvaFloatVars (#82331)
Bruce Forstall [Sun, 19 Feb 2023 19:20:18 +0000 (12:20 -0700)]
Refactor computing lvaLongVars/lvaFloatVars (#82331)

Compute them before loop hoisting, where they are actually used,
not at the beginning of value numbering.

19 months agoDisable bigevent test under GCStress (#82353)
Bruce Forstall [Sun, 19 Feb 2023 19:18:35 +0000 (12:18 -0700)]
Disable bigevent test under GCStress (#82353)

Tracking: https://github.com/dotnet/runtime/issues/82251

19 months agoClean up hex formatting, vectorize Guid.TryFormat for UTF8 (#81666)
Egor Bogatov [Sun, 19 Feb 2023 10:06:54 +0000 (11:06 +0100)]
Clean up hex formatting, vectorize Guid.TryFormat for UTF8 (#81666)

19 months agoKeep side effects in impOptimizeCastClassOrIsInst (#82346)
Egor Bogatov [Sun, 19 Feb 2023 08:14:07 +0000 (09:14 +0100)]
Keep side effects in impOptimizeCastClassOrIsInst (#82346)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
19 months agoOptimize JIT_ClassProfile32 (#82014)
Egor Bogatov [Sat, 18 Feb 2023 21:46:56 +0000 (22:46 +0100)]
Optimize JIT_ClassProfile32 (#82014)

19 months agoRemove unused block flags (#82330)
Bruce Forstall [Sat, 18 Feb 2023 20:36:57 +0000 (13:36 -0700)]
Remove unused block flags (#82330)

BBF_VISITED and BBF_CHANGED were unused; remove them.

Reordered the flags a bit to put related flags together.

19 months agoStop setting DOTNET_JitStress in a couple of newly added tests (#82341)
Jakob Botsch Nielsen [Sat, 18 Feb 2023 20:05:09 +0000 (21:05 +0100)]
Stop setting DOTNET_JitStress in a couple of newly added tests (#82341)

Workaround #82164.

Runtime_81585 did not need any stress mode to repro, and the other one
needs only STRESS_FOLD.

19 months agoRevert "update alpine test images" (#82309)
Marie Píchová [Sat, 18 Feb 2023 08:58:19 +0000 (09:58 +0100)]
Revert "update alpine test images" (#82309)

* Revert "update alpine test images (#81841)"

This reverts commit 82c891831b373b17c659fed036743e3652dda54d.

* Update eng/pipelines/libraries/helix-queues-setup.yml

* Update eng/pipelines/libraries/helix-queues-setup.yml

19 months agoFix FnPtrTypeDesc::GetManagedClassObject (#82325)
Jan Kotas [Sat, 18 Feb 2023 03:16:55 +0000 (19:16 -0800)]
Fix FnPtrTypeDesc::GetManagedClassObject (#82325)

* Fix FnPtrTypeDesc::GetManagedClassObject

The code was missing support for allocating RuntimeType objects on frozen heap

Fixes #82252

* Revert "Disable System.Reflection.Tests.TypeDelegatorTests.FunctionPointers (#82321)"

This reverts commit 473e278471c08b862b8ea631aa0fd65eb78757e1.

19 months agoImplementation of Lemire's nearly divisionless method (#79790)
Morten Larsen [Sat, 18 Feb 2023 03:00:06 +0000 (04:00 +0100)]
Implementation of Lemire's nearly divisionless method (#79790)

* Lemire implementation

* Cleanup

* Article reference

* Fix

* Fixes

* Comment out implementation specific tests in Xoshiro_AlgorithmBehavesAsExpected

* Fix

* Reenable sufficient checks for Xoshiro_AlgorithmBehavesAsExpected

* Fix

* Add third party notice

* Resolve comments

* Resolve comments

* Resolve comments

* Resolve comments

* Refactor implementation to separate class

* Typo fix

* stephentoub's refactor

* Reverting NextInt64 on Xoshiro128

* Adjust test

* Update src/libraries/System.Private.CoreLib/src/System/Random.Xoshiro128StarStarImpl.cs

---------

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
19 months ago[MONO] Implement GC.AddMemoryPressure in Mono (#82121)
Nathan Ricci [Sat, 18 Feb 2023 01:15:50 +0000 (20:15 -0500)]
[MONO] Implement GC.AddMemoryPressure in Mono (#82121)

Implementation of AddMemoryPressure in Mono

19 months agoDisable System.Reflection.Tests.TypeDelegatorTests.FunctionPointers (#82321)
Bruce Forstall [Sat, 18 Feb 2023 00:17:34 +0000 (17:17 -0700)]
Disable System.Reflection.Tests.TypeDelegatorTests.FunctionPointers (#82321)

Disable this failing test on CoreCLR.

Tracking: https://github.com/dotnet/runtime/issues/82252

19 months ago[JIT] LclMorph `GT_IND(GT_LCL_VAR_ADDR)` => `GT_CAST(GT_LCL_VAR)` narrow-cast only...
Will Smith [Fri, 17 Feb 2023 23:19:40 +0000 (15:19 -0800)]
[JIT] LclMorph `GT_IND(GT_LCL_VAR_ADDR)` => `GT_CAST(GT_LCL_VAR)` narrow-cast only (#81454)

* Experiment with folding IND(GT_LCL_VAR_ADDR)

* Fix assertion

* Remove duplicate code

* Handling long types

* Handling long types

* Handling long types

* Handling long types

* Trying to fix build

* Trying to fix build

* Trying to fix builds

* Added IndirTransform::CastOfLclVar

* Fixing build

* Some formatting

* Skip isDef

* Formatting

* Fixed AV

* Enable long

* Renamed CastOfLclVar to NarrowCastOfLclVar

* Trying out wide-cast ind(lcl_var_addr) => cast(lcl_var)

* Formatting

* Remove widening

* Added a comment. Added disasm tests.

* Fixing tests

* Rename NarrowCastOfLclVar to NarrowCast

* Feedback

* Feedback

* Update src/coreclr/jit/lclmorph.cpp

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
---------

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
19 months agoFix for issue #80350 tracking runtime deficiencies in the presence of static virtual...
Tomáš Rylek [Fri, 17 Feb 2023 23:01:13 +0000 (00:01 +0100)]
Fix for issue #80350 tracking runtime deficiencies in the presence of static virtual method reabstraction (#80987)

This change fixes the issue #80350 that uncovered several
inconsistencies in the CoreCLR runtime w.r.t. static virtual methods.
In particular, reabstraction (declaring an abstract explicit override
of a static virtual method in a derived interface) turned out to be
causing runtime issues. As part of the change I'm also fixing the
reabstraction unit test svm_diamondshape as it turns out Roslyn emits
the method flags in a slightly different manner than I originally
expected in the hand-written IL test. Based on discussion with the
Mono team I have had to temporarily disable the svm_diamondshape
test on Mono before the correct fix is found.

Thanks

Tomas

19 months agoRemove some remnants of multi-module support (#82046)
Elinor Fung [Fri, 17 Feb 2023 21:53:52 +0000 (13:53 -0800)]
Remove some remnants of multi-module support  (#82046)

- `Module::GetModuleRef` always returns `mdFileNil`
- `Module::m_FileReferencesMap` only ever stored/returned the module itself

19 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230216...
dotnet-maestro[bot] [Fri, 17 Feb 2023 21:47:10 +0000 (15:47 -0600)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230216.1 (#82295)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23111.1 -> To Version 3.3.5-beta1.23116.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
19 months agoAdd new proposed API to Ancillary.Interop (#81063)
Jackson Schuster [Fri, 17 Feb 2023 20:27:27 +0000 (12:27 -0800)]
Add new proposed API to Ancillary.Interop (#81063)

Updates the VTableStubGenerator to use the latest version of the proposed API.

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
19 months agoDirectory.Build.props: define RuntimeConfiguration before it's used. (#82302)
Tom Deseyn [Fri, 17 Feb 2023 18:56:12 +0000 (19:56 +0100)]
Directory.Build.props: define RuntimeConfiguration before it's used. (#82302)

19 months agoFix runtime-community pipeline (#82265)
Adeel Mujahid [Fri, 17 Feb 2023 18:00:25 +0000 (20:00 +0200)]
Fix runtime-community pipeline (#82265)

19 months agoRemove range check in VSB.Append(char) (#82264)
Miha Zupan [Fri, 17 Feb 2023 17:37:42 +0000 (18:37 +0100)]
Remove range check in VSB.Append(char) (#82264)

19 months ago[wasm] Disable function pointer tests on browser (#82285)
Marek Fišera [Fri, 17 Feb 2023 17:12:50 +0000 (18:12 +0100)]
[wasm] Disable function pointer tests on browser (#82285)

19 months ago[mono][aot] Enable dedup by default for iOS (#81319)
Milos Kotlar [Fri, 17 Feb 2023 15:48:41 +0000 (16:48 +0100)]
[mono][aot] Enable dedup by default for iOS (#81319)

* Enable dedup in HelloiOS app

* Disable call transformation for MONO_PATCH_INFO_METHOD as some callees require initialization

* Fix build warnings

* Enable dedup by default for ios

19 months agoThe path of androd_sdk was changed. (#82256)
Thays Grazia [Fri, 17 Feb 2023 15:19:35 +0000 (12:19 -0300)]
The path of androd_sdk was changed. (#82256)

19 months agoRemove iossimulator_x86 from helix-queues-setup.yml (#82244)
Alexander Köplinger [Fri, 17 Feb 2023 12:28:21 +0000 (13:28 +0100)]
Remove iossimulator_x86 from helix-queues-setup.yml (#82244)

Forgot this one in https://github.com/dotnet/runtime/pull/81965

19 months agoInstall native dependencies on all Apple OS in CI (#82263)
Adeel Mujahid [Fri, 17 Feb 2023 12:19:43 +0000 (14:19 +0200)]
Install native dependencies on all Apple OS in CI (#82263)

19 months agoFix ds-ipc-pal-socket.c Windows build. (#77840)
Johan Lorensson [Fri, 17 Feb 2023 10:37:11 +0000 (11:37 +0100)]
Fix ds-ipc-pal-socket.c Windows build. (#77840)

Mainly build on mobile platforms, but beneficial if it works on Windows in order to test Mono TCP/IP EventPipe transport.

19 months ago[wasm] Better support for automated tests in jiterpreter; more opcodes (#82281)
Katelyn Gadd [Fri, 17 Feb 2023 06:13:48 +0000 (22:13 -0800)]
[wasm] Better support for automated tests in jiterpreter; more opcodes (#82281)

* [jiterp] Move enter_jiterpreter into a helper function, and call it immediately after compiling traces
This allows running tests under jiterp with hitcount=1 and tiering off
* Implement CONV_R_UN opcodes
* Implement INTRINS_ORDINAL_IGNORE_CASE_ASCII
* Remove the safepoint from tier_enter_jiterpreter, do it in traces instead

19 months ago[fabricbot] Treat needs-area-label as an area for Eric/Jeff (#82279)
Jeff Handley [Fri, 17 Feb 2023 02:10:39 +0000 (18:10 -0800)]
[fabricbot] Treat needs-area-label as an area for Eric/Jeff (#82279)

19 months agoFix disposing root X.509 certificate prematurely for OCSP stapling (#82116)
Kevin Jones [Fri, 17 Feb 2023 00:34:41 +0000 (19:34 -0500)]
Fix disposing root X.509 certificate prematurely for OCSP stapling (#82116)

In SslStreamCertificateContext, don't dispose of the root cert if it's about to be handed to the AddRootCert PAL call,
which was the high-level cause of a segfault when handling certificate chains of length 2 in OCSP Stapling on Linux.

This change additionally guards against disposed certificates in the OCSP Stapling retriever (disabling the feature
instead of segfaulting), and adds tests to ensure that we don't regress 2-cert chains in the future.

19 months ago[iOS] Disable additional sourcegenerator tests (#82184)
Steve Pfister [Fri, 17 Feb 2023 00:15:19 +0000 (19:15 -0500)]
[iOS] Disable additional sourcegenerator tests (#82184)

These aren't necessary to run on mobile targets, so skip them.

19 months agoFix clr build on illumos-x64 (#82183)
Adeel Mujahid [Thu, 16 Feb 2023 23:46:07 +0000 (01:46 +0200)]
Fix clr build on illumos-x64 (#82183)

* Fix clr build on illumos-x64

* Keep in sync with codeman

* Use CPUID_XXX

19 months ago[SuperFileCheck] Added verification when using 'FULL-LINE-NEXT'. Fixing ARM64 compari...
Will Smith [Thu, 16 Feb 2023 23:30:31 +0000 (15:30 -0800)]
[SuperFileCheck] Added verification when using 'FULL-LINE-NEXT'. Fixing ARM64 comparison tests. (#82135)

* Added SuperFileCheck verification when using 'FULL-LINE-NEXT'. Fixing ARM64 comparison disasm tests.

* Update Program.cs

* Update src/tests/JIT/opt/Compares/compares.cs

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
* Update compares.cs

* Update compares.cs

* Update compares.cs

* Update compares.cs

* Update compares.cs

* Update compares.cs

---------

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
19 months agoHold temporary keychain refs for certificates imported with X509Certificate2Collectio...
Filip Navara [Thu, 16 Feb 2023 23:20:42 +0000 (00:20 +0100)]
Hold temporary keychain refs for certificates imported with X509Certificate2Collection.Import

This corrects the reference counting for temporary keychains when using X509Certificate2Collection.Import,
both releasing a ref that is no longer needed, and adding a ref to the new/target keychain to prevent that
keychain from being deleted too soon.

19 months agoMark DivRem with RequiresPreviewFeatures (#82221)
Kunal Pathak [Thu, 16 Feb 2023 21:09:51 +0000 (13:09 -0800)]
Mark DivRem with RequiresPreviewFeatures (#82221)

* Add back DivRem in ref

* Remove fakelib from test projects

* Mark APIs with RequiresPreviewFeatures

* Revert compatibility changes in SPC

19 months agoAdd reflection introspection support for function pointers (#81006)
Steve Harter [Thu, 16 Feb 2023 20:39:53 +0000 (14:39 -0600)]
Add reflection introspection support for function pointers (#81006)

19 months ago[mono][interp] Initialize il_offset for allocated basic blocks (#82242)
Vlad Brezae [Thu, 16 Feb 2023 20:10:45 +0000 (22:10 +0200)]
[mono][interp] Initialize il_offset for allocated basic blocks (#82242)

Multiple areas of the interpreter expect all basic blocks to have an associated il_offset. During bblock reorder optimization, we were allocating a new bblock without initializing it with the offset of the preceding bblock.

19 months agoAdd copyright info to eventpipe files (#82232)
Lakshan Fernando [Thu, 16 Feb 2023 19:04:07 +0000 (11:04 -0800)]
Add copyright info to eventpipe files (#82232)

19 months agoMark .overrides from marked methods in a copy assembly (#82197)
Jackson Schuster [Thu, 16 Feb 2023 19:00:53 +0000 (11:00 -0800)]
Mark .overrides from marked methods in a copy assembly (#82197)

Fixes #81746

Static abstract interface methods that aren't used are expected to be removed, and any references to them in the metadata of the overriders are expected to be removed in SweepStep. However, overrides may come from a 'copy' assembly, so their metadata won't get swept at all. We would still remove the static abstract method, but would leave the reference to it in the overrider's metadata, creating invalid metadata.

This fixes the issue by making sure all methods referenced in the .overrides metadata of method X are marked if method X is in a copy assembly, where previously we would postpone marking the .overrides if the base was static abstract.

19 months agoJIT: fix some asserts in profile incorporation and reconstruction (#82196)
Andy Ayers [Thu, 16 Feb 2023 18:54:00 +0000 (10:54 -0800)]
JIT: fix some asserts in profile incorporation and reconstruction (#82196)

If we're instrumenting a Tier0 method with partial compilation enabled, we may
see divergence between the instrumentation plan phase (which runs before
importation) and the instrumentation phase (which runs after), because the
importer may have altered flow at partial compilation points. Tolerate this.

If we're instrumenting a Tier1 OSR method whose first block is a self-loop,
we may not see a pseudo-edge from the OSR entry to the method's first block
in the profile reconstruction model, because they are the same block.
Tolerate this.

Fixes #82128.

19 months agoAdd cmake check for ioclt prototype (#82173)
Adeel Mujahid [Thu, 16 Feb 2023 18:21:36 +0000 (20:21 +0200)]
Add cmake check for ioclt prototype (#82173)

* Add cmake check for ioclt prototype

* .

19 months agoupdate alpine test images (#81841)
Tomas Weinfurt [Thu, 16 Feb 2023 18:11:56 +0000 (10:11 -0800)]
update alpine test images (#81841)

* udpate alpine test images

* update images

* update test

* use production tags

19 months ago[main] Update dependencies from dotnet/arcade (#82230)
dotnet-maestro[bot] [Thu, 16 Feb 2023 16:50:02 +0000 (11:50 -0500)]
[main] Update dependencies from dotnet/arcade (#82230)

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.23113.1 -> To Version 8.0.0-beta.23115.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
19 months agoString.Split() trim last substring if specified (#81331)
Ondřej Kubíček [Thu, 16 Feb 2023 15:01:20 +0000 (16:01 +0100)]
String.Split() trim last substring if specified (#81331)

* String.Split() trim last substring if specified

* Update src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* doc update

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
19 months agoReplace `dynamic` with static math in a JIT test (#82073)
Michal Strehovský [Thu, 16 Feb 2023 15:00:22 +0000 (00:00 +0900)]
Replace `dynamic` with static math in a JIT test (#82073)

The test doesn't work with NativeAOT because of the `dynamic`. I believe this should be equivalent and less offensive.

19 months agoUpdate CODEOWNERS (#82131)
Katelyn Gadd [Thu, 16 Feb 2023 14:45:53 +0000 (06:45 -0800)]
Update CODEOWNERS (#82131)

* Update CODEOWNERS

Add owners filters for the jiterpreter and add myself to a few of the other lists

* Update CODEOWNERS

19 months ago[wasm][debugger] Skip wasm frames if just my code is enabled (#81732)
Thays Grazia [Thu, 16 Feb 2023 13:21:52 +0000 (10:21 -0300)]
[wasm][debugger] Skip wasm frames if just my code is enabled (#81732)

* Trying to avoid stepping out when there is no source available and justmycode is enabled.

* Skip only wasm frames.

* Fix test after using DebuggerNonUserCode on JSImport and JSExport.

* Fix stepping out when JustMyCode is enabled and the function that should be skipped is the last in the callstack.

* Fix side effect.

* addressing radical comments offline

19 months agoFill missing @mention data in area-owners.json (#82228)
Marek Safar [Thu, 16 Feb 2023 12:59:06 +0000 (13:59 +0100)]
Fill missing @mention data in area-owners.json (#82228)

19 months agoAvoid a RIP relative addressing pessimization (#82213)
Tanner Gooding [Thu, 16 Feb 2023 12:55:03 +0000 (04:55 -0800)]
Avoid a RIP relative addressing pessimization (#82213)

* Avoid a RIP relative addressing pessimization

* Applying formatting patch

19 months agoInclude more details in exception from wrong async callback (#82104)
Stephen Toub [Thu, 16 Feb 2023 12:12:36 +0000 (07:12 -0500)]
Include more details in exception from wrong async callback (#82104)

* Include more details in exception from wrong async callback

Every now and then, we get reports of an exception due to an invalid object being passed to one of our callback delegates that expects specific state.  To help diagnose those better, this adds more details about what state was actually provided.

* Fix inlining

19 months agoJIT: Expand loop detection in if-conversion (#82170)
Jakob Botsch Nielsen [Thu, 16 Feb 2023 12:01:09 +0000 (13:01 +0100)]
JIT: Expand loop detection in if-conversion (#82170)

The BB weight approach does not detect unnatural loops.

Fix #82106

19 months agoJIT: Slightly refactor handling of conditions/conditional branches in the backend...
Jakob Botsch Nielsen [Thu, 16 Feb 2023 09:36:08 +0000 (10:36 +0100)]
JIT: Slightly refactor handling of conditions/conditional branches in the backend (#82020)

Slightly refactor how compares are represented and processed in the backend in
preparation of lifting the remaining cmov restrictions.

- Change all compare nodes to always produce values and never set flags. That
  is, GT_EQ/GT_NE/GT_LT/GT_LE/GT_GE/GT_GT/GT_TEST_EQ/GT_TEST_NE now are all
  "normal" nodes, always.

- Stop optimizing compares by looking for a user JTRUE node. Instead, we
  optimize the compare when we see it (for example, EQ/NE(AND(x, y), 0) is
  turned into GT_TEST_EQ/GT_TEST_NE(x, y)), but we do not change the user JTRUE
  node to a JCC node. We now never create SETCC nodes when we see the compare,
  and we always turn JTRUE nodes into JCC nodes with a proper condition.

- Handle the transformation from JTRUE to JCC when we actually get to JTRUE. The
  transformation that now happens is:

  1. The compare node is turned into a GT_CMP (for GT_EQ to GT_GT) or GT_TEST
  node (for GT_TEST_EQ/GT_TEST_NE) node. These nodes are always void-typed and
  do not produce values; they only set the CPU flags, and correspond directly to
  low-level target instructions (like cmp/test).

  2. The JTRUE is turned into JCC with the condition from the compare.

  For arm64/xarch, we handle optimizing EQ/NE(node_that_sets_zero_flag, 0) at
  this stage too now.

- Introduce new xarch backend-only GT_BITTEST_EQ/GT_BITTEST_NE that semantically
  correspond to (x & (1 << y)) != 0. The corresponding "set flags" node is GT_BT
  and already exists. We would previously transform (x & (1 << y)) != 0 into
  GT_BT + GT_SETCC (when the user was not a JTRUE). This is now transformed into
  GT_BITTEST_EQ/GT_BITTEST_NE instead, which are completely normal nodes. The
  processing of JTRUE handles the transformation into BT + JCC.

- Change some of the emitter compare peepholes to work with this scheme. This
  requires some lookahead when we see them, but allows us to get rid of an
  "ugly" flag.

- Allow liveness to DCE GT_CMP/GT_TEST when they have had GTF_SET_FLAGS unset
  (due to FG optimizations). We already allowed this for GT_EQ, so this showed
  up as some regressions.

Some example LIR diffs:

```diff
  Generating: N033 (???,???) [000136] -----------                            IL_OFFSET void   INLRT @ 0x00A[E-] REG NA
  Generating: N035 (  1,  1) [000009] -----------                    t9 =    LCL_VAR   int    V02 loc1         u:1 ecx REG ecx $141
  Generating: N037 (  1,  1) [000011] -c---------                   t11 =    CNS_INT   int    16 REG NA $42
                                                                          ┌──▌  t9     int
                                                                          ├──▌  t11    int
- Generating: N039 (  3,  3) [000012] N------N-U-                         ▌  GE        void   REG NA $142
+ Generating: N039 (  3,  3) [000012] -------N-U-                         ▌  CMP       void   REG NA
  IN0005:        cmp      ecx, 16
- Generating: N041 (  5,  5) [000013] -----------                         ▌  JTRUE     void   REG NA $VN.Void
+ Generating: N041 (???,???) [000144] -----------                            JCC       void   cond=UGE REG NA
  IN0006:        jae      L_M20112_BB03
                                                                          ┌──▌  t112   ubyte
                                                                          ├──▌  t54    int
- Generating: N061 ( 22, 14) [000060] ---XGO-----                         ▌  BT        void   REG NA
+ Generating: N061 ( 22, 14) [000060] ---XGO-----                   t60 = ▌  BITTEST_NE int    REG eax
  IN0009:        bt       eax, esi
- Generating: N063 (???,???) [000144] -----------                  t144 =    SETCC     int    cond=C REG eax
  IN000a:        setb     al
  IN000b:        movzx    eax, al
-                                                                         ┌──▌  t144   int
+                                                                         ┌──▌  t60   int
  Generating: N065 ( 23, 15) [000061] ---XGO-----                         ▌  RETURN    int    REG NA <l:$1c8, c:$1c7>
```

19 months agoMicrosoft.NETCore.Platforms: fix graph not being updated on pack. (#82204)
Tom Deseyn [Thu, 16 Feb 2023 06:27:39 +0000 (07:27 +0100)]
Microsoft.NETCore.Platforms: fix graph not being updated on pack. (#82204)

19 months agoFix tests to use ConditionalFact that need it (#82203)
Kevin Jones [Thu, 16 Feb 2023 05:39:51 +0000 (00:39 -0500)]
Fix tests to use ConditionalFact that need it (#82203)

19 months agoAdd jiterpreter trace transfer and other optimizations
Katelyn Gadd [Thu, 16 Feb 2023 05:02:22 +0000 (21:02 -0800)]
Add jiterpreter trace transfer and other optimizations

* Adds the concept of 'trace transfer' where if a trace compile stopped due to reaching another trace's entry point, we will now enter that other trace directly (with the aid of a helper function). The helper function will also notice if the target trace branches back to itself and continue running it, which allows a subset of loops to run without returning to the interpreter. (Right now this loop optimization only seems to activate a small percentage of the time, but it does work.)
* Optimize appendName for the common case of single-character names, and use encodeInto instead of encode. Before this in a browser-bench run out of ~550ms of trace compile time, 80ms was appendName alone 😟
* 'safepoint needed' checks are now done inline in traces instead of via a function call into runtime C (as suggested by @vargaz), which should make them a bit cheaper.
* The math functions like asin and tan are now all implemented in C - previously we used the JS Math object for them since you're meant to be able to do that in wasm, but I realized the output of the JS ones might not precisely match what the regular interpreter's libc would produce. So now they will be consistent.

19 months agoPrevent XUnitLogChecker from failing if no logs are found. (#82212)
Ivan Diaz Sanchez [Thu, 16 Feb 2023 03:28:45 +0000 (19:28 -0800)]
Prevent XUnitLogChecker from failing if no logs are found. (#82212)

19 months agoRemove ConfigurationBinder usage from Console Logging (#82098)
Eric Erhardt [Thu, 16 Feb 2023 03:05:20 +0000 (21:05 -0600)]
Remove ConfigurationBinder usage from Console Logging (#82098)

* Remove ConfigurationBinder usage from Console Logging

This allows ConfigurationBinder, and its dependencies like TypeConverter,
to be trimmed in an application that uses Console Logging, like an
ASP.NET API application.

Fix #81931

* Ensure invalid configuration data throws appropriate exception.

19 months agoWorkloads: Fix a regression in file permissions for workload packs (#82211)
Ankit Jain [Thu, 16 Feb 2023 01:35:06 +0000 (20:35 -0500)]
Workloads: Fix a regression in file permissions for workload packs (#82211)

Reverts
https://github.com/dotnet/runtime/commit/b6e2dbe97c917d9e5ae722fde543d1ab5581b5f7
essentially.

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

This especially shows up on macOS when doing a system install. When installing the workload to a user directory, the permissions get set correctly, which is why this was not caught by Wasm.Build.Tests .

19 months agoEnable building NativeAOT for Apple mobile platforms (#81780)
Alexander Köplinger [Thu, 16 Feb 2023 01:00:08 +0000 (02:00 +0100)]
Enable building NativeAOT for Apple mobile platforms (#81780)

These changes allow the NativeAOT runtime to compile for and run on iOS, tvOS and MacCatalyst.

19 months ago[tests][ios] Disable StartupHook (#82175)
Mitchell Hwang [Wed, 15 Feb 2023 21:41:15 +0000 (16:41 -0500)]
[tests][ios] Disable StartupHook (#82175)

19 months agoFix emitting `DehydratedDataCommand.ZeroFill` when alignment is high (#82155)
Michal Strehovský [Wed, 15 Feb 2023 21:11:18 +0000 (06:11 +0900)]
Fix emitting `DehydratedDataCommand.ZeroFill` when alignment is high (#82155)

The alignment might not fit into a single byte.

19 months agoImplement DivRem intrinsic for X86 (#66551)
Huo Yaoyuan [Wed, 15 Feb 2023 21:10:23 +0000 (05:10 +0800)]
Implement DivRem intrinsic for X86 (#66551)

* Add managed api for divrem

* Add NI definition of DivRem

* Fix DivRem to be static

* Implement DivRem in clrjit

* Add tests for DivRem

* Adjust lsra and RMW

* Use DivRem intrinsic in Math

* Bring lower change from coreclr#37928
This fixes error while crossgen2 compiling Utf8Formatter.TryFormat(TimeSpan).

* Fix signedness of DIV

* Revert RMW change and fix reg allocation

* Fix import of X64 intrinsic

* Fix static in PNSE version

* Fix accidential indent change

* Apply format patch

* op3 candidate should be different from op1 and op2

* Add guard over AsHWIntrinsic

* Disable DivRem intrinsic use for Mono

* Fix LSRA and invalid assertion

* Set RWM information correctly, although totally unused.

* Move multi-reg temp allocation to common helper

* Disable DivRem intrinsic test for Mono.

* Fix typo of quotient

* Use impAssignMultiRegTypeToVar

* Update #ifdef

* Remove change in LowerBlockStore

* Adjust assert and helper method

* Update CheckMultiRegLclVar

* fix build errors

* Fix some merge conflicts

* Fix some errors

* Fix GCC build error

* jit format

* Make the size depending on the struct

* Fix the formatting of summary

* Remove trailing spaces

* Fix the tests to adopt new model

* Fix MAX_RET_REG_COUNT -> MAX_MULTIREG_COUNT

* Exclude from mono run

* Add RequiresProcessIsolation

* Real fix for build break

* Fix the test cases to adopt to the new system

* Disable for llvm-fullaot

* Also continue disabling for mono

* Disable the test in a different group

* fix merge conflict

* format

* fix another merge conflict error

* misc changes from review

* fix the replay errors

* jit format

* Add exclude list in mono/llvmfullaot

* Review feedback and fix bug in CheckMultiRegLclVar

* Pass registerCount

* review feedback

* Remove the extra comments

* Disable tests on mono llvmfullaot runs as well

* Add missing case for upper save/restore

* Add missing RequiresProcessIsolation

* Revert "Add missing case for upper save/restore"

This reverts commit a98dbde4bd547824388fcb410c06b2503a870fb6.

* Remove RequiresProcessIsolation property

* Replace ref with fakelibs

* Add references of fakelib to test project

* Fix CompatibilitySuppressions.xml

* fix test builds

* Remove unneeded extern/using

* Revert "Replace ref with fakelibs"

This reverts commit e1b5fb38ce84c34f143e36be6aafc27ce820d8df.

* Revert "Revert "Replace ref with fakelibs""

This reverts commit 39ae98d2fee0c2b9d94437bce744c9f065654ed0.

* Exclude DivRem.csproj

* Handle the case to delay-free op3 for op1/op2

* Create the DivRem.RefOnly fake CoreLib as a reference assembly

Make the DivRem tests reference the DivRem fake
CoreLib as reference assembly; and ensure that it is not included as a
ProjectReference by the toplevel HardwareIntrinsics merged test
runners.

The upshot is that the DivRem tests can call the extra APIs via
a direct reference to CoreLib (instead of through System.Runtime), but
the fake library is not copied into any test artifact directories, and
the Mono AOT compiler never sees it.

* Unify AddDelayFreeUses

---------

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
19 months agoCreate skeleton for the ComInterfaceGenerator (#80887)
Jeremy Koritzinsky [Wed, 15 Feb 2023 21:03:41 +0000 (13:03 -0800)]
Create skeleton for the ComInterfaceGenerator (#80887)

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
19 months agoAdd new Xml Type parser (#82145)
Tlakaelel Axayakatl Ceja [Wed, 15 Feb 2023 20:55:14 +0000 (12:55 -0800)]
Add new Xml Type parser (#82145)

Use new type parser for xml processing
Add tests in nativeAOT
Port XML testing changes from NativeAOT to illink
Port logic to distinguish who needs to Kept an element in illink

19 months agoIf we hit a jiterpreter enter opcode while compiling a trace, stop compiling there...
Katelyn Gadd [Wed, 15 Feb 2023 20:10:05 +0000 (12:10 -0800)]
If we hit a jiterpreter enter opcode while compiling a trace, stop compiling there (#82130)

This keeps traces shorter and reduces the amount of time spent compiling them

19 months agoFix NamedMutex PAL test (#82122)
Adeel Mujahid [Wed, 15 Feb 2023 19:52:34 +0000 (21:52 +0200)]
Fix NamedMutex PAL test (#82122)

19 months ago[mono][interp] Intrinsify CreateSpan (#82093)
Vlad Brezae [Wed, 15 Feb 2023 19:34:47 +0000 (21:34 +0200)]
[mono][interp] Intrinsify CreateSpan (#82093)

* [mono][interp] Remove redundant opcode

* [mono][interp] Intrinsify CreateSpan

19 months agoCI: don't trigger *all* library tests on wasm-only changes (#81906)
Ankit Jain [Wed, 15 Feb 2023 19:19:15 +0000 (14:19 -0500)]
CI: don't trigger *all* library tests on wasm-only changes (#81906)

* CI: don't trigger *all* library tests on wasm-only changes

For wasm changes that should trigger wasm library tests, a different
subset is used.

* CI: Remove unused wasi-build-only.yml

* Add runtime-wasm-optional to wasm-only list

19 months agoeng/SourceBuild.props: remove dangling SourceBuildNonPortable. (#82160)
Tom Deseyn [Wed, 15 Feb 2023 18:58:43 +0000 (19:58 +0100)]
eng/SourceBuild.props: remove dangling SourceBuildNonPortable. (#82160)

19 months agoFix reporting of an async IO timeout error on Windows (`SerialPort`) (#81744)
Koundinya Veluri [Wed, 15 Feb 2023 18:57:45 +0000 (10:57 -0800)]
Fix reporting of an async IO timeout error on Windows (`SerialPort`) (#81744)

- When an async `SerialPort` IO operation times out, it reports the timeout in the IO completion with an `NTSTATUS` value of `WAIT_TIMEOUT` (258)
- In the thread pool when using `GetQueuedCompletionStatusEx`, the `NTSTATUS` value was being checked against `STATUS_SUCCESS` to determine success, so the `WAIT_TIMEOUT` was reported as an error. This leads to a different exception being thrown, compared to before when `GetQueuedCompletionStatus` was used.
- Fixed to use similar logic to the SDK's `NT_SUCCESS` macro, which treats the `WAIT_TIMEOUT` value as a success, which is similar to what `GetQueuedCompletionStatus` does
- There are already tests that verify this behavior in `System.IO.Ports` tests, though [they are currently disabled](https://github.com/dotnet/runtime/blob/b39d6a6eb44860746e91e5ce4f585beff33d1f63/src/libraries/System.IO.Ports/tests/Support/TCSupport.cs#L108-L118) due to instabilities. I have verified locally that the relevant failures are fixed and that there are no new failures in those tests.

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

19 months agoUpdate CEEInfo::getAddressOfPInvokeTarget to handle already resolved P/Invokes (...
Tanner Gooding [Wed, 15 Feb 2023 18:05:14 +0000 (10:05 -0800)]
Update CEEInfo::getAddressOfPInvokeTarget to handle already resolved P/Invokes (#82150)

* Update CEEInfo::getAddressOfPInvokeTarget to handle already resolved P/Invokes

* Make sure to use NDirectMethodDesc

* Respond to PR feedback and remove dead GetNativeNDirectTarget logic

* Fix a manual offsetof for NDirectMethodDesc

* Use offsetof directly

* Remove some more dead code

* Fix the JIT/EE transition for getAddressOfPInvokeTarget

* Fix the getAddressOfPInvokeTarget contract

19 months ago[main] Update dependencies from dotnet/llvm-project dotnet/emsdk dotnet/icu dotnet...
dotnet-maestro[bot] [Wed, 15 Feb 2023 17:20:20 +0000 (12:20 -0500)]
[main] Update dependencies from dotnet/llvm-project dotnet/emsdk dotnet/icu dotnet/xharness dotnet/hotreload-utils dotnet/cecil (#82048)

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

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.23110.1 -> To Version 14.0.0-alpha.1.23113.3

* Update dependencies from https://github.com/dotnet/icu build 20230213.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.2.23108.2 -> To Version 8.0.0-preview.2.23113.1

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

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

* Update dependencies from https://github.com/dotnet/emsdk build 20230213.1

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100-preview.2
 From Version 8.0.0-preview.2.23108.1 -> To Version 8.0.0-preview.2.23113.1

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

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.1.0-alpha.0.23107.1 -> To Version 1.1.0-alpha.0.23113.1

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

Microsoft.DotNet.Cecil
 From Version 0.11.4-alpha.23106.4 -> To Version 0.11.4-alpha.23113.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
19 months ago[mono][jit] Adding parametrized macros for arm64/neon opcode encodings, codegen tests...
Jan Dupej [Wed, 15 Feb 2023 16:51:22 +0000 (17:51 +0100)]
[mono][jit] Adding parametrized macros for arm64/neon opcode encodings, codegen tests for the same. (#81887)

19 months agoFix CancellationTokenSource_CancelAsync_AllCallbacksInvoked test (#82153)
Stephen Toub [Wed, 15 Feb 2023 16:13:50 +0000 (11:13 -0500)]
Fix CancellationTokenSource_CancelAsync_AllCallbacksInvoked test (#82153)

If the task internally queued by CancelAsync hasn't started yet by the time we block waiting for it, Wait could inline it and end up running it on the current thread.

19 months agoDisable failing test (#82162)
Šimon Rozsíval [Wed, 15 Feb 2023 16:08:16 +0000 (17:08 +0100)]
Disable failing test (#82162)

19 months ago[mono] Implement synch block fast paths in managed (#81380)
Aleksey Kliger (λgeek) [Wed, 15 Feb 2023 14:23:18 +0000 (09:23 -0500)]
[mono] Implement synch block fast paths in managed (#81380)

* [mono] Implement synch block fast paths in managed

   Investigate one incremental alternative from https://github.com/dotnet/runtime/issues/48058

   Rather than switching to NativeAOT's Monitor implementation in one step, first get access to Mono's synchronization block from managed, and implement the fast paths for hash code and monitor code in C#.

* Implement TryEnterFast and TryEnterInflatedFast

   This should help the interpreter particularly, since it doesn't have an intrinsic path here

* Add replacements for test_owner and test_synchronized icalls

   ObjectHeader.IsEntered and ObjectHeader.HasOwner, respectively

* access sync block through helpers

* Get a pointer to the object header another way

   Unsafe.As<TFrom,TTo>() was converting a object** into a header*.

   Go through Unsafe.AsPointer to get a Header** and then deref it once to get a header

* logical shifts, not arithmetic

   on wasm32, IntPtr and int are both the same size. so when we store a hash code into _lock_word that ends up with the 30th high bit set, the right shift to get it back out needs to be arithmetic or else we get incorrect hash codes

* force inlining

* move fast path into ReliableEnterTimeout

* Don't pass lockTaken to ObjectHolder.TryEnterFast

   set it in the caller if we succeeded

* TryEnterFast: handle flat recursive locking, too

* Implement Monitor.Exit fast path in managed

   If the LockWord is flat, there has been no contention, so there is noone to signal when we exit

* Don't call MonoResolveUnmanagedDll for the default ALC

   it would always return null anyway.

   But also this avoids a circular dependency between the managed Default ALC constructor and Monitor icalls (the ALC base constructor locks allContexts).

* [interp] don't lookup internal calls that were replaced by an opcode

   If it was replaced by an intrinsic, we're not really going to call the wrapper, no need to look for it

* Add Interlocked.CompareExchange interp intrinsics for I4 and I8

* more inlining: LockWordCompareExchange

* Use a ref struct to pass around the address of a MonoObject* on the stack

   This is similar to ObjectHandleOnStack except with a getter that lets us view the object header.

   Get rid of calls to GC.KeepAlive.

   With this, the fast path (locking a flat unowned object) doesn't have any calls on it besides argument validation

* Add fast path for Monitor.Exit for inflated monitors with no waiters

* Check for obj == null before ThrowIfNull

   In the interp it's cheaper to do a null check followed by a call than an unconditional call

* Inline RuntimeHelpers.GetHashCode

* inline TryEnterInflatedFast; nano-opts

   - change SyncBlock.HashCode to return the value, not a ref - we don't have managed code that writes into the sync block.
   - change TryEnterInflatedFast to avoid looping - if the CompareExchange fails, fall back to the slow path

* disable the TryGetHashCode fast path helper

   It was actually making things slower on the interpreter.

   In the JIT it made object.GetHashCode about 50% faster for an object with a pre-computed hash, but that might mean we need the same kind of "no-wrapper; then wrapper" fastpath/slowpath that we have for the Monitor.Enter intrinsic in mini.

* Fix last exit from inflated monitor

   When nest == 1 the caller is responsible for setting the owner to 0 to indicate that the monitor is unlocked.  (But we leave the nest count == 1, so that it is correct next time the monitor is entered)

* avoid repeated calls in TryEnterInflatedFast

* Combine TryExit and IsEntered into TryExitChecked

   avoid duplicated lockword and sync block manipulations

* Re-enable managed GetHashCode in JIT; intrinsify in interp

   Instead of treating InternalGetHashCode/InternalTryGetHashCode as intrinsics in the interpreter, intrinsify RuntimeHelpers.GetHashCode and RuntimeHelpers.TryGetHashCode and avoid the managed code entirely when possible

* add CMPXCHG opcodes to the jiterpreter

   For the i64 version, pass the address of the i64 values to the helper function.

   The issue is that since JS doesn't have i64, EMSCRIPTEN_KEEPALIVE messes with the function's signature and we get import errors in the JITed wasm module.  Passing by address works around the issue since addresses are i32.

* fix whitespace

* [jiterp] Allow null obj in hashcode intrinsics

   The underlying C functions are null-friendly, and the managed intrinsics are allowed to C null inputs.  The assert is unnecessary.

19 months agoAdding support to mono for v128 constants (#81902)
Tanner Gooding [Wed, 15 Feb 2023 13:57:39 +0000 (05:57 -0800)]
Adding support to mono for v128 constants (#81902)

* Adding support to mono for v128 constants

* Ensure that mini-amd64 can handle Vector128<T> constants

* Have xconst "maximum instruction length" match r8const

* Ensure the right data.target indices are written

* Correctly handle the X128 patch point

* Ensure MONO_TYPE_I and MONO_TYPE_U are handled

* Ensure Vector`1 is handled

19 months agoDisable on failing platforms (#82159)
Marie Píchová [Wed, 15 Feb 2023 13:54:35 +0000 (14:54 +0100)]
Disable on failing platforms (#82159)

19 months agoBaseline another JIT test (#82158)
Michal Strehovský [Wed, 15 Feb 2023 12:21:17 +0000 (21:21 +0900)]
Baseline another JIT test (#82158)

This test starts failing once we reflection-root the test assembly.

19 months agoSPMI: Ensure we disable loop alignment consistently (#82100)
Jakob Botsch Nielsen [Wed, 15 Feb 2023 10:38:06 +0000 (11:38 +0100)]
SPMI: Ensure we disable loop alignment consistently (#82100)

Recently we disabled loop alignment in SPMI diffs, but this was only
done for the SPMI invocations when we generate disassembly. This would
result in the diffs run seeing different generated code than subsequent
disassembly runs.

This splits the environment variables we want to have enabled in the
diffs SPMI invocation out into its own dictionary. These are force
overridden.

19 months ago[browser] do not throw if culture data does not exist in icu (#82094)
Pavel Savara [Wed, 15 Feb 2023 10:34:04 +0000 (11:34 +0100)]
[browser] do not throw if culture data does not exist in icu (#82094)

* align with Blazor startup
* update tests

19 months agoRun unconditional msquic Linux test only in our CI, i.e. Helix (#82108)
Marie Píchová [Wed, 15 Feb 2023 08:48:29 +0000 (09:48 +0100)]
Run unconditional msquic Linux test only in our CI, i.e. Helix (#82108)

19 months agoSimplify an error condition in tryrun.cmake (#82070)
Adeel Mujahid [Wed, 15 Feb 2023 03:19:23 +0000 (05:19 +0200)]
Simplify an error condition in tryrun.cmake (#82070)

19 months agoBump generic cycle detection cutoff for the test tree (#82074)
Michal Strehovský [Wed, 15 Feb 2023 03:06:49 +0000 (12:06 +0900)]
Bump generic cycle detection cutoff for the test tree (#82074)

There's a JIT test that expects being able to recurse a bit deeper than what we allow by default.

19 months agoBaseline some failing JIT tests (#82075)
Michal Strehovský [Wed, 15 Feb 2023 03:06:24 +0000 (12:06 +0900)]
Baseline some failing JIT tests (#82075)

19 months ago[NativeAOT] Add ability to generate library and exe entry points (#81873)
Austin Wise [Wed, 15 Feb 2023 02:26:08 +0000 (18:26 -0800)]
[NativeAOT] Add ability to generate library and exe entry points (#81873)

This PR adds a new flag to ILC, `--splitinit` . The flag splits the initialization that is normally done for executable into two parts. The `__managed__Startup` function runs classlib and module initializers. The `__managed__Main` function performs the remaining initialization and executes the entry-point of the managed application.

The use case for this is to allow calling `UnamanagedCallersOnly` functions before the managed `main` function. Running on iOS is the first use case for this feature (#80905).

It was not clear to me how to fit this into the larger NativeAot build system. Should this be thought of as "a static library that also has a `__managed__Main` compiled in" or as "an executable that splits its initialization into two parts"? So I added support to ILC for both cases: compiling with the `--nativelib` flag and without it.

Lastly, I added some build integration the "an executable that splits its initialization into two parts" case, along with test. The idea is the user sets the `CustomNativeMain` property in their project. They are then responsible for providing a `NativeLibrary` item pointing to an object file containing their native `main` function. At runtime, when they call their first managed function, NativeAOT initialization will run. This includes calling `__managed__Main`, so the user cannot forget to initialize the runtime.

Related issues: #81097 #77957

19 months agoRemove reference to Cecil submodule in illink (#82124)
Jackson Schuster [Wed, 15 Feb 2023 01:39:01 +0000 (19:39 -0600)]
Remove reference to Cecil submodule in illink (#82124)

* Remove reference to cecil submodule in illink and unused projects

19 months agoDisable rundownvalidation test on GCStress for arm (#82118)
Bruce Forstall [Tue, 14 Feb 2023 23:18:21 +0000 (16:18 -0700)]
Disable rundownvalidation test on GCStress for arm (#82118)

Linux arm GCStress 3 times out

Tracking: https://github.com/dotnet/runtime/issues/81323

19 months agoGeneralize `emitRemoveLastInstruction()` (#82002)
Bruce Forstall [Tue, 14 Feb 2023 23:17:38 +0000 (16:17 -0700)]
Generalize `emitRemoveLastInstruction()` (#82002)

Allow it to remove the last instruction of an already-saved
instruction group.

Fixes #81505

19 months agoUse string interpolation in a few more places (#82096)
Stephen Toub [Tue, 14 Feb 2023 21:29:25 +0000 (16:29 -0500)]
Use string interpolation in a few more places (#82096)

Places where we'd otherwise be allocating for at least one of the subcomponents.

19 months agoRemove allocations in some System.Net GetHashCode methods (#82095)
Stephen Toub [Tue, 14 Feb 2023 21:29:13 +0000 (16:29 -0500)]
Remove allocations in some System.Net GetHashCode methods (#82095)

* Remove allocations in some System.Net GetHashCode methods

* Address PR feedback

19 months agoExclude Ubuntu 18.04 arm 32 docker image (#82092)
Marie Píchová [Tue, 14 Feb 2023 21:00:45 +0000 (22:00 +0100)]
Exclude Ubuntu 18.04 arm 32 docker image (#82092)