platform/upstream/dotnet/runtime.git
20 months agoPod Updates November 2022 (#78578)
Eric StJohn [Sat, 19 Nov 2022 00:52:13 +0000 (16:52 -0800)]
Pod Updates November 2022 (#78578)

20 months agoImprove the handling of Create, CreateScalar, and CreateScalarUnsafe for vectors...
Tanner Gooding [Fri, 18 Nov 2022 23:46:51 +0000 (15:46 -0800)]
Improve the handling of Create, CreateScalar, and CreateScalarUnsafe for vectors (#78236)

* Ensure we create GenTreeVecCon nodes where possible

* Expose gtNewSimdCreateScalarNode and gtNewSimdCreateScalarUnsafeNode

* Applying formatting patch

* Remove some unnecessary handling for simd create

* Responding to PR feedback

* Don't use numeric literal separators for C++

* Use simdType not retType

* Ensure the vector constant initialization logic sets the right indices

* Ensure gtNewSimdAbsNode correctly initializes the constant for f32

* Use InsertNewSimdCreateScalarUnsafeNode on Arm64

* Ensure the right stack index is checked for `CreateBroadcast`

* Workaround an issue with -0.0 on x86

* Revert "Remove some unnecessary handling for simd create"

This reverts commit b155fa5263ceb2bfb8ee4ec458abf05b68620e7e.

20 months agoMake sure to check for isUsedFromSpillTemp() before optimizing float comparison in...
Kunal Pathak [Fri, 18 Nov 2022 23:34:09 +0000 (15:34 -0800)]
Make sure to check for isUsedFromSpillTemp() before optimizing float comparison in code gen (#78548)

* Also check for isUsedFromSpillTemp()`

* Use isUsedFromReg() instead

20 months agoDelete temporary instrumentation for #76280 (#78537)
Jan Kotas [Fri, 18 Nov 2022 23:03:25 +0000 (15:03 -0800)]
Delete temporary instrumentation for #76280 (#78537)

Fixes #76280

20 months ago[mono][llvm] Fix usage of implicit pointer types in a few more places, enable for...
Zoltan Varga [Fri, 18 Nov 2022 20:48:12 +0000 (15:48 -0500)]
[mono][llvm] Fix usage of implicit pointer types in a few more places, enable for LLVM 15+. (#76878)

20 months agoImprove Span.Reverse fast path performance (#70944)
Jesper Meyer [Fri, 18 Nov 2022 19:24:59 +0000 (20:24 +0100)]
Improve Span.Reverse fast path performance (#70944)

20 months agoCode quality concerns (#78485)
Aaron Robinson [Fri, 18 Nov 2022 18:28:55 +0000 (10:28 -0800)]
Code quality concerns (#78485)

* Code quality concerns

* Add justification for suppression.

20 months agoRemove `ContextEntry` from assembly binder - store `Assembly` directly (#78533)
Elinor Fung [Fri, 18 Nov 2022 16:41:14 +0000 (08:41 -0800)]
Remove `ContextEntry` from assembly binder - store `Assembly` directly (#78533)

20 months agoFix commit accounting for large pages (#78531)
Andrew Au [Fri, 18 Nov 2022 16:08:52 +0000 (08:08 -0800)]
Fix commit accounting for large pages (#78531)

20 months agoDo not dehydrate data if CFG is enabled (#78546)
Michal Strehovský [Fri, 18 Nov 2022 15:50:31 +0000 (00:50 +0900)]
Do not dehydrate data if CFG is enabled (#78546)

Two reasons:
1. CFG is already bigger because of all the extra checks. It's by design.
2. We might prefer to keep as many things readonly as possible.
3. This way at least some testing will run to ensure we didn't regress the non-dehydrated configuration.

20 months agoFix freebsd cross build with cmake 3.25 (#78534)
Adeel Mujahid [Fri, 18 Nov 2022 15:21:53 +0000 (17:21 +0200)]
Fix freebsd cross build with cmake 3.25 (#78534)

20 months agoAdd support for dehydrated runtime data structures (#77884)
Michal Strehovský [Fri, 18 Nov 2022 07:31:41 +0000 (16:31 +0900)]
Add support for dehydrated runtime data structures (#77884)

This adds support for dehydrating pointer-rich data structures at compile time and rehydrating them at runtime.

NativeAOT compiler generates several pointer-heavy data structures (the worst offender being MethodTable). These data structures get emitted at compile time and used at runtime to e.g. support casting or virtual method dispatch.

We want to be able to generate structures that have pointers in them because e.g. virtual method dispatch needs to be fast and we don't want to be doing extra math to compute destination (just dereference a pointer in the data structure the compiler generated and call it).

But pointers are big, and there's extra metadata the OS needs in the executable file on top of that (2 bytes on Windows, 24 (!!) bytes on Linux/ELF).

This adds support for "dehydrating" the data structures with pointers at compile time (representing pointers more efficiently) and "rehydrating" them at runtime.

The rehydration is quite fast - I'm seeing 2.2 GB/s throughput on my machine. Hello world rehydrates under a millisecond.

The size savings are significant: 7+% on Windows, 30+% on Linux.

20 months agoCall RhNewArray through RuntimeImports (#78529)
Michal Strehovský [Fri, 18 Nov 2022 07:09:37 +0000 (16:09 +0900)]
Call RhNewArray through RuntimeImports (#78529)

RuntimeExports type is not accessible in the split Runtime.Base/System.Private.CoreLib mode (without INPLACE_RUNTIME defined in CoreLib.csproj).

This was the mode we used in .NET Native where Runtime.Base compiled into mrt100_app.dll and not into the app itself.

20 months ago[mono] Unify invoke code with coreclr (#72717)
Vlad Brezae [Fri, 18 Nov 2022 07:00:20 +0000 (09:00 +0200)]
[mono] Unify invoke code with coreclr (#72717)

* [mono] Add icalls to be used by new invoke machinery

* [mono] Fix IsInstanceOfType check

* [mono] Reuse most of the managed invoke path used by coreclr

* [mono] Implement new version of InternalInvoke icall

This version doesn't receive a MonoArray of params as objects, rather a simple array of byrefs. There is also no need for special handling for nullables. The runtime invoke wrapper receives a boxed nullable, this conversion happens in managed code using ReboxFromNullable and ReboxToNullable. This change might have some side effects on other API making use of the runtime invoke wrapper!

* [mono] Throw NRE for a null byref parameter

Behavior was changed recently.

* [tests] Enable reflection invoke tests on mono

* [mono] Avoid loading reflection invoke machinery during startup

Aside from perf optimization, this allows the usage of LocalAppContextSwitches for invoke tests. Before this change, invoke machinery was initialized before the appcontext properties were set, failing to detect ForceInterpretedInvoke and ForceEmitInvoke properties. CoreCLR also hardcodes string type param.

* [mono] Remove nullable handling case

This API already receives a boxed nullable now.

* [mono] Disable inlining into Invoke stubs

CoreCLR achieves this via NextCallReturnAddress. Add another intrinsic to be used for mono.

* [mono] Fix handling of nullables when invoking from debugger

* [mono] Update code for dyn runtime invokes and llvmonly invoke

Remove special handling for nullables and throwing of NullByRefReturnException.

* [mono] Remove old invoke code

Which was still used only by mono_runtime_invoke_array

* [mono] Move invoke code back in object.c

* [mono] Simplify nullable ctor case

Nullable<T> only has 1 param constructor that creates a boxed vtype

* [mono] Extract invoke code to be reused by mono_runtime_invoke_array

* [mono] Add back support for the embedding api

With same behavior as before, except we have to handle conversions between nullable and boxedvt ourserlves, since it is no longer done by the runtime invoke wrapper.

* [mono] Don't trigger ambiguous method exception when having duplicate method overrides

Seems to be possible via reflection, ex System.Reflection.Emit.Tests.MethodBuilderDefineMethodOverride.DefineMethodOverride_CalledTwiceWithSameBodies_Works

* Disable some warnings

* Disable tests on wasm aot since they rely on stacktraces

20 months agoAdd check for interval->writeThru in the assert (#78418)
Kunal Pathak [Fri, 18 Nov 2022 06:07:58 +0000 (22:07 -0800)]
Add check for interval->writeThru in the assert (#78418)

20 months agoPin FreeBSD build image to fix build break (#78526)
Jan Kotas [Fri, 18 Nov 2022 01:00:00 +0000 (17:00 -0800)]
Pin FreeBSD build image to fix build break (#78526)

Fixes #78522

20 months agoCreateSegment events (#78430)
Andrew Au [Fri, 18 Nov 2022 00:28:45 +0000 (16:28 -0800)]
CreateSegment events (#78430)

20 months agoRemove unused argument from IL test entrypoints (#78501)
Mark Plesko [Fri, 18 Nov 2022 00:26:31 +0000 (16:26 -0800)]
Remove unused argument from IL test entrypoints (#78501)

This is the IL version of #78478.

For test merging, program arguments require extra work. Removing any unused program parameters removes noise from that process. This removes them from IL tests. This was done with an ad-hoc tool. I scanned the diffs. Testing will provide basic checks (easy failure if an argument is used). Risk is if an unused argument was required to test the right thing.

Side effect of tool: BOM removed from ilasm/PortablePdb/TestFiles/TestPdbDebugDirectory2.il

20 months agoAdding EVEX encoding support for CV path. (#78044)
DeepakRajendrakumaran [Thu, 17 Nov 2022 23:33:23 +0000 (15:33 -0800)]
Adding EVEX encoding support for CV path. (#78044)

* Adding EVEX encoding support for CV path.

* Add EVEX encoding support for remaining paths.

20 months ago[main] Update dependencies from dotnet/llvm-project dotnet/xharness dotnet/roslyn...
dotnet-maestro[bot] [Thu, 17 Nov 2022 23:10:02 +0000 (18:10 -0500)]
[main] Update dependencies from dotnet/llvm-project dotnet/xharness dotnet/roslyn (#78486)

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

runtime.linux-arm64.Microsoft.NETCore.Runtime.JIT.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.ObjWriter , runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.ObjWriter , 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.ObjWriter
 From Version 1.0.0-alpha.1.22561.3 -> To Version 1.0.0-alpha.1.22566.1

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

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

* Update dependencies from https://github.com/dotnet/roslyn build 20221114.5

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.5.0-1.22559.12 -> To Version 4.5.0-1.22564.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
20 months agoAdd ability for crossgen2 to synthesize PGO histograms (#77683)
Jakob Botsch Nielsen [Thu, 17 Nov 2022 21:27:53 +0000 (22:27 +0100)]
Add ability for crossgen2 to synthesize PGO histograms (#77683)

Add an option --synthesize-random-mibc. When passed, crossgen2 will use
metadata from the compilation group to synthesize PGO histograms for
methods that did not have any input profile data. Also supported for --embed-pgo-data,
in which case the synthesized PGO data gets embedded.

Adds a synthesizepgo argument to the src/tests/run.cmd/src/tests/run.sh scripts which
enable this mode for compatible tests. So testing can be done locally via:

.\src\tests\build.cmd crossgen2 checked
.\src\tests\run.cmd checked runcrossgen2tests synthesizepgo

20 months agoMove illink documentation to runtime's documentation location (#78520)
Tlakaelel Axayakatl Ceja [Thu, 17 Nov 2022 21:08:29 +0000 (13:08 -0800)]
Move illink documentation to runtime's documentation location (#78520)

Fix links to point to new locations

20 months agoUse forattributename jsgenerator (#78136)
Chris Sienkiewicz [Thu, 17 Nov 2022 19:01:39 +0000 (11:01 -0800)]
Use forattributename jsgenerator (#78136)

* Use ForAttributeWithMetadataName instead of CreateSyntaxProvider

* Remove unused code

* Update export generator too

20 months agoFix the TimeSpan comment about internal representation. (#78364)
Rui Fan [Thu, 17 Nov 2022 17:37:55 +0000 (01:37 +0800)]
Fix the TimeSpan comment about internal representation. (#78364)

20 months ago[mono] Fix support for generic custom attributes. (#78091)
Zoltan Varga [Thu, 17 Nov 2022 17:36:13 +0000 (12:36 -0500)]
[mono] Fix support for generic custom attributes. (#78091)

* [mono] Fix support for generic custom attributes.

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

* Reenable tests.

20 months agoFix fgOptimizeSwitchJumps (#78494)
Bruce Forstall [Thu, 17 Nov 2022 17:10:53 +0000 (09:10 -0800)]
Fix fgOptimizeSwitchJumps (#78494)

This function was corrupting tree links by doing tree modifications
(especially, "stealing" a node from one statement/block to another)
without rethreading the nodes. This happened in a case where a switch
with a dominant (peeled) case (due to PGO info) had a non-trivial
switch condition, leading to inserting a COMMA node.

Fixes #78322

20 months agoRemove some Windows specific formatters (#78434)
Aaron Robinson [Thu, 17 Nov 2022 17:06:12 +0000 (09:06 -0800)]
Remove some Windows specific formatters (#78434)

* Remove remaining Windows printf modifiers

* Remove some uses of %S.

20 months agoRemove unused arguments from C# test Mains (#78478)
Mark Plesko [Thu, 17 Nov 2022 17:01:31 +0000 (09:01 -0800)]
Remove unused arguments from C# test Mains (#78478)

For test merging, program arguments require extra work.  Removing any unused program parameters removes noise from that process.  This removes them from C# tests.  This was done with an ad-hoc tool.  I scanned the diffs.  Testing will provide basic checks (easy failure if an argument is used).  Risk is if an unused argument was required to test the right thing.

Manually updated the template JIT/Regression/JitBlue/Runtime_64125/Runtime_64125.tt for Runtime_64125.cs

Side effects of tool:

CoreMangLib/system/delegate/miscellaneous/co6010delegateequalstwo.cs converted from UTF16 to UTF8

The following tests had leading bytes (presumably BOM) removed:
- GC/Stress/Tests/DictionaryGrowth.cs
- Interop/PInvoke/SetLastError/SetLastErrorTest.cs
- Interop/PInvoke/SetLastError/SetLastErrorTest.cs
- JIT/IL_Conformance/Convert/TestConvertFromIntegral.cs
- JIT/Intrinsics/BMI1Intrinsics.cs
- JIT/Math/Functions/Program.cs
- JIT/opt/ForwardSub/switchWithSideEffects.cs
- JIT/opt/perf/doublenegate/GitHub_57470.cs
- JIT/opt/perf/doublenegate/doublenegate.cs
- JIT/Regression/JitBlue/GitHub_65690/GitHub_65690.cs
- JIT/Regression/JitBlue/Runtime_45090/Runtime_45090.cs
- JIT/Regression/JitBlue/Runtime_49078/Runtime_49078.cs
- JIT/Regression/JitBlue/Runtime_49780/Runtime_49780.cs
- JIT/Regression/JitBlue/Runtime_51612/Runtime_51612.cs
- JIT/Regression/JitBlue/Runtime_52320/Runtime_52320.cs
- JIT/Regression/JitBlue/Runtime_54647/Runtime_54647.cs
- JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.cs
- JIT/Regression/JitBlue/Runtime_64125/Runtime_64125.cs
- JIT/Regression/JitBlue/Runtime_74773/Runtime_74773.cs

20 months agoJIT: Fix too wide loads on arm64 for small structs (#76341)
Egor Bogatov [Thu, 17 Nov 2022 12:32:52 +0000 (13:32 +0100)]
JIT: Fix too wide loads on arm64 for small structs (#76341)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
20 months agoRemoving outdated unused r2rdump tests (#78431)
Brian Bohe [Thu, 17 Nov 2022 04:58:45 +0000 (20:58 -0800)]
Removing outdated unused r2rdump tests (#78431)

* Removing outdated unused r2rdump tests

* Remove project file and script

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
20 months ago[wasm] Jiterpreter cleanup (#78482)
Katelyn Gadd [Thu, 17 Nov 2022 04:24:47 +0000 (20:24 -0800)]
[wasm] Jiterpreter cleanup (#78482)

Expand options.h api with ability to convert current option values to a JSON blob.
Migrate jiterpreter configuration to options.h
Disable jiterpreter automatically after multiple JIT failures

20 months agoRemove some unnecessary templating in assembly binder (#78441)
Elinor Fung [Thu, 17 Nov 2022 01:45:21 +0000 (17:45 -0800)]
Remove some unnecessary templating in assembly binder (#78441)

20 months ago[main] Update dependencies from dotnet/llvm-project (#78480)
dotnet-maestro[bot] [Wed, 16 Nov 2022 23:33:39 +0000 (23:33 +0000)]
[main] Update dependencies from dotnet/llvm-project (#78480)

[main] Update dependencies from dotnet/llvm-project

20 months agoMerge pull request #78077 from dotnet/LinkerIntoRuntime2
Andy Gocke [Wed, 16 Nov 2022 22:12:48 +0000 (14:12 -0800)]
Merge pull request #78077 from dotnet/LinkerIntoRuntime2

Merge ILLink from the dotnet/linker repo into the runtime repo

Tests are working, but packages are not publishing. Follow-up issues at https://github.com/dotnet/runtime/issues/78334

20 months agoDon't inline >8 bytes of IL calls in BBJ_THROW (#78386)
Egor Bogatov [Wed, 16 Nov 2022 21:40:08 +0000 (22:40 +0100)]
Don't inline >8 bytes of IL calls in BBJ_THROW (#78386)

20 months ago[wasm] Add intrinsics for BitOperations zero count (#78391)
Radek Doulik [Wed, 16 Nov 2022 21:09:23 +0000 (22:09 +0100)]
[wasm] Add intrinsics for BitOperations zero count (#78391)

20 months agoFixes around virtual method hierarchy validation (#78157)
Vitek Karas [Wed, 16 Nov 2022 21:06:37 +0000 (13:06 -0800)]
Fixes around virtual method hierarchy validation (#78157)

Adds the test from linker and fixes to make it work.
Mostly finding all the places where we can detect method overrides.

20 months agoPrefer OutputRid over PackageRID for output artifacts. (#76871)
Tom Deseyn [Wed, 16 Nov 2022 20:57:07 +0000 (21:57 +0100)]
Prefer OutputRid over PackageRID for output artifacts. (#76871)

* Prefer OutputRid over PackageRID for output artifacts.

This is a non-functional change that makes it more visible
these are output artifacts.

* installer/tests: keep using PackageRID.

* System.Net.*/tests: use OutputRid everywhere.

20 months agoOnly R2R public methods, methods that override public methods, and internal methods...
Jeremy Koritzinsky [Wed, 16 Nov 2022 20:56:51 +0000 (12:56 -0800)]
Only R2R public methods, methods that override public methods, and internal methods that aren't always inlined (#75793)

20 months agoDisable distributed transactions test (#78468)
Shay Rojansky [Wed, 16 Nov 2022 20:21:36 +0000 (21:21 +0100)]
Disable distributed transactions test (#78468)

See #77241

20 months agoFix single quote processing from debug output. (#78479)
Jiri Cincura ↹ [Wed, 16 Nov 2022 20:04:39 +0000 (21:04 +0100)]
Fix single quote processing from debug output. (#78479)

20 months agoAdd more readme for M.E libraries (#78477)
Maryam Ariyan [Wed, 16 Nov 2022 20:03:23 +0000 (15:03 -0500)]
Add more readme for M.E libraries (#78477)

20 months ago[main] Update dependencies from dotnet/runtime dotnet/llvm-project dotnet/icu dotnet...
dotnet-maestro[bot] [Wed, 16 Nov 2022 19:58:31 +0000 (19:58 +0000)]
[main] Update dependencies from dotnet/runtime dotnet/llvm-project dotnet/icu dotnet/xharness dotnet/emsdk dotnet/roslyn-analyzers dotnet/roslyn (#78314)

[main] Update dependencies from dotnet/runtime dotnet/llvm-project dotnet/icu dotnet/xharness dotnet/emsdk dotnet/roslyn-analyzers dotnet/roslyn

20 months agoAdding check on R2RDump (#78343)
Brian Bohe [Wed, 16 Nov 2022 19:42:09 +0000 (11:42 -0800)]
Adding check on R2RDump (#78343)

* Adding check on variable debug info ranges

* Adding r2rdump command argument --val

Set it to ensure variable debug info is not empty.

* Adding new r2rdump argument to test script

* Adding new r2rdump argument to CoreLib dump test

* Adding new r2rdump argument to tests

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
20 months ago[wasm] Add link to debugger docs from WasmAppHost docs (#78471)
Marek Fišera [Wed, 16 Nov 2022 19:02:40 +0000 (20:02 +0100)]
[wasm] Add link to debugger docs from WasmAppHost docs (#78471)

* [wasm] Add link to debugger docs from WasmAppHost docs.

* Forward and backward slashes

* Fix

20 months agonew RID: wasi-wasm (#78376)
Pavel Savara [Wed, 16 Nov 2022 18:51:59 +0000 (19:51 +0100)]
new RID: wasi-wasm (#78376)

- new RID: wasi-wasm
- msbuild: TargetsWasi, mono.wasiruntime subset
- differentiate wasm on Browser from wasm on Wasi, renamed IsBrowserProject
- build shell files
- initial CMake files
- CI pipeline platform wasi_wasm
- OperatingSystem.OSPlatformName ="Wasi"
- OperatingSystem.IsWasi()

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
20 months ago[NativeAOT] Address some COOP native helpers that could cause suspension pauses....
Vladimir Sadov [Wed, 16 Nov 2022 18:48:20 +0000 (10:48 -0800)]
[NativeAOT] Address some COOP native helpers that could cause suspension pauses. (#78450)

* Memmove<T> to shared source.

* Delete RhpCopyObjectContents

* RhCompareObjectContentsAndPadding is ok, but added an assert.

* remove unused BulkMoveWithWriteBarrier in Augments

20 months ago[marshal] Cleanup dead ifdefs (#78435)
Aleksey Kliger (λgeek) [Wed, 16 Nov 2022 18:44:43 +0000 (13:44 -0500)]
[marshal] Cleanup dead ifdefs (#78435)

1. The `DISABLE_NONBLITTABLE` define was a previous attempt at partitioning the marshaling into a simple version that just supports blittable types and the full legacy marshaller.  It was never used in production.

2. The `ENABLE_ILGEN` was used previously in configurations where runtime codegen was not available to save some space by excluding support for emitting IL at runtime (needed for marshaling, fast managed allocators in sgen, etc).  It also used to emit the ilgen support code into a separate static library that could optionallly be linked into the runtime, and enabled with an appropriate API call (`mono_marshal_ilgen_init`).  This define is now on by default and the API function is a no-op.

3. Mark a collection of `mono_win32_compat_` functions with `MONO_RT_EXTERNAL_ONLY` and move them to `external-only.c` (these were used in mono/mono dllmap support to provide some common kernel32 functions on non-Windows)

4. Remove `MonoMarshalILgenCallbacks` in `marshal-ilgen.c` - just do direct calls to the `_ilgen` helper functions

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

20 months agoAdds readme for more extension items (#77865)
Maryam Ariyan [Wed, 16 Nov 2022 18:25:31 +0000 (13:25 -0500)]
Adds readme for more extension items (#77865)

20 months agoRemove most *PrintToStd* functions (#78437)
Aaron Robinson [Wed, 16 Nov 2022 16:59:09 +0000 (08:59 -0800)]
Remove most *PrintToStd* functions (#78437)

These functions either weren't used or simply called
each other directly. This reduces them to the only
ones we actually need.

Remove the ExposeExceptionsInCOM knob that isn't
used by the .NET Interop team at all.

20 months agoFix parameters order when creating XmlConfigurationElementTextContent object (#78433)
Tarek Mahmoud Sayed [Wed, 16 Nov 2022 16:58:14 +0000 (08:58 -0800)]
Fix parameters order when creating XmlConfigurationElementTextContent object (#78433)

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

20 months ago[wasm] Use Helix's retry mechanism to re-run debugger tests on CI if .. (#78357)
Ankit Jain [Wed, 16 Nov 2022 16:37:16 +0000 (11:37 -0500)]
[wasm] Use Helix's retry mechanism to re-run debugger tests on CI if .. (#78357)

.. they failed while waiting for the browser to launch.

Related: https://github.com/dotnet/arcade/tree/main/src/Microsoft.DotNet.Helix/Sdk#test-retry

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

20 months agoJIT: Use compile time handle for instruction comments on xarch too (#78382)
Jakob Botsch Nielsen [Wed, 16 Nov 2022 13:55:58 +0000 (14:55 +0100)]
JIT: Use compile time handle for instruction comments on xarch too (#78382)

When displaying addr modes we were using the base constant as the handle
type, which does not work in R2R code. We would end up displaying
"hackishClassName" for class handles (the SPGO handler ends up handling
the exception thrown).

We're already storing the proper compile time handle in the debug
information (in particular due to arm64), so we can just use that
instead.

20 months agoDedup Enumerable.Any with Enumerable.TryGetNonEnumeratedCount (#78438)
Stephen Toub [Wed, 16 Nov 2022 11:42:33 +0000 (06:42 -0500)]
Dedup Enumerable.Any with Enumerable.TryGetNonEnumeratedCount (#78438)

20 months agoAdd sdcardfs to filesystems list (#78424)
Adeel Mujahid [Wed, 16 Nov 2022 11:19:26 +0000 (13:19 +0200)]
Add sdcardfs to filesystems list (#78424)

20 months agoAdd HashTo/GetCurrentHashAs{UInt32/64} methods (#78075)
Stephen Toub [Wed, 16 Nov 2022 11:12:53 +0000 (06:12 -0500)]
Add HashTo/GetCurrentHashAs{UInt32/64} methods (#78075)

* Add HashTo/GetCurrentHashAs{UInt32/64} methods

* Address PR feedback

20 months agoUse IndexOfAny in IndexOfHtmlAttributeEncodingChars (#78240)
Stephen Toub [Wed, 16 Nov 2022 11:11:21 +0000 (06:11 -0500)]
Use IndexOfAny in IndexOfHtmlAttributeEncodingChars (#78240)

* Use IndexOfAny in IndexOfHtmlAttributeEncodingChars

* Tweak usage of IndexOf

20 months agoUse zero register in csel when possible (#78330)
SwapnilGaikwad [Wed, 16 Nov 2022 09:45:14 +0000 (09:45 +0000)]
Use zero register in csel when possible (#78330)

20 months agoFixing typo in area-owners (#78429)
Jose Perez Rodriguez [Wed, 16 Nov 2022 08:45:56 +0000 (00:45 -0800)]
Fixing typo in area-owners (#78429)

20 months agoIntroduce WASM JITs for interpreter opcodes, do_jit_call, and interp_entry wrappers...
Katelyn Gadd [Tue, 15 Nov 2022 22:02:59 +0000 (14:02 -0800)]
Introduce WASM JITs for interpreter opcodes, do_jit_call, and interp_entry wrappers (#76477)

This PR introduces a "jiterpreter" just-in-time WASM compiler for interpreter opcodes along with a set of specialized WASM JIT compilers to improve the performance of interp_entry and do_jit_call. The result is significantly improved performance for pure-interpreter workloads along with measurable speedups for interp->aot and aot->interp transitions in mixed mode AOT applications. In this commit it is disabled by default, with the exception of an optimization to use wasm exception handling if available for do_jit_call (as a replacement for mono_llvm_catch_cpp_exception).

It will be enabled by default in a future PR.

20 months agoUpdating fabricbot area pods (#78415)
Jose Perez Rodriguez [Tue, 15 Nov 2022 21:08:50 +0000 (13:08 -0800)]
Updating fabricbot area pods (#78415)

* Updating fabricbot area pods

* Also update area-owners.json

20 months ago[MONO] Move Marshal-ilgen into a component (#75542)
Nathan Ricci [Tue, 15 Nov 2022 20:48:03 +0000 (15:48 -0500)]
[MONO] Move Marshal-ilgen into a component (#75542)

* Move marshal_ilgen into a component.

20 months agoLinker into runtime diff2 (#78049)
Tlakaelel Axayakatl Ceja [Wed, 9 Nov 2022 00:16:11 +0000 (16:16 -0800)]
Linker into runtime diff2 (#78049)

* Merge and remove common files
Remove arcade eng\common directory in src\tools\illink since now we will use the runtime arcade infra
Remove build.cmd/build.sh and lint.cmd/lint.sh in src\tools\illink directory since now they will execute via a subset
Remove/Merge common files from src\tools\illink root:
 - .gitattributes
 - .gitignore
 - .github
 - .gitmodules
 - after.illink.sln.targets
 - code_of_conduct.md
 - global.json
 - LICENSE.txt
 - NuGet.config
 - THIRD-PARTY-NOTICES.TXT
Remove/Merge common files from src\tools\illink\eng:
 - Build.props
 - Publishing.props
 - Signing.props
 - SourceBuild.props
 - SourceBuildPrebuiltBaseline.xml
 - Tools.props
 - Version.Details.xml
 - Versions.props

* Create subsets to be able to build illink
Create a variable for the tools folder in runtime
Add subsets tools.illink and tools.illinktests for building illink and unitest it
Add Microsoft.DotNet.Cecil dependencies to runtime and to illink projects
Some workarounds to be able to build illink
Delete some cecil information from the external folder since now its a package

* Refactorings to make test work
Test projects use to have relative paths based on the current working directory to know where to find stuff, now that the project is in a different place things are not found, this commit changes to instead use MSBuild variables to calculate where things are
Add the cecil package to tests
Change a cecil test that verify the official package name to only care about the important pieces

* Enable pipeline
Add a variable to recognize when illink contains a change, and set an exclusion of the src/tools/* for other repos
Reuse the dotnet-linker-tests pipeline file to also run illink unitests every time there are illink changes

* Fix Markdown lint

* Remove checked-in binaries

* Use nunit for linker tests and fix cecil version test

20 months agoFix ALC lookup from the DAC (#78400)
Aaron Robinson [Tue, 15 Nov 2022 20:29:50 +0000 (12:29 -0800)]
Fix ALC lookup from the DAC (#78400)

* Fix ALC lookup from the DAC

It seems the SOS commands for ALC lookup have
been broken for a bit. Some parts of the impl
weren't DAC-ized and caused failures.

20 months agoFix Parameter order passed to ConfigurationDebugViewContext (#78352)
Tarek Mahmoud Sayed [Tue, 15 Nov 2022 18:47:45 +0000 (10:47 -0800)]
Fix Parameter order passed to ConfigurationDebugViewContext (#78352)

Fix https://github.com/dotnet/runtime/issues/78306

20 months agoVarious support changes and cleanups for the jiterpreter PR (#78225)
Katelyn Gadd [Tue, 15 Nov 2022 18:32:34 +0000 (10:32 -0800)]
Various support changes and cleanups for the jiterpreter PR (#78225)

Introduce mono_interp_is_method_multicastdelegate_invoke
Add interpreter opcodes for Math.Min, Math.Max, and Math.Abs
Make it easy to configure AOT+trimming for browser-bench to do comparison tests between AOT and interp
Add missing td->cbb update in interpreter transform
Add mono_wasm_array_length_ref missing safe wasm API
Optimize out linker placeholder wrappers that were slowing down most C->TS calls
Generate warning messages for missing cwraps imports from C
Simplify/optimize _zero_region

20 months agoTrigger AVX-512 pipeline on PRs, not merges (#78351)
Bruce Forstall [Tue, 15 Nov 2022 17:29:43 +0000 (09:29 -0800)]
Trigger AVX-512 pipeline on PRs, not merges (#78351)

20 months ago[wasm] Test `SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http11.ResponseHead...
Marek Fišera [Tue, 15 Nov 2022 16:57:11 +0000 (17:57 +0100)]
[wasm] Test `SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http11.ResponseHeaders_ExtraWhitespace_Trimmed` not supported on NodeJS. (#78375)

Test `SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http11.ResponseHeaders_ExtraWhitespace_Trimmed` is not supported on NodeJS.
Test introduced in the https://github.com/dotnet/runtime/pull/74393.
Closes https://github.com/dotnet/runtime/issues/77631.

20 months ago[mono] Force AOT+interpreter for iOSSimulator arm64 library test local build (#76551)
Mitchell Hwang [Tue, 15 Nov 2022 14:18:08 +0000 (09:18 -0500)]
[mono] Force AOT+interpreter for iOSSimulator arm64 library test local build (#76551)

* [mono] Force AOT and interpreter for iOSSimulator arm64 library test build

* [mono] Extend Force AOT+interpreter to iOS device

* [mono] Enable Force Interp+AOT for tvOS device and arm64 sim

* [iOS][tvOS] Update build with auto populated RunAOTCompilation and MonoForceInterpreter properties

* Remove RunAOTCompilation and MonoForceInterpreter from iOS/tvOS pipelines

* Revert "Remove RunAOTCompilation and MonoForceInterpreter from iOS/tvOS pipelines"

This reverts commit f27b1ae15a6434e95415f30e7e01c74258e3046c.

20 months ago[PERF] Fix mono dotnet creation (#78257)
Parker Bibus [Tue, 15 Nov 2022 09:22:46 +0000 (01:22 -0800)]
[PERF] Fix mono dotnet creation (#78257)

20 months agofix MulticastLoopback option for IPv6 (#78285)
Tomas Weinfurt [Mon, 14 Nov 2022 19:25:10 +0000 (11:25 -0800)]
fix MulticastLoopback option for IPv6 (#78285)

20 months agoRemoving obsolete references to 'emitMaxTmpSize' (#78199)
DeepakRajendrakumaran [Mon, 14 Nov 2022 19:11:47 +0000 (11:11 -0800)]
Removing obsolete references to 'emitMaxTmpSize' (#78199)

20 months agoRemove unused method in CngKey
Kevin Jones [Mon, 14 Nov 2022 18:23:13 +0000 (13:23 -0500)]
Remove unused method in CngKey

20 months agoLonger timeout for Interpreter run (#78311)
Jiri Cincura ↹ [Mon, 14 Nov 2022 17:26:26 +0000 (18:26 +0100)]
Longer timeout for Interpreter run (#78311)

20 months agoAdd a VN-based dead store removal phase (#77990)
SingleAccretion [Mon, 14 Nov 2022 16:49:03 +0000 (19:49 +0300)]
Add a VN-based dead store removal phase (#77990)

* Add a flag for explicit inits

* Move optConservativeNormalVN

* Fix call rationalization

* Add VN-based dead store removal

* Limit to partial stores only

Fewer regressions; a bit faster TP-wise.

Diffs (libraries.pmi) for the full implementation:
---------------------------------------------------------------------------------
 2,236 contexts with diffs (1,871 improvements, 111 regressions)
   -25,583/+1,467 bytes

Diffs (libraries.pmi) for partial definitions only:
---------------------------------------------------------------------------------
 1,687 contexts with diffs (1,683 improvements, 3 regressions)
   -23,661/+25 bytes

TP impact about the same, ~0.05% against ~0.045%.

* Revert "Add a flag for explicit inits"

This reverts commit 127dccf0a3ee0462a0d5c435548c4a200661e354.

* Fix VN logic for zero-init

(The "lvaIsOSRLocal" check in codegen was redundant)

* Add JitEnableVNBasedDeadStoreRemovalRange

* Update phase description

20 months agoJIT: Check layout equality of GT_OBJ/GT_BLK nodes in GenTree::Compare (#78312)
Jakob Botsch Nielsen [Mon, 14 Nov 2022 15:58:14 +0000 (16:58 +0100)]
JIT: Check layout equality of GT_OBJ/GT_BLK nodes in GenTree::Compare  (#78312)

Fix #78310

20 months agoFix argument exception names in File/DirectoryInfo (#78239)
Stephen Toub [Mon, 14 Nov 2022 15:48:34 +0000 (10:48 -0500)]
Fix argument exception names in File/DirectoryInfo (#78239)

20 months agoArm64: Support additional condition checks in select nodes (#78223)
Alan Hayward [Mon, 14 Nov 2022 13:59:26 +0000 (13:59 +0000)]
Arm64: Support additional condition checks in select nodes (#78223)

Generating a FEQ or FNEU will generate an incorrect compare.

With the optimizer code fixed, it's not possible to generate a
test to trigger the code in codegen. However, the code as it is was
wrong. Given it's untested, it might be better to replace it with
some asserts?

I've added some general compare consume tests to ensure everything
is generated ok.

20 months ago[mono] Fix some asserts caused by #78182. (#78291)
Zoltan Varga [Mon, 14 Nov 2022 09:30:20 +0000 (04:30 -0500)]
[mono] Fix some asserts caused by #78182. (#78291)

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

20 months ago[mono][llvm] Fix a crash when emitting P_OBJC_GET_SELECTOR opcodes. (#78215)
Zoltan Varga [Mon, 14 Nov 2022 08:46:21 +0000 (03:46 -0500)]
[mono][llvm] Fix a crash when emitting P_OBJC_GET_SELECTOR opcodes. (#78215)

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

20 months agoNumber block assignments normally (#77690)
SingleAccretion [Mon, 14 Nov 2022 08:42:02 +0000 (11:42 +0300)]
Number block assignments normally (#77690)

Aka delete "fgValueNumberBlockAssignment".

20 months agoFix handling generic custom attributes (#78297)
Michal Strehovský [Mon, 14 Nov 2022 03:36:58 +0000 (12:36 +0900)]
Fix handling generic custom attributes (#78297)

Fixes #78200.

20 months agoRevert "Allocate boxed static structs on Frozen Object Heap and remove getFieldAddres...
Egor Bogatov [Mon, 14 Nov 2022 03:36:31 +0000 (04:36 +0100)]
Revert "Allocate boxed static structs on Frozen Object Heap and remove getFieldAddress (#77737)" (#78296)

This reverts commit cabb8b089fd3d84fc46446c2079ddc1981b55fd9.

20 months agoFix `--singlemethodname` (#78207)
Michal Strehovský [Sun, 13 Nov 2022 23:44:30 +0000 (08:44 +0900)]
Fix `--singlemethodname` (#78207)

Single method compilation mode broke with the change to use System.CommandLine. "Not specified" no longer means `null`.

20 months agoComputeManagedAssembliesToCompileToNative: Make microsoft.netcore.app check case...
Alex Rønne Petersen [Sun, 13 Nov 2022 23:43:17 +0000 (00:43 +0100)]
ComputeManagedAssembliesToCompileToNative: Make microsoft.netcore.app check case-insensitive. (#78022)

The inputs can come from SDK pack paths where the Microsoft.NETCore.App part of
the path is *not* lower case, resulting in files such as coreclr.dll,
createdump.exe, etc being copied to the publish directory.

20 months agoAllocate boxed static structs on Frozen Object Heap and remove getFieldAddress (...
Egor Bogatov [Sun, 13 Nov 2022 20:48:33 +0000 (21:48 +0100)]
Allocate boxed static structs on Frozen Object Heap and remove getFieldAddress (#77737)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
20 months agoFix nullable annotations in ITypeDescriptorContext (#78287)
gpetrou [Sun, 13 Nov 2022 13:28:42 +0000 (15:28 +0200)]
Fix nullable annotations in ITypeDescriptorContext (#78287)

20 months agoDon't emit manifest for NativeRuntimeEventSource (#78213)
David Mason [Sun, 13 Nov 2022 08:13:15 +0000 (00:13 -0800)]
Don't emit manifest for NativeRuntimeEventSource (#78213)

20 months agoUpdate deep-dive-blog-posts.md (#78281)
Stephen Toub [Sun, 13 Nov 2022 00:50:31 +0000 (19:50 -0500)]
Update deep-dive-blog-posts.md (#78281)

20 months agofix: [Wasm] Adjust windows build (#70689)
Jérôme Laban [Sat, 12 Nov 2022 14:17:58 +0000 (09:17 -0500)]
fix: [Wasm] Adjust windows build (#70689)

Co-authored-by: Ankit Jain <radical@gmail.com>
20 months agoFix Equals in hot reload scenario (#78249)
Buyaa Namnan [Sat, 12 Nov 2022 03:22:24 +0000 (19:22 -0800)]
Fix Equals in hot reload scenario (#78249)

* Fix Equals in hot reload scenario

Co-authored-by: Steve Harter <steveharter@users.noreply.github.com>
20 months agoDelete `fgMorphBlockOperand` (#77688)
SingleAccretion [Sat, 12 Nov 2022 00:45:34 +0000 (03:45 +0300)]
Delete `fgMorphBlockOperand` (#77688)

* Stop calling fgMorphBlockOperand

* Fix missing NO_CSEs

* Simplify

* Delete fgMorphBlockOperand

20 months agoReact to CheckForOverflowUnderflow in regex source generator (#78228)
Stephen Toub [Fri, 11 Nov 2022 22:59:41 +0000 (17:59 -0500)]
React to CheckForOverflowUnderflow in regex source generator (#78228)

* React to CheckForOverflowUnderflow in regex source generator

The regex source generator uses code patterns that might have arithmetic overflows, e.g. a bounds check with `(uint)index < span.Length`.  These are intentional, and they're benign... unless the project/compilation has opted-in to overflow/underflow checking (CheckForOverflowUnderflow).  In that case, the code for many patterns can start throwing false positive overflow exceptions, making the source generator unusable.

This commit causes the generator to look at the CheckOverflow setting in the compilation options, and if it's set, to emit `unchecked { ... }` around all the relevant code.

* Address PR feedback

20 months agoSystem.Diagnostics.TraceSource readme small typo (#78253)
Carlos Sanchez [Fri, 11 Nov 2022 22:49:59 +0000 (14:49 -0800)]
System.Diagnostics.TraceSource readme small typo (#78253)

The framework where we publish it is NETCore.App, not WindowsDesktop.

20 months agoSystem.Diagnostics.EventLog: Add README (#78243)
Carlos Sanchez [Fri, 11 Nov 2022 22:32:36 +0000 (14:32 -0800)]
System.Diagnostics.EventLog: Add README (#78243)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
20 months agoFix relative symlink support in TarFile (#77338)
Adeel Mujahid [Fri, 11 Nov 2022 21:46:06 +0000 (23:46 +0200)]
Fix relative symlink support in TarFile (#77338)

* Fix relative symlink support in TarFile

* Update src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectory.File.Roundtrip.cs

Co-authored-by: David Cantú <dacantu@microsoft.com>
Co-authored-by: David Cantú <dacantu@microsoft.com>
20 months ago[mono][aot] Prefer concrete instances instead of gshared ones for met… (#78182)
Zoltan Varga [Fri, 11 Nov 2022 21:15:35 +0000 (16:15 -0500)]
[mono][aot] Prefer concrete instances instead of gshared ones for met… (#78182)

* [mono][aot] Prefer concrete instances instead of gshared ones for methods containing type equality checks.

For example, calls to Vector<T>.IsSupported cannot be optimized away in a method where T
is T_BYTE because its written as:

```
            get => (typeof(T) == typeof(byte)) ||
                   (typeof(T) == typeof(double)) ||
```

and T_BYTE could be instantiated with an enum whose basetype is byte.

Fixes some of the issues in https://github.com/dotnet/runtime/issues/78163.

* Avoid an assert when compiling Vector<object> instances.

20 months agoFix recursive assembly spec parsing with textual PGO (#78035)
Jakob Botsch Nielsen [Fri, 11 Nov 2022 21:12:33 +0000 (22:12 +0100)]
Fix recursive assembly spec parsing with textual PGO (#78035)

* Add thread local to skip textual PGO data if invoked recursively
* Change AssemblyNameParser.ParseVersion to pass
  NumberFormatInfo.InvariantInfo in its ushort.TryParse invocation.
  This avoids initializing globalization from within this parsing, which
  was causing problems in the textual PGO scenario.

Fix #77971

20 months agoMemoryExtensions.Replace(Span<T>, T, T) implemented (#76337)
Günther Foidl [Fri, 11 Nov 2022 20:50:56 +0000 (21:50 +0100)]
MemoryExtensions.Replace(Span<T>, T, T) implemented (#76337)

* Defined API

* Tests

* Scalar implementation

* Use EqualityComparer<T>.Default instead

* Delegation to SpanHelpers.Replace

* ReplaceValueType implemented

* Use ushort instead of short, as it doesn't sign-extend for broadcast and in the scalar loop

* Forward string.Replace(char, char) to SpanHelpers.ReplaceValueType

* Process remainder vectorized only when not done already and with max width available

* Split into inlineable scalar path and non-inlineable vectorized path

* Replaced open coded loops with Replace

* Don't use EqualityComparer<T>.Default

Cf. https://github.com/dotnet/runtime/pull/76337#discussion_r982886319

* Remove guards for remainder

Cf. https://github.com/dotnet/runtime/pull/76337#discussion_r983448480

* Don't split method into scalar and vectorized and don't force inlining of scalar-part

* Fixed assert

ReplaceValueType is called from string.Replace(char, char) so the Debug.Assert was on wrong position, as at entry to method non accelerated platforms are allowed to call it.

* Better handling of remainder from the vectorized loop(s)

Intentionally leave one iteration off, as the remaining elements are done vectorized anyway. This eliminates the less probable case (cf. https://github.com/dotnet/runtime/pull/76337#discussion_r983448480) that the last vector is done twice.

* PR feedback

20 months agoSystem.Diagnostics.PerformanceCounter: Add README (#78244)
Carlos Sanchez [Fri, 11 Nov 2022 20:10:51 +0000 (12:10 -0800)]
System.Diagnostics.PerformanceCounter: Add README (#78244)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>