platform/upstream/dotnet/runtime.git
14 months ago[Mono] Update Mono build README.md (#87517)
Fan Yang [Wed, 14 Jun 2023 19:58:14 +0000 (15:58 -0400)]
[Mono] Update Mono build README.md (#87517)

Added one more useful switch `-p:KeepNativeSymbols=true`

14 months ago[ComInterfaceGenerator] Warn on visibility of interface and StringMarshallingCustomTy...
Jackson Schuster [Wed, 14 Jun 2023 16:56:58 +0000 (09:56 -0700)]
[ComInterfaceGenerator] Warn on visibility of interface and StringMarshallingCustomType (#87065)

The generated code is in file scoped classes, so the interface and StringMarshallingCustomType need to be at least internal visibility. These changes warn if that condition isn't met.

Originally, I expected to report a diagnostic, but still generate code for the interface. This required some changes to DiagnosticOr<T> to allow it to hold both a diagnostic and a value if the diagnostic didn't cause failure. In the end those changes weren't necessary, but I left them because I can see them being valuable at some point in the future.

Completes #84662

14 months agoAllow bigger json parsing to JsonDocument (#87343)
Egor Boyarkin [Wed, 14 Jun 2023 15:35:53 +0000 (18:35 +0300)]
Allow bigger json parsing to JsonDocument (#87343)

* Allow bigger json parsing to JsonDocument

* Use single constant and assert it on .NET 6

* Force ArrayPool.Rent to throw if it's impossible to enlarge

14 months agoAdd delay load hook for singlefilehost and enable delay load of version.dll (#87495)
Elinor Fung [Wed, 14 Jun 2023 13:40:36 +0000 (06:40 -0700)]
Add delay load hook for singlefilehost and enable delay load of version.dll (#87495)

`coreclr` delay loads `version.dll` and adds a hook such that it loads from the system directory. In single-file, we lost this behaviour since it uses static library version of `coreclr`. This adds the same mechanism to single-file.

14 months agoFix typo in object.h (#87553)
Eric Mutta [Wed, 14 Jun 2023 13:02:58 +0000 (16:02 +0300)]
Fix typo in object.h (#87553)

14 months ago[mono][jit] Disable passing SIMD args in SIMD regs on arm64. (#87540)
Zoltan Varga [Wed, 14 Jun 2023 11:40:49 +0000 (07:40 -0400)]
[mono][jit] Disable passing SIMD args in SIMD regs on arm64. (#87540)

It has the following problems:
- the gshared versions of SIMD types like Vector<T_INT> are not marked
  as SIMD, so there is a calling convention mismatch if the callee is
  generic shared.
- the gsharedvt code doesn't support it, i.e. it asserts in get_arg_slots ().
- the dyncall code might not support it either.

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

14 months ago[QUIC] Fix rooted connection when hanshake failed (#87328)
Marie Píchová [Wed, 14 Jun 2023 11:34:21 +0000 (13:34 +0200)]
[QUIC] Fix rooted connection when hanshake failed (#87328)

* Added tests

* Fixed logging and minor typos

* Fix

* Fix test

* "Added asserts checking GCHandle state"

* Exclude test from mono

* Removed unnecessary _disposed checks

14 months ago[mono][wasm] marshal-ilgen is dropped when not required (#86035)
Jan Dupej [Wed, 14 Jun 2023 10:51:44 +0000 (12:51 +0200)]
[mono][wasm] marshal-ilgen is dropped when not required (#86035)

* Replicating naricc's PInvokeScanner.

* MarshalingPInvokeScanner now detects and outputs incompatible assemblies.

* Allowing void return type.

* PInvoke

* Two-pass searching in progress.

* Second pass resolves inconclusive types.

* Cleanup.

* Modifying the wasm toolchain to omit marshal-ilgen when possible.

* Hopefully fix incorrect app dir.

* Added definitions to MarshalingPInvokeScannerPath hopefully where needed.

* Adding definitions of MarshalingPInvokeScannerPath to more locations.

* Adding missing references to PInvoke scanner.

* Changed task ordering, assemblies list.

* Removed metadata load context.

* Fixed code analyzer issues.

* Fixed file name.

* Moved MarshalingPInvokeScanner to MonoTargetsTask.

* Removed BlazorApp.

* Implemented more marshaling validation rules, removed warning message that got "promoted" to an error.

* Catching bad image exceptions, giving reason for requiring marshal-ilgen.

* Cleaned up references to standalone MarshalingPInvokeScanner project, now that the analyzer is in MonoTargtesTask.

* More cleanup.

* Fixed P/Invoke return value in marshal-lightweight.

* Removed incompatible assemblies listing.

* Restoring minimal functionality to marshal-ilgen-stub.

* Addressed feedback.

* Tweaked identification of blittable types. Added explanation to Compatibility enum.

* Moved PInvokeCollector.cs and SignatureMapper.cs back to WasmAppBuilder.

* Addressed feedback.

14 months agoFaster optimized frozen dictionary creation (1/n) (#87510)
Adam Sitnik [Wed, 14 Jun 2023 10:37:44 +0000 (12:37 +0200)]
Faster optimized frozen dictionary creation (1/n) (#87510)

* every strategy needs an array of keys, we can create it up-front and iterate over it rather than the dictionary to get min and max lengths (1-2% gain)

* Instead of ensuring that at least 95% of data is good, we stop when we know that at least 5% is bad (13-14% gain)

* toggle the direction and re-use the comparer and hashset (3% time gain, 12% allocations reduction)

15 months agoFix GetILFunctionBody for dynamic methods (#87530)
David Mason [Wed, 14 Jun 2023 09:55:48 +0000 (02:55 -0700)]
Fix GetILFunctionBody for dynamic methods (#87530)

15 months ago[QUIC] Moved a test using external server to outerloop (#87476)
Marie Píchová [Wed, 14 Jun 2023 07:56:39 +0000 (09:56 +0200)]
[QUIC] Moved a test using external server to outerloop (#87476)

* Moved tests using external server to outerloop

* Removed unnecessary code

15 months agoRemove test exclusions for Json tests (#87457)
Michal Strehovský [Wed, 14 Jun 2023 07:34:09 +0000 (16:34 +0900)]
Remove test exclusions for Json tests (#87457)

15 months agoSPMI: Unify error handling path for replay and asmdiffs (#87464)
Jakob Botsch Nielsen [Wed, 14 Jun 2023 07:07:18 +0000 (09:07 +0200)]
SPMI: Unify error handling path for replay and asmdiffs (#87464)

For asmdiffs we would go into the success path always when the base JIT
succeeded. This meant that if the diff JIT missed we would confusingly
print an error message

    ERROR: method xyz is missing a compileResult, cannot do diffing

even though the "base success, diff miss" case is quite common and
expected. This change makes us take the same error path if either of the
JIT results failed, and then moves the JIT1 unique error handling into
an earlier check.

15 months ago[API Proposal]: Add overload for EventSource primitives (#83751)
Andy Gocke [Wed, 14 Jun 2023 05:58:00 +0000 (22:58 -0700)]
[API Proposal]: Add overload for EventSource primitives (#83751)

I've seen a lot of calls to the varargs EventSource overload that have to manually
suppress the trim warning because they only use primitive types.

Adding this overload solves two problems:
  1. Users won't get a warning if their usage is safe.
  2. Users won't have to suppress a warning.

15 months agoGenerate fewer GenericMethodHashtable entries (#87466)
Michal Strehovský [Wed, 14 Jun 2023 05:06:43 +0000 (14:06 +0900)]
Generate fewer GenericMethodHashtable entries (#87466)

GenericMethodHashtable is a hashtable of all method generic dictionaries statically present in the image. In practice, we don't need a database of all of them - only those that are reflection-visible, or have a type loader template. This PR implements that.

Saves 0.2% on BasicMinimalApi. A bit less than I hoped for but since I already have this...

15 months agoFix DependencyContext splitting on semi-colon (#87518)
Eric Erhardt [Wed, 14 Jun 2023 02:47:39 +0000 (20:47 -0600)]
Fix DependencyContext splitting on semi-colon (#87518)

* Fix DependencyContext splitting on semi-colon

https://github.com/dotnet/runtime/commit/5e67657e20665c32c2bd5c4ac1c8b1af78c9677e introduced a bug in DependencyContextPaths where the static array is not initialized before it is being used in the Create static method.

This fix removes the static array since it is only used once.

- Don't cache the semicolon array since it is only used once at startup
- Skip test on netfx since it doesn't work.

15 months agoImprove the performance of the type loader through various tweaks (#85743)
David Wrighton [Tue, 13 Jun 2023 22:25:50 +0000 (15:25 -0700)]
Improve the performance of the type loader through various tweaks (#85743)

* Skip type validation by default in ReadyToRun images
- Technically, this is a breaking change, so I've provided a means for disabling the type validation skip
- The model is that the C# compile won't get these details wrong, so disable the checks when run through crossgen2. The idea is that we'll get these things checked during normal, non-R2R usage of the app, and publish won't check these details.

* Replace expensive lookups of generic parameter and nested class data with R2R optimized forms

* Store index of MethodDesc as well as ChunkIndex. Makes MethodDesc::GetTemporaryEntryPoint *much* faster

* Optimize the path for computing if a method is eligible for tiered compilation

* Remove CanShareVtableChunksFrom concept
- it was only needed to support NGen

* Fix up some more issues

* Bring back late virtual propagation in the presence of covariant overrides only

* Check correct flag on EEClass

* Drive by fix for GetRestoredSlot. We don't need the handling of unrestored slots anymore

* Fix composite build with new tables

* Uniquify the mangled names

* Add more __

* Initial pass at type skip verifation checker

* Fix logging and some correctness issues

* Enable the more of type checking
- Notably, the recursive stuff now works
- Also fix a bug in constraint checking involving open types in the type system

* Fix build breaks involving new feature of GenericParameterDesc

* Add documentation for R2R format changes
Fix command line parameter to be more reasonable, and allow logging on command
Fix the rest of issues noted in crossgen2 testing

* Fix implementation of CompareMethodContraints. instead of using IsGeneric map, check to see if the method is generic in the first place. It turns out we have an efficient way to check in every place that matters

* Fix nits noticed by Aaron

* Add some const correctness to the world

* Fix issues noted by Michal, as well as remaining constrain checking issues

* Code review details

* Code review from trylek

15 months agoAdd Diagnostics for ComClassGenerator (#87436)
Jackson Schuster [Tue, 13 Jun 2023 22:13:48 +0000 (15:13 -0700)]
Add Diagnostics for ComClassGenerator (#87436)

Adds diagnostics to ComClassGenerator for invalid uses of GeneratedComClass

15 months ago[mono][jit] Add JIT support for the methods in Vector128<T> on amd64. (#86546)
Zoltan Varga [Tue, 13 Jun 2023 22:00:41 +0000 (18:00 -0400)]
[mono][jit] Add JIT support for the methods in Vector128<T> on amd64. (#86546)

* [mono][jit] Add JIT support for the methods in Vector128<T> on amd64.

* Avoid emitting OP_NOT_NULL opcodes in non-llvm mode, they are not used, and they keep their inputs alive.

* Return true for IsSupported for non 128 bit types even if the operations are not supported.

* Fix windows support.

* Add support for some binary operations.

* Disable Dot for integer types.

* Add support for Create.

* Fix some typos in the intrinsics tests.

* Enable As methods.

* Enable Abs/AndNot. Simplify INSERT_R8.

* Add more methods.

* Add compare methods.

* Add CreateScalar/CreateScalarUnsafe.

* Add Sqrt/Sum.

* Fix GetElement/WithElement<long>.

* Implement some of the convert methods, disable the rest.

* Fix GetElement<int>.

* Require SSE41.

* Fix OP_EXTRACT_I1.

* Fix INSERT_R8.

* Improve OP_NEGATION R4/R8.

15 months agoShrink ManifestEnvelope.MaxChunkSize to hold extended data (#87322)
ms-hujia [Tue, 13 Jun 2023 21:49:14 +0000 (05:49 +0800)]
Shrink ManifestEnvelope.MaxChunkSize to hold extended data (#87322)

15 months agoEmit additional attributes with global qualifier (#87497)
Jeremy Koritzinsky [Tue, 13 Jun 2023 21:36:39 +0000 (14:36 -0700)]
Emit additional attributes with global qualifier (#87497)

15 months agoSubject src-gen serializer to full number-handling test (#87484)
Eirik Tsarpalis [Tue, 13 Jun 2023 21:10:48 +0000 (22:10 +0100)]
Subject src-gen serializer to full number-handling test (#87484)

* Subject src-gen serializer to full number-handling tests

* Make failing tests pass

* Revert API break and use contract APIs instead

* React to test infra changes

* Fix rebase conflicts & ensure all tests are passing.

---------

Co-authored-by: Layomi Akinrinade <laakinri@microsoft.com>
15 months agoUpdate debugging-vscode.md (#87338)
Dan Moseley [Tue, 13 Jun 2023 21:01:37 +0000 (14:01 -0700)]
Update debugging-vscode.md (#87338)

15 months ago[wasm] Change optimization flag to workaround llvm issue (#87473)
Radek Doulik [Tue, 13 Jun 2023 20:39:58 +0000 (22:39 +0200)]
[wasm] Change optimization flag to workaround llvm issue (#87473)

15 months ago[wasm] Fix perf pipeline (#87469)
Ankit Jain [Tue, 13 Jun 2023 20:05:47 +0000 (16:05 -0400)]
[wasm] Fix perf pipeline (#87469)

* [wasm] Use the current `test-main.js` instead of the one for 7.0

* [wasm] perf: Add `--module` arg for v8, to support the es6 module

* [wasm] perf: Use tar for BrowserWasm for perf runs

.. because the new image does not have `zip` installed.

* remove debug bits

15 months agoFix break from wchar_t usage in disableddotnetruntime (#87509)
Elinor Fung [Tue, 13 Jun 2023 20:04:43 +0000 (13:04 -0700)]
Fix break from wchar_t usage in disableddotnetruntime (#87509)

15 months ago[RISC-V][JIT] Fix encoding of CallGCregs (#87467)
Dong-Heon Jung [Tue, 13 Jun 2023 19:18:09 +0000 (04:18 +0900)]
[RISC-V][JIT] Fix encoding of CallGCregs (#87467)

- It fixes what Encoding and Decoding logic handle CallGCregs differently.

15 months ago[main] Update dependencies from dotnet/runtime dotnet/icu dotnet/xharness dotnet...
dotnet-maestro[bot] [Tue, 13 Jun 2023 18:13:31 +0000 (13:13 -0500)]
[main] Update dependencies from dotnet/runtime dotnet/icu dotnet/xharness dotnet/emsdk dotnet/cecil dotnet/sdk (#87375)

* Update dependencies from https://github.com/dotnet/sdk build 20230610.2

Microsoft.DotNet.ApiCompat.Task
 From Version 8.0.100-preview.6.23309.13 -> To Version 8.0.100-preview.6.23310.2

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

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

* Update dependencies from https://github.com/dotnet/sdk build 20230612.2

Microsoft.DotNet.ApiCompat.Task
 From Version 8.0.100-preview.6.23309.13 -> To Version 8.0.100-preview.6.23312.2

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.6.23305.2 -> To Version 8.0.0-preview.6.23312.1

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 8.0.0-prerelease.23307.1 -> To Version 8.0.0-prerelease.23312.1

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

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport
 From Version 8.0.0-preview.6.23307.1 -> To Version 8.0.0-preview.6.23312.1

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

Microsoft.DotNet.Cecil
 From Version 0.11.4-alpha.23306.1 -> To Version 0.11.4-alpha.23312.1

* Update dependencies from https://github.com/dotnet/sdk build 20230613.1

Microsoft.DotNet.ApiCompat.Task
 From Version 8.0.100-preview.6.23309.13 -> To Version 8.0.100-preview.6.23313.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
15 months ago[main] Update dependencies from dnceng/internal/dotnet-optimization (#87124)
dotnet-maestro[bot] [Tue, 13 Jun 2023 18:13:03 +0000 (13:13 -0500)]
[main] Update dependencies from dnceng/internal/dotnet-optimization (#87124)

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230604.4

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23304.4

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230605.4

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23305.4

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230606.3

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23306.3

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230607.4

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23307.4

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230608.6

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23308.6

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230609.6

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23309.6

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230610.6

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23310.6

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230611.2

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23303.6 -> To Version 1.0.0-prerelease.23311.2

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
15 months agoDon't return `0` from `getMaxVectorByteLength` when intrinsics are disabled (#87420)
Tanner Gooding [Tue, 13 Jun 2023 17:43:42 +0000 (10:43 -0700)]
Don't return `0` from `getMaxVectorByteLength` when intrinsics are disabled (#87420)

15 months agoFix WCHAR definition on non-Windows for nativeaot (#87465)
Elinor Fung [Tue, 13 Jun 2023 15:47:43 +0000 (08:47 -0700)]
Fix WCHAR definition on non-Windows for nativeaot (#87465)

This fixes enabling of runtime events on non-Windows. The GC events that don't go
through ETW::GCLog are now fired/collected on non-Windows.

There is still work needed to pull in the ETW::GCLog implementation on non-Windows

15 months agoFix missing GC counter data on non-Windows (#87430)
Elinor Fung [Tue, 13 Jun 2023 15:47:05 +0000 (08:47 -0700)]
Fix missing GC counter data on non-Windows (#87430)

This sets FEATURE_EVENT_TRACE on non-Windows platforms as well, such that GC counter
information is tracked and provided when requested.

This does not fully enable runtime event tracing via EventPipe on non-Windows.

15 months agoCombine two table lookups into one while formatting Guid on Arm64 (#87126)
SwapnilGaikwad [Tue, 13 Jun 2023 15:28:53 +0000 (16:28 +0100)]
Combine two table lookups into one while formatting Guid on Arm64 (#87126)

* Combine two table lookups into one while formatting Guid on Arm64

* Add a comment to explain the combined table look-up and hex indices

15 months agoClone files on OSX-like platforms when possible, instead of copying the whole file...
Hamish Arblaster [Tue, 13 Jun 2023 14:58:17 +0000 (00:58 +1000)]
Clone files on OSX-like platforms when possible, instead of copying the whole file (#79243)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
15 months agoRedirect ActiveIssue on a test (#87468)
Michal Strehovský [Tue, 13 Jun 2023 13:34:48 +0000 (22:34 +0900)]
Redirect ActiveIssue on a test (#87468)

15 months ago [browser][debugger][MT] Make operations on dictionary thread-safe. (#87405)
Ilona Tomkowicz [Tue, 13 Jun 2023 11:57:38 +0000 (13:57 +0200)]
 [browser][debugger][MT] Make operations on dictionary thread-safe. (#87405)

* `ConcurrentDicionary` should be thread-safe.

Co-authored-by: Ankit Jain <radical@gmail.com>
---------

Co-authored-by: Ankit Jain <radical@gmail.com>
15 months agoFold const WithElement to CNS_VEC (#86212)
Jasper [Tue, 13 Jun 2023 11:53:59 +0000 (13:53 +0200)]
Fold const WithElement to CNS_VEC (#86212)

Co-authored-by: Egor Bogatov <egorbo@gmail.com>
15 months ago[wasm] Disable the PackedSimd.Shuffle intrinsic. (#86025)
Zoltan Varga [Tue, 13 Jun 2023 11:21:12 +0000 (07:21 -0400)]
[wasm] Disable the PackedSimd.Shuffle intrinsic. (#86025)

LLVM crashes if the underlying intrinsic has a non-constant
shuffle argument, and we can't guarantee that.

Co-authored-by: Radek Doulik <radek.doulik@gmail.com>
15 months ago[wasm] Add PackedSimd load and load scalar methods (#87052)
Radek Doulik [Tue, 13 Jun 2023 11:09:08 +0000 (13:09 +0200)]
[wasm] Add PackedSimd load and load scalar methods (#87052)

* [wasm] Add PackedSimd load and load scalar methods

* Fix build

15 months agoJIT: Handle commas in physical promotion (#87401)
Jakob Botsch Nielsen [Tue, 13 Jun 2023 10:06:26 +0000 (12:06 +0200)]
JIT: Handle commas in physical promotion (#87401)

Physical promotion was not properly handling accounting in the presence
of commas and was not properly handling struct commas during
replacement.

15 months agoUse INS_inc for Interlocked.Increment (#87442)
Egor Bogatov [Tue, 13 Jun 2023 09:21:18 +0000 (11:21 +0200)]
Use INS_inc for Interlocked.Increment (#87442)

15 months agoProperly check ISAs for static readonly simd fields (#87402)
Egor Bogatov [Tue, 13 Jun 2023 09:21:02 +0000 (11:21 +0200)]
Properly check ISAs for static readonly simd fields (#87402)

15 months agoEnsure that types of ignored or inaccessible properties are not included by the sourc...
Eirik Tsarpalis [Tue, 13 Jun 2023 08:30:27 +0000 (09:30 +0100)]
Ensure that types of ignored or inaccessible properties are not included by the source generator. (#87383)

15 months agoApplyStartupHook diagnostic IPC command (#86813)
Justin Anderson [Tue, 13 Jun 2023 07:28:19 +0000 (00:28 -0700)]
ApplyStartupHook diagnostic IPC command (#86813)

15 months agoThe CLA bot can now be rerun with a comment. Fix broken CLA links. (#86825)
Jeff Handley [Tue, 13 Jun 2023 05:55:57 +0000 (22:55 -0700)]
The CLA bot can now be rerun with a comment. Fix broken CLA links. (#86825)

15 months ago[NativeAOT] Avoid redundant unwind info lookup during stackwalks (#87419)
Jan Kotas [Tue, 13 Jun 2023 04:56:15 +0000 (21:56 -0700)]
[NativeAOT] Avoid redundant unwind info lookup during stackwalks (#87419)

Unwind info was looked up twice on non-Windows: Once during initial frame inspection
and second during the actual unwind. Cache the lookup results from the
initial frame inspection and use them from the actual unwind later, same
as it is done on Windows.

15 months agoUpdate HelloiOS.app publish folder path. (#87439)
Parker Bibus [Tue, 13 Jun 2023 03:51:19 +0000 (20:51 -0700)]
Update HelloiOS.app publish folder path. (#87439)

15 months agoFix neutral cultures created with the underscore (#87411)
Tarek Mahmoud Sayed [Tue, 13 Jun 2023 03:34:04 +0000 (20:34 -0700)]
Fix neutral cultures created with the underscore (#87411)

15 months agoWarn when user code casts between runtime-based COM interop types and source-generate...
Jeremy Koritzinsky [Tue, 13 Jun 2023 03:10:33 +0000 (20:10 -0700)]
Warn when user code casts between runtime-based COM interop types and source-generated COM interop types (#87425)

15 months agoDisable StressTestDeepNestingOfLoops for NonBacktracking engine (#87369)
Dan Moseley [Tue, 13 Jun 2023 02:05:13 +0000 (19:05 -0700)]
Disable StressTestDeepNestingOfLoops for NonBacktracking engine (#87369)

* Disable hanging RE test

* feedback

* Oops

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update testing.md

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
15 months agoadd RID for Debian 12 (#87433)
Tomas Weinfurt [Tue, 13 Jun 2023 01:32:17 +0000 (03:32 +0200)]
add RID for Debian 12 (#87433)

15 months agoFix determinism stress perf, by using the ConditionalWeakTable as a static, not as...
David Wrighton [Tue, 13 Jun 2023 01:24:47 +0000 (18:24 -0700)]
Fix determinism stress perf, by using the ConditionalWeakTable as a static, not as an instance method (#87447)

15 months agoAdapt Tarjan generic cycle detector for use in Crossgen2 (#71426)
Tomáš Rylek [Tue, 13 Jun 2023 00:49:39 +0000 (02:49 +0200)]
Adapt Tarjan generic cycle detector for use in Crossgen2 (#71426)

This change modifies Crossgen2 to use the generic cycle detector
originally implemented for NativeAOT to trim infinite generic
expansion as observed in the LanguageExt public nuget package
and tracked by the issue

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

For now the generic cycle detector is opt-in as it's relatively costly
in terms of compiler performance and it seems to be a relatively
niche case. We can follow up by optimizing the detector if it turns
out to be more prevalent or if we make the call to turn it on by
default, I have mentioned several options for that in the PR.

Thanks

Tomas

15 months agoUpgrading Vector256/512 Shuffle() with VBMI support (#87083)
DeepakRajendrakumaran [Mon, 12 Jun 2023 23:18:39 +0000 (16:18 -0700)]
Upgrading Vector256/512 Shuffle() with VBMI support (#87083)

* Upgrading Shuffle()

* Simplifying 'needsZero' initialization. Should be initialized to 'false' for (simdSize == 32) IMO

* Review Changes

* Another review fix.

15 months agoConfigure ComInterfaceGenerator to be referenced by default (#87422)
Jeremy Koritzinsky [Mon, 12 Jun 2023 22:30:59 +0000 (15:30 -0700)]
Configure ComInterfaceGenerator to be referenced by default (#87422)

15 months agoAccount for CORINFO_HELP_VIRTUAL_FUNC_PTR in GT_LABEL; avoid double resolving (#87395)
Jakob Botsch Nielsen [Mon, 12 Jun 2023 21:25:19 +0000 (23:25 +0200)]
Account for CORINFO_HELP_VIRTUAL_FUNC_PTR in GT_LABEL; avoid double resolving (#87395)

In the helper-based tailcall mechanism it is possible that we expand the
target call into two actual calls: first, a call to
CORINFO_HELP_VIRTUAL_FUNC_PTR to compute the target, and second a call
to that target. We were not taking into account that the return address
needed for the tailcall mechanism needs to be from the second call.

In this particular case the runtime does not request the JIT to pass the
target; that means we end up resolving the target from both the caller
and from the CallTailCallTarget stub. Ideally the JIT would be able to
eliminate the CORINFO_HELP_VIRTUAL_FUNC_PTR call in the caller since it
turns out to be unused, but that requires changes in DCE (and is
somewhat non-trivial, as we have to preserve a null-check).

A simpler way to improve the case is to just change the runtime to
always request the target from the JIT for GVMs, which means the
CallTailCallTarget stub no longer needs to resolve it. That also has the
effect of fixing the original issue, but I have left the original fix in
as well.

Fix #87393

15 months agoFix Double.NegativeZero (#87364)
skyoxZ [Mon, 12 Jun 2023 20:49:10 +0000 (04:49 +0800)]
Fix Double.NegativeZero (#87364)

15 months agoChange the stresslog message layout to support extra-large modules and modules loaded...
Jeremy Koritzinsky [Mon, 12 Jun 2023 20:24:08 +0000 (13:24 -0700)]
Change the stresslog message layout to support extra-large modules and modules loaded at far-apart addresses that use the stresslog (#83855)

15 months ago[browser][MT] GC, threadpool and some JS interop improvements (#86759)
Pavel Savara [Mon, 12 Jun 2023 19:43:16 +0000 (21:43 +0200)]
[browser][MT] GC, threadpool and some JS interop improvements (#86759)

15 months agoFix #61604 by simply removing the possibility of throwing an exception in those cases...
David Wrighton [Mon, 12 Jun 2023 19:14:25 +0000 (12:14 -0700)]
Fix #61604 by simply removing the possibility of throwing an exception in those cases (#87355)

15 months agoFix name mangling issue where two subtly different MethodWithToken instances which...
David Wrighton [Mon, 12 Jun 2023 19:14:02 +0000 (12:14 -0700)]
Fix name mangling issue where two subtly different MethodWithToken instances which only differ by OwningType had the same mangled name (#87353)

15 months agoAdd a JsonConverter.Type property. (#87382)
Eirik Tsarpalis [Mon, 12 Jun 2023 18:55:10 +0000 (19:55 +0100)]
Add a JsonConverter.Type property. (#87382)

15 months agoClean up code, use DiagnosticInfo in LibraryImportGenerator, Cache well known attribu...
Jackson Schuster [Mon, 12 Jun 2023 18:36:56 +0000 (11:36 -0700)]
Clean up code, use DiagnosticInfo in LibraryImportGenerator, Cache well known attribute types in StubEnvironment (#87348)

Remove unused usings and simplify access to CodeAnalysis.Location.

Cache the attributes searched for in incremental stub calculations.

Add warning if unsafe blocks are not allowed.

Removes assert in ComMethodInfo that was throwing when editing files in the test project.

Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
15 months agoMove System.Transactions.Local over to using source-generated COM instead of built...
Jeremy Koritzinsky [Mon, 12 Jun 2023 18:08:06 +0000 (11:08 -0700)]
Move System.Transactions.Local over to using source-generated COM instead of built-in COM whenever possible. (#87351)

Co-authored-by: Shay Rojansky <roji@roji.org>
15 months agoFix official build's WASM legs (#87416)
Jeremy Koritzinsky [Mon, 12 Jun 2023 17:52:42 +0000 (10:52 -0700)]
Fix official build's WASM legs (#87416)

15 months agoWarn in CustomMarshallerAnalyzer if the MarshaMode is not valid (#87198)
Jackson Schuster [Mon, 12 Jun 2023 17:26:29 +0000 (10:26 -0700)]
Warn in CustomMarshallerAnalyzer if the MarshaMode is not valid (#87198)

I ran into an issue when making some tests where I tried to use MarshalMode as a flags enum, which lead to the generated code not being correct, but no warning was showing up. This PR creates a warning if you try to do an operation on the MarshalMode argument or if a casted int value is not defined in the MarshalMode enum.

Fixes #87139

15 months agoenable disabled Quic tests (#87385)
Tomas Weinfurt [Mon, 12 Jun 2023 17:24:51 +0000 (19:24 +0200)]
enable disabled Quic tests (#87385)

15 months agoFix trim analyzer warning for inferred type arguments (#87156)
Sven Boemer [Mon, 12 Jun 2023 16:51:49 +0000 (09:51 -0700)]
Fix trim analyzer warning for inferred type arguments (#87156)

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

This replaces the syntax-based logic with:

- ISymbol-based logic that looks at generic instantiations in
  parameter types, return types, and base/interface types

- IOperation-based logic that looks at invocations

The syntax-based logic used to also warn for the types of local
variables, but `SymbolKind.Local` isn't supported for
`RegisterSymbolAction`. Since this falls into the category of
warnings that isn't strictly necessary (based on nativeaot logic
which only warns on generic instantiations that can actually lead
to code execution), I just left out local variables.

I'm slightly concerned that this could be missing some cases, but
at least it works on our existing testcases. This also adds tests
for delegate creation using generic methods, which was one such
missing case noticed during code review.

There are two slight differences in warning locations, which I
don't expect to cause issues for warning suppressions:

- For invocations, the warning location used to be the generic
  method name, without the argument list. Using the
  IOperation-based approach, we use the invocation's location
  that includes the argument list.

- For properties that use arrow syntax (`RequireMethods<TFields>
  Property => null`), the ISymbol-based approach warns on the
  underlying getter method, whose location seems to be the body
  of the accessor. We used to warn on the return type
  specifically, but I couldn't find a better way to get the
  location.

15 months ago[mono][aot] Add @kotlarmilos as code owner for Mono AOT and iOS (#87396)
Milos Kotlar [Mon, 12 Jun 2023 12:47:15 +0000 (14:47 +0200)]
[mono][aot] Add @kotlarmilos as code owner for Mono AOT and iOS (#87396)

Co-authored-by: Marek Safar <marek.safar@gmail.com>
15 months agoJIT: Clean up physical promotion heuristics (#87376)
Jakob Botsch Nielsen [Mon, 12 Jun 2023 11:54:30 +0000 (13:54 +0200)]
JIT: Clean up physical promotion heuristics (#87376)

* Document that we intentionally do not account for writebacks before
  returns
* Make the metrics only used for debug logging DEBUG-only

15 months agoFixes and improvements: (#87218)
Peter Sollich [Mon, 12 Jun 2023 09:38:12 +0000 (11:38 +0200)]
Fixes and improvements: (#87218)

- Fix hang bug caused by race condition in change_heap_count
- Change way we store dynamic heap input metrics to make it easier to surface them via ETW events.
- Refactor enter_spin_lock_msl into an inlineable part and a slower, more complex out-of-line part.
- Subtract time spent in safe_switch_to_thread and WiatLongerNoInstru from msl wait time - this makes this metric much less noisy.
- add more diagnostic output to check_heap_count and change_heap_count.
- add more spinning to EnterFinalizeLock to address slow suspensions in some ASP.NET benchmarks.

15 months agoFix tests (#87386)
Dan Moseley [Mon, 12 Jun 2023 03:15:58 +0000 (20:15 -0700)]
Fix tests (#87386)

15 months ago[mono][tests] Run Mono iOS sample as functional test on the simulator and maccatalyst...
Milos Kotlar [Sun, 11 Jun 2023 18:04:57 +0000 (20:04 +0200)]
[mono][tests] Run Mono iOS sample as functional test on the simulator and maccatalyst on Helix (#86578)

* Add HelloiOS sample on iossimulator

* Enable AOT compilation and JustInterp mode on iossimulator

* Remove custom tasks from the sample app

* Set default props for the sample app. Use diagnostics_tracing and marshal-ilgen for RuntimeComponents

---------

Co-authored-by: Filip Navara <filip.navara@gmail.com>
15 months agoFix NativeAOT JIT-EE bug (#87378)
Michał Petryka [Sun, 11 Jun 2023 16:16:08 +0000 (18:16 +0200)]
Fix NativeAOT JIT-EE bug (#87378)

15 months agoOptimize zero-byte receives on ManagedWebSocket (#87329)
Stephen Toub [Sun, 11 Jun 2023 15:10:18 +0000 (11:10 -0400)]
Optimize zero-byte receives on ManagedWebSocket (#87329)

Today you can perform a zero-byte receive on ManagedWebSocket, but doing so still issues a request to the underlying stream with the receive header buffer.  That in turn can cause the underlying stream to rent and/or pin a buffer.  By special-casing zero-byte reads, we can take advantage of any special-casing in the base stream, and hopefully make it so that when the actual read is performed, the data necessary to satisfy it synchronously is already available.

15 months agoEnable DriveInfoUnix test on iOS (#87162)
Milos Kotlar [Sat, 10 Jun 2023 19:23:52 +0000 (21:23 +0200)]
Enable DriveInfoUnix test on iOS (#87162)

15 months ago[main] Update dependencies from dotnet/arcade dotnet/sdk (#87318)
dotnet-maestro[bot] [Sat, 10 Jun 2023 18:58:49 +0000 (11:58 -0700)]
[main] Update dependencies from dotnet/arcade dotnet/sdk (#87318)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
15 months agoEmit pointer alignment before config knobs (#87360)
Adeel Mujahid [Sat, 10 Jun 2023 18:29:16 +0000 (21:29 +0300)]
Emit pointer alignment before config knobs (#87360)

15 months ago[RISC-V] Fix errors in vm (#87310)
Dong-Heon Jung [Sat, 10 Jun 2023 18:27:37 +0000 (03:27 +0900)]
[RISC-V] Fix errors in vm (#87310)

* [RISC-V] Fix JUMP block size

* [RISC-V] Update constant values

* [RISC-V] Fix decodeJump

* [RISC-V] Update constant values more self-describing

15 months agoMark GeneratedComClass code as generated (#87342)
Jeremy Koritzinsky [Sat, 10 Jun 2023 18:15:56 +0000 (11:15 -0700)]
Mark GeneratedComClass code as generated (#87342)

15 months agoRemove unused methods in cgencpu.h (#87357)
Dong-Heon Jung [Sat, 10 Jun 2023 14:06:10 +0000 (23:06 +0900)]
Remove unused methods in cgencpu.h (#87357)

- `isJump` and `isBackToBackJump`

15 months agoBump HandleHistogram32::SIZE to 16 (#87332)
Egor Bogatov [Sat, 10 Jun 2023 12:05:09 +0000 (14:05 +0200)]
Bump HandleHistogram32::SIZE to 16 (#87332)

15 months agofuse < and > with = when applicable (#78786)
Badre BSAILA [Sat, 10 Jun 2023 12:04:54 +0000 (14:04 +0200)]
fuse < and > with = when applicable (#78786)

15 months agoSimplify ManagedWebSocket.ApplyMask (#87331)
Stephen Toub [Sat, 10 Jun 2023 11:38:35 +0000 (07:38 -0400)]
Simplify ManagedWebSocket.ApplyMask (#87331)

The alignment code isn't necessary or implemented ideally and can make shorter lengths slower to process.  Deleting it for now, and if we decide it's valuable to add back forced-alignment later, we can do so in a more optimal manner.

15 months ago[RISC-V] Fix Stubs for Generics (#87316)
Alexander Soldatov [Sat, 10 Jun 2023 00:43:48 +0000 (03:43 +0300)]
[RISC-V] Fix Stubs for Generics (#87316)

Fix register saving before passing generic instantiation parameter.

15 months agoUse HashCode.Combine() in interop source generators and analyzers instead of custom...
Jackson Schuster [Fri, 9 Jun 2023 23:12:29 +0000 (18:12 -0500)]
Use HashCode.Combine() in interop source generators and analyzers instead of custom GetHashCode implementations (#87221)

Use the HashCode.Combine from shared Roslyn code rather than use the custom implementations that xor the values together. This PR fixes all overrides of GetHashCode in System.Runtime.InteropServices.

15 months agoIncremental mibc merge (#87336)
Sven Boemer [Fri, 9 Jun 2023 22:45:29 +0000 (15:45 -0700)]
Incremental mibc merge (#87336)

Before this change, the merged mibc file would inherit the
timestamp of the input (which are often days in the past, from
the optimization data nuget package). This caused merging to
happen on every incremental build, as dotnet-pgo.dll is always
newer than the output file.

The timestamp was inherited to fix a different incremental build
issue, where updating to a newer optimization data package
wouldn't make the input timestamp new enough to trigger a
re-merge. See https://github.com/dotnet/runtime/pull/56397 for
context.

This fixes both issues by caching the input modification
timestamps, so that the merged output file will get a new
timestamp when it is created, but will be considered out of date
whenever the input timestamps change.

This reduces incremental build times on my machine by
~3s. Contributes to
https://github.com/dotnet/runtime/issues/47022

Also deletes the --inherit-timestamp logic.

15 months agoUpdate to use the cbl-mariner webassembly images. (#86806)
Jeremy Koritzinsky [Fri, 9 Jun 2023 22:25:59 +0000 (15:25 -0700)]
Update to use the cbl-mariner webassembly images. (#86806)

15 months agoAdd marshalling tests and warn if interface is not partial (#87146)
Jackson Schuster [Fri, 9 Jun 2023 22:25:44 +0000 (17:25 -0500)]
Add marshalling tests and warn if interface is not partial (#87146)

Adds tests that marshal different types to and from native, and adds a warning if the interface or any containing types are not marked partial.

15 months agoJIT: Reorder physical promotion and forward sub (#87265)
Jakob Botsch Nielsen [Fri, 9 Jun 2023 20:53:22 +0000 (22:53 +0200)]
JIT: Reorder physical promotion and forward sub (#87265)

Physical promotion breaks more forward sub opportunities than it
introduces, so reorder these phases. Then teach physical promotion to
recognize when it creates new opportunities and selectively reinvoke
forward sub for just those cases.

15 months agoFix ndpinfinal test with JitStress (#87320)
Egor Bogatov [Fri, 9 Jun 2023 20:26:15 +0000 (22:26 +0200)]
Fix ndpinfinal test with JitStress (#87320)

15 months agoRemoving the struct/unmanaged constraint from the Vector types (#87283)
Tanner Gooding [Fri, 9 Jun 2023 19:03:36 +0000 (12:03 -0700)]
Removing the struct/unmanaged constraint from the Vector types (#87283)

15 months agoJIT: Fix gtGetClassHandle with commas (#87313)
Jakob Botsch Nielsen [Fri, 9 Jun 2023 17:57:46 +0000 (19:57 +0200)]
JIT: Fix gtGetClassHandle with commas (#87313)

gtGetClassHandle has comments about "Tunnel through commas", yet several
of the cases then do not actually use the effective value, resulting in
possible asserts when this function is passed a comma.

Fixes an issue I saw in #87265 when morph invokes gtFoldTypeCompare for
the following IR:

```
fgMorphTree BB19, STMT00013 (before)
               [000045] -ACXG------                         *  JTRUE     void
               [000044] -ACXG------                         \--*  NE        int
               [000623] -ACXG------                            +--*  COMMA     ref
               [000622] DA---------                            |  +--*  STORE_LCL_VAR ref    V29 tmp18
               [000621] -----------                            |  |  \--*  LCL_FLD   ref    V07 loc3         [+0]
               [000041] -ACXG------                            |  \--*  CALL nullcheck ref    Microsoft.Extensions.Configuration.Test.ConfigurationProviderTestBase+TestKeyValue:get_AsArray():System.String[]:this
               [000620] -A--------- this                       |     \--*  COMMA     ref
               [000619] DA---------                            |        +--*  STORE_LCL_VAR ref    V30 tmp19
               [000618] -----------                            |        |  \--*  LCL_FLD   ref    V07 loc3         [+8]
               [000617] -----------                            |        \--*  LCL_VAR   ref    V30 tmp19
               [000043] -----------                            \--*  CNS_INT   ref    null
```

15 months agoAdd newly introduced modifiers to our csharp_preferred_modifier_order editorconfig...
Jeremy Koritzinsky [Fri, 9 Jun 2023 17:23:37 +0000 (10:23 -0700)]
Add newly introduced modifiers to our csharp_preferred_modifier_order editorconfig (#86668)

15 months agoCrossgen2 determinism fix and stress mode (#87302)
David Wrighton [Fri, 9 Jun 2023 16:25:39 +0000 (09:25 -0700)]
Crossgen2 determinism fix and stress mode (#87302)

* Build determinism stress mode
To use this, pass --determinism-stress:<howManyTimesToReRunTheJIT> to the compiler.
Also add use of this new mode to our crossgen2 comparison runs

* Fix determinism issue found in JIT
Fixed by always zero-initializing the GenTreeVcon's gtSimdVal field

The exact issue that I debugged to find was at
https://github.com/dotnet/runtime/blob/d88f9a0ed3ac7387d4c16905ff279f4310c03667/src/coreclr/jit/importercalls.cpp#LL3538C1-L3547C18  In particular the issue is that the code constructs a vector constant, but does not zero out the entire constant.

15 months agoRevise how we set tiering and pgo options for spmi benchmark collections (#87292)
Andy Ayers [Fri, 9 Jun 2023 15:21:29 +0000 (08:21 -0700)]
Revise how we set tiering and pgo options for spmi benchmark collections (#87292)

Don't set these in the BDN environment; set them via the BDN command line
so they only impact the process being benchmarked.

Fixes #86410

15 months agoDon't publish wixpacks (#87222)
Matt Mitchell [Fri, 9 Jun 2023 15:05:00 +0000 (08:05 -0700)]
Don't publish wixpacks (#87222)

Not needed after build is complete when PostBuildSign != true

15 months agoAssign correct slots during IEnumerable resolution (#80410)
madelson [Fri, 9 Jun 2023 14:37:37 +0000 (10:37 -0400)]
Assign correct slots during IEnumerable resolution (#80410)

15 months ago[wasi] make console always redirected (#87278)
Pavel Savara [Fri, 9 Jun 2023 10:45:21 +0000 (12:45 +0200)]
[wasi] make console always redirected (#87278)

15 months agoDisable Quic_IsSupportedTests against ActiveIssue (#87306)
Jan Kotas [Fri, 9 Jun 2023 05:38:58 +0000 (22:38 -0700)]
Disable Quic_IsSupportedTests against ActiveIssue (#87306)

Related #87275