platform/upstream/dotnet/runtime.git
2 years agoEnable IDE0030 (Use coalesce expression) (#70948)
Stephen Toub [Sun, 19 Jun 2022 13:08:59 +0000 (09:08 -0400)]
Enable IDE0030 (Use coalesce expression) (#70948)

2 years agoAllow ValueListBuilder to work with empty scratch spans (#70917)
Stephen Toub [Sun, 19 Jun 2022 11:55:32 +0000 (07:55 -0400)]
Allow ValueListBuilder to work with empty scratch spans (#70917)

2 years agoUpdate C# compiler (#70947)
Stephen Toub [Sun, 19 Jun 2022 11:52:45 +0000 (07:52 -0400)]
Update C# compiler (#70947)

Brings in support for required members

2 years agoOptimization for full range checks (#70145) (#70222)
Sychev Vadim [Sun, 19 Jun 2022 10:30:09 +0000 (13:30 +0300)]
Optimization for full range checks (#70145) (#70222)

2 years agoEnable IDE0065 (Misplaced using directive) (#70919)
Stephen Toub [Sun, 19 Jun 2022 04:44:31 +0000 (00:44 -0400)]
Enable IDE0065 (Misplaced using directive) (#70919)

2 years agoEnable IDE0100 (Remove redundant equality) (#70896)
Stephen Toub [Sun, 19 Jun 2022 04:43:37 +0000 (00:43 -0400)]
Enable IDE0100 (Remove redundant equality) (#70896)

2 years agoEnable IDE0071 (Simplify interpolation) (#70918)
Stephen Toub [Sun, 19 Jun 2022 04:41:30 +0000 (00:41 -0400)]
Enable IDE0071 (Simplify interpolation) (#70918)

2 years agoEventLogException is missing the original win32 error code (#70629)
Badre BSAILA [Sun, 19 Jun 2022 04:20:37 +0000 (06:20 +0200)]
EventLogException is missing the original win32 error code (#70629)

2 years agosuperpmi.py: Add `-jitoption` for asmdiffs (#70939)
Bruce Forstall [Sat, 18 Jun 2022 19:53:53 +0000 (12:53 -0700)]
superpmi.py: Add `-jitoption` for asmdiffs (#70939)

The new `-jitoption` option passes the argument options to both baseline and diff
compilers. This is a convenience option: there already is `-base_jit_option` and
`-diff_jit_option` to specify passing options to either baseline or diff.

The name of the option is the same as that used for `replay`.

2 years agoRemove some dead code / branches (#70146)
Stephen Toub [Sat, 18 Jun 2022 12:21:09 +0000 (08:21 -0400)]
Remove some dead code / branches (#70146)

* Remove some dead code / branches

Some signal amidst the noise in an lgtm.com report.

* Address PR feedback

2 years agoEnable lib tests that used to fail with GC issues (#70831)
Lakshan Fernando [Sat, 18 Jun 2022 11:49:24 +0000 (04:49 -0700)]
Enable lib tests that used to fail with GC issues (#70831)

* enable lib tests that used to fail with GC issues

* excluding linq parallel test since that doesn't build

* Threading.Thread tests have issues

* Excluding new test failures

2 years agoUse u8 in a few more places (#70894)
Stephen Toub [Sat, 18 Jun 2022 10:48:26 +0000 (06:48 -0400)]
Use u8 in a few more places (#70894)

* Use u8 in a few more places

* A few more u8s

2 years agoHarden for null byrefs (#70317)
Aaron Robinson [Sat, 18 Jun 2022 04:31:25 +0000 (21:31 -0700)]
Harden for null byrefs (#70317)

* Remove enum_flag_Unrestored usage in boxing stubs.

* Add AND instruction (21h) to x86 decoder.

* Update mono for null ref in interpreter paths.

* Disable test on llvmfullaot and wasm

* Handle null destination for intrinsics.

2 years ago[main] Update dependencies from dotnet/runtime dotnet/icu dotnet/xharness dotnet...
dotnet-maestro[bot] [Sat, 18 Jun 2022 03:53:03 +0000 (23:53 -0400)]
[main] Update dependencies from dotnet/runtime dotnet/icu dotnet/xharness dotnet/runtime-assets dotnet/emsdk dotnet/roslyn-analyzers (#70476)

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

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.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 7.0.0-beta.22281.1 -> To Version 7.0.0-beta.22308.1

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

Microsoft.NET.Workload.Emscripten.Manifest-7.0.100
 From Version 7.0.0-preview.6.22281.1 -> To Version 7.0.0-preview.6.22308.2

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

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

* Revert "Update dependencies from https://github.com/dotnet/emsdk build 20220608.2"

This reverts commit bbb4e156ddbad8a2cb7b604246214272085b6622.

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 7.0.0-preview.6.22306.1 -> To Version 7.0.0-preview.6.22309.1

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

Microsoft.NET.Workload.Emscripten.Manifest-7.0.100
 From Version 7.0.0-preview.6.22281.1 -> To Version 7.0.0-preview.6.22308.2

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

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.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 7.0.0-beta.22281.1 -> To Version 7.0.0-beta.22310.1

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

Microsoft.CodeAnalysis.NetAnalyzers
 From Version 7.0.0-preview1.22302.1 -> To Version 7.0.0-preview1.22310.1

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

Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , System.Text.Json
 From Version 7.0.0-preview.6.22305.4 -> To Version 7.0.0-preview.6.22312.5

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 7.0.0-preview.6.22306.1 -> To Version 7.0.0-preview.6.22313.1

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

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

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

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.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 7.0.0-beta.22281.1 -> To Version 7.0.0-beta.22313.1

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

Microsoft.NET.Workload.Emscripten.Manifest-7.0.100
 From Version 7.0.0-preview.6.22281.1 -> To Version 7.0.0-preview.6.22313.1

* [wasm] Wasm.Build.Tests: Disable strict version checks for emcc

Due to the way we have to update `dotnet/emsdk`, and get the update PRs
in `runtime`, the emsdk version can be mismatched. For example, if
`dotnet/emsdk` has already updated to `3.1.12`, but `dotnet/runtime` is
still on `3.1.7`. This is an expected scenario while working on updating
to a newer emscripten.

The version mismatch will still show up, but as a warning now.

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

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

* [wasm] Wasm.Build.Tests: Update Skiasharp reference

The skiasharp dependent tests fail with:
`error : undefined symbol: _ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv`.

Update the reference to the latest package which added a binary compiled
for `3.1.7`.

* [wasm] Workaround a test failure in WBT

Currently, there is a mismatch between emsdk versions with the workload
emscripten packs using `3.1.12`, and the runtime being built with
`3.1.7`. And that is causing
`Wasm.Build.Tests.NativeLibraryTests.ProjectUsingSkiaSharp` to fail with:

```
EXEC : error : undefined symbol: _ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv (referenced by top-level compiled C/C++ code) [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : Link with `-sLLD_REPORT_UNDEFINED` to get more information on undefined symbols [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0` [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : __ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : error : undefined symbol: _ZNKSt3__221__basic_string_commonILb1EE20__throw_length_errorEv (referenced by top-level compiled C/C++ code) [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : warning : __ZNKSt3__221__basic_string_commonILb1EE20__throw_length_errorEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
EXEC : error : Aborting compilation due to previous errors [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
emcc : error : '/datadisks/disk1/work/B1420981/w/ACC90933/e/dotnet-workload/packs/Microsoft.NET.Runtime.Emscripten.3.1.12.Node.linux-x64/7.0.0-preview.6.22313.1/tools/bin/node /datadisks/disk1/work/B1420981/w/ACC90933/e/dotnet-workload/packs/Microsoft.NET.Runtime.Emscripten.3.1.12.Sdk.linux-x64/7.0.0-preview.6.22313.1/tools/emscripten/src/compiler.js /datadisks/disk1/work/B1420981/t/tmp44tn7y2d.json' failed (returned 1) [/datadisks/disk1/work/B1420981/w/ACC90933/e/blz_nativeref_aot_Debug/blz_nativeref_aot_Debug.csproj]
```

This commit adds a temporary workaround to ignore the undefined symbols
for this specific test. And this should be removed when runtime is
updated to `3.1.12` .

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoAppend the function pointer type (#70923)
Aaron Robinson [Sat, 18 Jun 2022 03:05:47 +0000 (20:05 -0700)]
Append the function pointer type (#70923)

The issue here was the recursion into PrettyPrintSigWorkerInternal
that would reset the buffer. Now, we pass in a new buffer and append
it when we return.

2 years agoUse ArgumentNullException.ThrowIfNull in a few more places (#70897)
Stephen Toub [Sat, 18 Jun 2022 00:36:47 +0000 (20:36 -0400)]
Use ArgumentNullException.ThrowIfNull in a few more places (#70897)

2 years agoAdd support for delegate GDV and method-based vtable GDV (#68703)
Jakob Botsch Nielsen [Fri, 17 Jun 2022 23:58:01 +0000 (01:58 +0200)]
Add support for delegate GDV and method-based vtable GDV (#68703)

Add support for instrumenting delegate calls and vtable calls into method handle histograms. Use these histograms to do GDV for delegate calls and also support method-based GDV for vtable calls.

For instrumentation we now support class probes at interface call sites, method probes at delegate call sites and both class probes and method probes at vtable call sites. For vtable calls, when turned on, instrumentation produces both histograms as PGO data so that the JIT can later make the choice about what is the best form of guard to use at that site.

For guarding, there are some things to take into account. Delegate calls currently (practically) always point to precode, so this PR is just guarding on getFunctionFixedEntryPoint which returns the precode address, and this is generally quite cheap (same cost as class-based GDV). That's the case for delegates pointing to instance methods anyway, this PR does not support static methods yet -- those will be more expensive.

For vtable calls the runtime will backpatch the slots when tiering, so the JIT guards the address retrieved from the vtable against an indirection of the slot, which is slightly more expensive than a class-based guard.

Currently the instrumentation is enabled conditionally with COMPlus_JitDelegateProfiling=1 (for delegates) and COMPlus_JitVTableProfiling=1 (for vtable calls). Currently delegate profiling is turned on by default while vtable profiling is off by default.

2 years agoReplace the remaining uses of Marshal.PtrToStructure in core networking (#70900)
Jan Kotas [Fri, 17 Jun 2022 23:51:17 +0000 (16:51 -0700)]
Replace the remaining uses of Marshal.PtrToStructure in core networking (#70900)

* Rename ICMP interop to match Windows SDK names

2 years agoFix ICorDebugFunction2::GetVersionNumber for arm32. (#69901)
Mikhail Kurinnoi [Fri, 17 Jun 2022 23:02:28 +0000 (02:02 +0300)]
Fix ICorDebugFunction2::GetVersionNumber for arm32. (#69901)

2 years agoRemove #define Sleep (#70868)
Aaron Robinson [Fri, 17 Jun 2022 22:38:07 +0000 (15:38 -0700)]
Remove #define Sleep (#70868)

* Remove #define Sleep

2 years agoFix bug in Tar preventing extraction of hardlinks or entries starting with `.\` ...
Carlos Sanchez [Fri, 17 Jun 2022 21:02:07 +0000 (14:02 -0700)]
Fix bug in Tar preventing extraction of hardlinks or entries starting with `.\` (#70853)

* Add PlatformDetection.SupportsHardLinkCreation property.

* Fix how paths are combined/joined and sanitized on extraction, to ensure paths with redundant segments get properly handled.

* Add tests that verify archives with entries whose paths start with .\, including the root folder itself.

* Re-enable the hardlink test, condition it to not run if platform does not support extraction of hardlinks.

* Remove unnecessary test - This same code is already being tested by TarReader_ExtractToFile_Tests.ExtractEntriesWithSlashDotPrefix

* Reuse test code that retrieves memory stream.

* Bump test data package version

* Add missing typeof(PlatformDetection) in ConditionalFact

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
2 years ago[wasm] Add support for per-project customization of helix work items (#70461)
Ankit Jain [Fri, 17 Jun 2022 20:24:28 +0000 (16:24 -0400)]
[wasm] Add support for per-project customization of helix work items (#70461)

* [wasm] Add support for per-project customization of helix work items

Currently, for sending tests to helix:
1. the project binaries are zipped, as part of the project build
2. then separate helix targets files build that adds helix items for
   those zip files.
    - for wasm, we test with multiple 'scenarios' - like v8, browser, and
    nodejs.
    - so, 3 helix work items are submitted per zip file

- If a test project needs to have any customizations, for example, for
  testing crypto with a managed implementation, and subtlecrypto, which
  would require:
  - passing different arguments to xharness, in case of managed, and
    subtlecrypto
  - and this should be done only for the browser case
  - Currently, this would need this would need to be done in
  `sendtohelix-wasm.targets` special casing for the test project, and
  scenario.

- We add support for importing `$(ProjectName).helix.targets`, and
  calling a special target in that to add helix items, as needed.

- This targets file can be set in the test project like:
```xml
<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>
```
  - it will get deployed next to the zip file, and picked up automatically

```xml
<Project>
  <PropertyGroup>
    <_CryptoProjectName>System.Security.Cryptography.Tests</_CryptoProjectName>
    <System_Security_Cryptography_Tests_TargetName Condition="'$(Scenario))' == 'WasmTestOnBrowser'">System_Security_Cryptography_Tests_Targ
et</System_Security_Cryptography_Tests_TargetName>
  </PropertyGroup>

  <Target Name="System_Security_Cryptography_Tests_Target">
    <ItemGroup>
      <HelixWorkItem Include="$(Scenario)-managed-$(_CryptoProjectName)">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>
      </HelixWorkItem>

      <HelixWorkItem Include="$(Scenario)-subtlecrypto-System.Security.Cryptography.Tests">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>

        <PreCommands Condition="'$(OS)' == 'Windows_NT'">set &quot;WasmXHarnessArgs=--web-server-use-cors&quot;</PreCommands>
        <PreCommands Condition="'$(OS)' != 'Windows_NT'">export &quot;WasmXHarnessArgs=--web-server-use-cors&quot;</PreCommands>
      </HelixWorkItem>
    </ItemGroup>
  </Target>
```

- The targets file *must* have these:
    - a property named like `System_Security_Cryptography_Tests_TargetName`, for a
      test project named `System.Security.Cryptography.Tests`
    - if this property is not set, then the default behavior of adding
      work items will run
    - The target should add any items it needs to to `@(HelixWorkItem)`.
      - Examples of adding these can be seen in `sendtohelix*` project files

- Remember that all these properties, and targets get imported into the
  msbuild *global* namespace, so make sure to use unique names to avoid
  conflicts with other test projects.

Future work: this commit only enables it for wasm/library tests, but it should
be easy to extract it out, but needs some testing.

* [wasm] Helix: test with, and without subtle crypto

* disable non-wasm builds

* address review feedback

* Address review feedback

* Fix typo

* Revert "disable non-wasm builds"

This reverts commit 7ef99e81f82200189dd3f61eeaf00d6ca4ced6d4.

* Update src/libraries/System.Security.Cryptography/tests/wasm.helix.targets

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Address review feedback

* remove debug spew

* Change the way helix extension targets are discovered.

The new approach:

To run a custom project specific target for adding/editing @(HelixWorkItem):

- In the project add:
    `<HelixTargetsFile Condition="'$(TargetOS)' == 'Browser'">wasm.helix.targets</HelixTargetsFile>`

    - This file gets copied next to the test archive as $(MSBuildProjectName).helix.targets

- In this `wasm.helix.targets` file, add to $(HelixExtensionTargets) to run your custom target

```xml
  <PropertyGroup Condition="'$(IsRunningLibraryTests)' == 'true' and '$(Scenario)' == 'WasmTestOnBrowser'">
    <HelixExtensionTargets>$(HelixExtensionTargets);_AddHelixCrypoItems</HelixExtensionTargets>
```

- The extension target will be called after the default items are added
  to `@(HelixWorkItem)`.
- Useful properties to condition on: $(Scenario), $(IsRunningLibraryTests)
- And add to, change, or remove from @(HelixWorkItem)

Example:
```xml
  <Target Name="_AddHelixCrypoItems">
    <ItemGroup>
      <!-- remove the existing item -->
      <HelixWorkItem Remove="@(HelixWorkItem)" Condition="'%(OriginalFileName)' == '$(_CryptoProjectName)'" />

        <!-- add two new ones - managed, and subtylecrypto -->
      <HelixWorkItem Include="$(WorkItemPrefix)managed-$(_CryptoProjectName)">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>
        <OriginalFileName>$(_CryptoProjectName)</OriginalFileName>
      </HelixWorkItem>

      <HelixWorkItem Include="$(WorkItemPrefix)subtlecrypto-$(_CryptoProjectName)">
        <PayloadArchive>$(TestArchiveTestsDir)$(_CryptoProjectName).zip</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_workItemTimeout)</Timeout>
        <OriginalFileName>$(_CryptoProjectName)</OriginalFileName>

        <PreCommands Condition="'$(OS)' == 'Windows_NT'">set &quot;WasmXHarnessArgs=%WasmXHarnessArgs% --web-server-use-cop&quot;</PreCommands>
        <PreCommands Condition="'$(OS)' != 'Windows_NT'">export &quot;WasmXHarnessArgs=$WasmXHarnessArgs --web-server-use-cop&quot;</PreCommands>
      </HelixWorkItem>

      <_CryptoHelixItem Include="@(HelixWorkItem)"
                        Condition="$([System.String]::new('%(HelixWorkItem.Identity)').EndsWith('-$(_CryptoProjectName)'))" />
    </ItemGroup>

    <Error Text="Something went wrong. Expected to have only two work items for $(_CryptoProjectName). But got @(_CryptoHelixItem)"
           Condition="@(_CryptoHelixItem->Count()) != 2" />
  </Target>
```

* cleanup

* Move WBT specific stuff into the target too. This will make it simpler to move it off into a targets file later

* fix build

* fix libtests

* fix wbt

* [wasm] Bump helix timeout to 90mins for debugger tests on windows

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2 years agoAdd event to capture min/max threads (#70063)
Eduardo Velarde [Fri, 17 Jun 2022 17:56:23 +0000 (10:56 -0700)]
Add event to capture min/max threads (#70063)

Event ThreadPoolMinMaxThreads added.

Parameters are:
            ushort MinWorkerThreads
            ushort MaxWorkerThreads
            ushort MinIOCompletionThreads
            ushort MaxIOCompletionThreads
            ushort ClrInstanceID

It is fired in the ThreadPool constructor and in the SetMinThreads/SetMaxThreads functions.

2 years agoFix for timer scheduling happening on the incorrect thread when wasm threading is...
Katelyn Gadd [Fri, 17 Jun 2022 17:30:12 +0000 (10:30 -0700)]
Fix for timer scheduling happening on the incorrect thread when wasm threading is enabled (#70863)

2 years agoReplace a few instances of PtrToStructure with more efficient marshalling (#70866)
Jan Kotas [Fri, 17 Jun 2022 15:43:13 +0000 (08:43 -0700)]
Replace a few instances of PtrToStructure with more efficient marshalling (#70866)

2 years agoUnpin locals, attempt 2 (#70655)
Joni Aromaa [Fri, 17 Jun 2022 15:00:45 +0000 (18:00 +0300)]
Unpin locals, attempt 2 (#70655)

Contributes to #40553

2 years agoUse hash/hmac one shots in NTLM (#70857)
Kevin Jones [Fri, 17 Jun 2022 14:19:07 +0000 (10:19 -0400)]
Use hash/hmac one shots in NTLM (#70857)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoFix failure building two libraries tests (#70881)
Michal Strehovský [Fri, 17 Jun 2022 12:17:51 +0000 (21:17 +0900)]
Fix failure building two libraries tests (#70881)

Microsoft.CSharp was hitting an issue due to a vararg constructor. We don't support varargs. They shouldn't make it into the dependency graph. We are already checking in many places. We were erroneously thinking a vararg constructor with no mandatory arguments is a default constructor.

Runtime.InteropServices were crashing because we got a MulticastDelegate type into a codepath that expects a MulticastDelegate descendant.

2 years agoEnable IDE0020 (Use pattern matching) (#70523)
Stephen Toub [Fri, 17 Jun 2022 12:11:32 +0000 (08:11 -0400)]
Enable IDE0020 (Use pattern matching) (#70523)

* Enable IDE0020 (Use pattern matching)

* Update src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs

Co-authored-by: Buyaa Namnan <buyankhishig.namnan@microsoft.com>
* Update variable naming

Co-authored-by: Buyaa Namnan <buyankhishig.namnan@microsoft.com>
2 years agoAvoid crashing on unresolved dependencies (#70871)
Michal Strehovský [Fri, 17 Jun 2022 11:50:44 +0000 (20:50 +0900)]
Avoid crashing on unresolved dependencies (#70871)

Fixes #70815.

2 years agoGenerate method bodies for delegate Invoke methods (#70883)
Michal Strehovský [Fri, 17 Jun 2022 11:49:48 +0000 (20:49 +0900)]
Generate method bodies for delegate Invoke methods (#70883)

There is a dataflow warning suppression in System.Linq.Expressions that assumes we'll always have an invocable method body for delegate Invoke method. We need one in IL. We don't in native code.

Emulate what IL Linker does and generate a method body. This is a size regression.

Suppression: https://github.com/dotnet/runtime/blob/3b2883b097a773715ca84056885e0ca1488da36e/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs#L906-L912

Fixes #70880.

2 years agoImprove TLS1.3 detection in registry for QUIC (#70730)
Radek Zikmund [Fri, 17 Jun 2022 09:56:33 +0000 (11:56 +0200)]
Improve TLS1.3 detection in registry for QUIC (#70730)

* Improve TLS1.3 detection in registry for QUIC

* Split client and server detection

* Code review feedback

2 years agoUse new byte[] span optimization in a few more places (#70665)
Stephen Toub [Fri, 17 Jun 2022 09:26:20 +0000 (05:26 -0400)]
Use new byte[] span optimization in a few more places (#70665)

* Use new byte[] span optimization in a few more places

Separated out of larger change to use CreateSpan (these don't rely on that).

* Address PR feedback

2 years agoEnable IDE0054 (Use compound assignment) (#70564)
Stephen Toub [Fri, 17 Jun 2022 09:26:03 +0000 (05:26 -0400)]
Enable IDE0054 (Use compound assignment) (#70564)

* Enable IDE0054 (Use compound assignment)

* Update src/libraries/System.Data.Common/src/System/Data/Common/StringStorage.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
2 years agoAssign proper VNs to "shared constant" CSE defs (#70852)
SingleAccretion [Fri, 17 Jun 2022 09:23:08 +0000 (12:23 +0300)]
Assign proper VNs to "shared constant" CSE defs (#70852)

* Assign proper VNs to shared CSE defs

They must be those of the original expression, not the "base" constant CSE creates.

* Add a test

2 years agoARM64 - Optimize `i % 2` (#70599)
Will Smith [Fri, 17 Jun 2022 03:57:37 +0000 (20:57 -0700)]
ARM64 - Optimize `i % 2` (#70599)

2 years agoSmall performance cleanups in S.S.Cryptography
Kevin Jones [Fri, 17 Jun 2022 03:07:11 +0000 (23:07 -0400)]
Small performance cleanups in S.S.Cryptography

2 years agoFix GC stress failure in LoaderAllocator::CompareExchangeValueInHandle (#70832)
Jan Kotas [Fri, 17 Jun 2022 02:02:09 +0000 (19:02 -0700)]
Fix GC stress failure in LoaderAllocator::CompareExchangeValueInHandle (#70832)

InterlockedCompareExchangeT has to be called on a raw Object* to make the GC stress infrastructure happy.

2 years agoRestore ArchivingUtils.AttemptSetLastWriteTime (#70617)
Carlos Sanchez [Fri, 17 Jun 2022 01:57:07 +0000 (18:57 -0700)]
Restore ArchivingUtils.AttemptSetLastWriteTime (#70617)

2 years agoDelete StaticallyLinked property from Microsoft.NETCore.Native.Unix.props (#70854)
Jan Kotas [Fri, 17 Jun 2022 01:51:54 +0000 (18:51 -0700)]
Delete StaticallyLinked property from Microsoft.NETCore.Native.Unix.props (#70854)

This option has many issues. Anybody trying to experiment with static linking can add `<LinkerArg Include="-static" />` into the local file.

2 years agoUse `Array.Empty()` in `System.Reflection.Metadata`. (#70862)
Theodore Tsirpanis [Fri, 17 Jun 2022 01:46:59 +0000 (04:46 +0300)]
Use `Array.Empty()` in `System.Reflection.Metadata`. (#70862)

It is now available in all frameworks it targets.

2 years agoJIT: break loop canonicalization into two stages (#70809)
Andy Ayers [Fri, 17 Jun 2022 01:15:26 +0000 (18:15 -0700)]
JIT: break loop canonicalization into two stages (#70809)

For a given loop, we need to separate out the true backedge, any
non-loop backedges, and any inner loop backedges so that they all
target distinct blocks.

Otherwise, we may violate assumptions that the loop entry dominates
all blocks in the loop and that all backedges that reach top come
from within the loop.

This seems simplest to do with two rounds of canonicalization, one
that moves the non-loop edges, and another that moves the true backedge.

Fixes #70802.

2 years agoFixing the handling of Positive NaN in Math.Min for float/double (#70795)
Tanner Gooding [Fri, 17 Jun 2022 00:47:08 +0000 (17:47 -0700)]
Fixing the handling of Positive NaN in Math.Min for float/double (#70795)

* Adding tests validating Positive NaN for Max, MaxMagnitude, Min, and MinMagnitude

* Fixing the handling of Positive NaN in Math.Min for float/double

* Fixing the Max/Min code comments to use greater and lesser

* Adding a code comment clarifying the sign toggling behavior

2 years ago[coop] fix coop suspend timeout cue card (#70828)
Aleksey Kliger (λgeek) [Thu, 16 Jun 2022 23:35:51 +0000 (19:35 -0400)]
[coop] fix coop suspend timeout cue card (#70828)

the BLOCKING_SUSPEND_REQUESTED state is treated as suspend in full
coop mode (the thread keeps running, but by definition it's not
allowed to access managed resources and it will self-suspend if it
tries to enter GC Unsafe mode by calling a runtime API or managed
code).
It is bad in hybrid suspend mode (the thread should be preemptively
suspended, but we timed out before the signal handler had a chance to
run).

The corresponding suspension logic in the code is:

https://github.com/dotnet/runtime/blob/3fc61ebb562afc327a8fc6de5c82d76e86bf6f5d/src/mono/mono/utils/mono-threads.c#L1149-L1158

2 years agoCatch (more) mismatched args in `fgMorphArgs` (#70846)
SingleAccretion [Thu, 16 Jun 2022 22:45:33 +0000 (01:45 +0300)]
Catch (more) mismatched args in `fgMorphArgs` (#70846)

* Catch (more) mismatched args in "fgMorphArgs"

* Add a test

2 years agoFix a few Stream-related issues in System.Net.Http (#70731)
Stephen Toub [Thu, 16 Jun 2022 22:20:28 +0000 (18:20 -0400)]
Fix a few Stream-related issues in System.Net.Http (#70731)

* Fix a few Stream-related issues in System.Net.Http

* Put back WriteTimeout

* Fix tests

2 years agoFix corerun for assemblies with mismatched filename (#70800)
Jan Kotas [Thu, 16 Jun 2022 21:51:46 +0000 (14:51 -0700)]
Fix corerun for assemblies with mismatched filename (#70800)

corerun gracefully handled filename not matching the assembly name. Handling of this case regressed in #68186. This change is fixing the regression.

Fixes #68455

2 years agoUse IndexOf{Any} in a few more places (#70176)
Stephen Toub [Thu, 16 Jun 2022 21:20:12 +0000 (17:20 -0400)]
Use IndexOf{Any} in a few more places (#70176)

* Use IndexOf{Any} in a few more places

* Address PR feedback

2 years ago[wasm] Enabled WriteToReadOnly tests - emscripten bug got fixed (#70814)
Ilona Tomkowicz [Thu, 16 Jun 2022 21:19:35 +0000 (23:19 +0200)]
[wasm] Enabled WriteToReadOnly tests - emscripten bug got fixed (#70814)

Fixes #53021.

Enabled tests from #53021 - they are passing now because issue reported by @radekdoulik got fixed: https://github.com/emscripten-core/emscripten/issues/14299.

2 years agoDisable long running test (#70843)
Fan Yang [Thu, 16 Jun 2022 21:14:12 +0000 (17:14 -0400)]
Disable long running test (#70843)

2 years agoEnable IDE1005 (Delegate invocation can be simplified) (#70522)
Stephen Toub [Thu, 16 Jun 2022 20:57:36 +0000 (16:57 -0400)]
Enable IDE1005 (Delegate invocation can be simplified) (#70522)

2 years ago[wasm] Disable WBT test failing on windows (#70808)
Ankit Jain [Thu, 16 Jun 2022 20:33:58 +0000 (16:33 -0400)]
[wasm] Disable WBT test failing on windows (#70808)

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

2 years agoNarrow cast fix (#70518)
Will Smith [Thu, 16 Jun 2022 19:10:53 +0000 (12:10 -0700)]
Narrow cast fix (#70518)

* Added genActualTypeSize. Remove narrow cast if the actual type sizes are the same

* Trying to fix build

* Fixing build

* Removed genActualTypeSize. Using genActualType instead

* Added helper function

* Comments

* Moving back to morph

* Removing part of the test

* Added fgOptimizeCastOnAssignment

* Fixing build

* Removing extra bits

* Removed fgIsSafeToRemoveIntToIntCastOnAssignment, inlining the implementation, adding extra logic when actual types are not the same

2 years agoTighten checks in `areArgumentsContiguous` (#70829)
SingleAccretion [Thu, 16 Jun 2022 19:10:08 +0000 (22:10 +0300)]
Tighten checks in `areArgumentsContiguous` (#70829)

* Tighten checks in "areArgumentsContiguous"

* Add a test

2 years agoJIT: Optimize range checks for X >> CNS and for short/byte indices (#67141)
Egor Bogatov [Thu, 16 Jun 2022 18:34:25 +0000 (20:34 +0200)]
JIT: Optimize range checks for X >> CNS and for short/byte indices  (#67141)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
2 years agoAdd limited support for LocalCertificateSelectionCallback for QUIC (#70716)
Radek Zikmund [Thu, 16 Jun 2022 18:22:50 +0000 (20:22 +0200)]
Add limited support for LocalCertificateSelectionCallback for QUIC (#70716)

* Inline state transition helpers

Fixes #55437

* Add high level comments for HandleEventReceive and ReadAsync

* [QUIC] Call `LocalCertificateSelectionCallback` to get client certificate

* Code review feedback

2 years agoDelete redundant aliases for primitive types (#70805)
Jan Kotas [Thu, 16 Jun 2022 18:07:56 +0000 (11:07 -0700)]
Delete redundant aliases for primitive types (#70805)

2 years agoSimplify `Environment.IsWindows8OrAbove`. (#70818)
Theodore Tsirpanis [Thu, 16 Jun 2022 18:06:52 +0000 (21:06 +0300)]
Simplify `Environment.IsWindows8OrAbove`. (#70818)

* Simplify Environment.IsWindows8OrAbove.
Since .NET 5, the regular Windows version detecton code always returns the correct version.

* Remove two unused interop files.

2 years agoAdd two new stages to prepare for our new custom type marshalling design. (#70598)
Jeremy Koritzinsky [Thu, 16 Jun 2022 17:37:25 +0000 (10:37 -0700)]
Add two new stages to prepare for our new custom type marshalling design. (#70598)

2 years agoAdd icon to dotnet.exe on Windows (#70578)
Elinor Fung [Thu, 16 Jun 2022 16:49:57 +0000 (09:49 -0700)]
Add icon to dotnet.exe on Windows (#70578)

2 years agoUpdate dogfooding instructions (#70833)
Jan Kotas [Thu, 16 Jun 2022 15:49:18 +0000 (08:49 -0700)]
Update dogfooding instructions (#70833)

- Delete note about multilevel lookup. It is not relevant anymore.
- Fix nightly feed url to net7
- Replace .NET Core with just .NET

2 years agoUse LastIndexOf in ZipArchiveEntry.GetFileName_Unix (#70701)
Stephen Toub [Thu, 16 Jun 2022 15:14:27 +0000 (11:14 -0400)]
Use LastIndexOf in ZipArchiveEntry.GetFileName_Unix (#70701)

There's not particularly good reason to open-code the loop here.

2 years agoJIT: relax fwd sub restriction on changing class handle (#70587)
Andy Ayers [Thu, 16 Jun 2022 15:11:43 +0000 (08:11 -0700)]
JIT: relax fwd sub restriction on changing class handle (#70587)

For HW SIMD types, at least.

Fixes #64879.

2 years agoFix regression in runtime-jit-experimental (#70797)
Aman Khalid [Thu, 16 Jun 2022 15:09:08 +0000 (08:09 -0700)]
Fix regression in runtime-jit-experimental (#70797)

The newly-introduced `emitRemoveJumpToNextInst` optimization caused
a regression when hot/cold-splitting, where jumps from the last hot
instruction to the first cold instruction were erroneously removed.
This is fixed by disabling the `isRemovableJmpCandidate` flag for
branches between hot/cold sections.

On an unrelated note, a JIT dump message has been added to indicate
stress-splitting is occurring.

2 years agoFix emitDispJumpList for Arm64 (#70542)
Kunal Pathak [Thu, 16 Jun 2022 14:57:24 +0000 (07:57 -0700)]
Fix emitDispJumpList for Arm64 (#70542)

* fix jitdump

* Fix arm build

* Another format

2 years agoTest additional NativeAOT Lib testing (#70212)
Lakshan Fernando [Thu, 16 Jun 2022 14:51:40 +0000 (07:51 -0700)]
Test additional NativeAOT Lib testing (#70212)

* Test additional NativeAOT Lib testing

* more libraries to un nativeaot rolling build

* FB

* FB2

* only write results file if specified in args

* excluding failing tests

* oops, missed pull before a forced push

* excluding some recently added tests that fail

* fix typo with end element

* FB

2 years agoEnable ThreadAbort with CET enabled via the QueueUserAPC2 (#70803)
Jan Vorlicek [Thu, 16 Jun 2022 10:41:45 +0000 (12:41 +0200)]
Enable ThreadAbort with CET enabled via the QueueUserAPC2 (#70803)

This change makes ThreadAbort work when CET is enabled. Instead of
thread redirection, it uses the new user mode APC mechanism to get a
thread to a handler and then throws the ThreadAbortException from there
if the thread was interrupted at a safe location.

I have verified it works using mdbg tests and also by manual testing in
the Visual Studio 2022 using a test app that creates an instance of
classes with properties containing infinite loop, wait on a lock, wait
on a handle, infinite loop inside of a lock and infinite loop in
finally.
For the testing, I've enabled this separately from the CET so that the
missing support for CET in the debugger code doesn't cause troubles.

So we could enable this without CET enabled too, but I'd prefer doing
that separately.

2 years agoAdd end-to-end test for NTLM/Negotiate authentication against fake server (#70630)
Filip Navara [Thu, 16 Jun 2022 06:45:07 +0000 (08:45 +0200)]
Add end-to-end test for NTLM/Negotiate authentication against fake server (#70630)

* Add end-to-end test for NTLM/Negotiate authentication against fake server

* Simplify the test since HttpClientHandler is always SocketsHttpHandler for the test environment

* Fix test condition

* Remove extra comment

2 years agoAdd SubstitutionParser that uses XPath Navigator into NativeAOT (#64671)
Tlakaelel Axayakatl Ceja [Thu, 16 Jun 2022 03:26:52 +0000 (20:26 -0700)]
Add SubstitutionParser that uses XPath Navigator into NativeAOT (#64671)

2 years ago[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)
Thays Grazia [Thu, 16 Jun 2022 03:15:03 +0000 (00:15 -0300)]
[wasm][debugger] Remove workaround to get pauseOnExceptions setting (#70748)

2 years agoAvoid infinite loop in case of heap corruption (#70759)
Andrew Au [Thu, 16 Jun 2022 03:03:52 +0000 (20:03 -0700)]
Avoid infinite loop in case of heap corruption (#70759)

Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
2 years agoJIT: rework optCanonicalizeLoop (#70792)
Andy Ayers [Thu, 16 Jun 2022 01:17:26 +0000 (18:17 -0700)]
JIT: rework optCanonicalizeLoop (#70792)

Rework loop canonicalization in anticipation of extending it to handle
non-loop edges like those seen in #70802 (details in #70569).

The code to fix up flow out of `h` was not needed and has been removed.
We now assert upstream that no such fix up will be needed.

2 years agoFind&replace FastInterlock* with Interlocked* (#70784)
Jan Kotas [Wed, 15 Jun 2022 23:22:25 +0000 (16:22 -0700)]
Find&replace FastInterlock* with Interlocked* (#70784)

FastInterlock* operations were #defined as aliases to regular Interlock* operations. Deleted the FastInterlock* aliases and replaced usage with Interlocked* operations.

2 years agoUpgrade SDK to Preview 5 (#70117)
Andy Gocke [Wed, 15 Jun 2022 22:21:53 +0000 (15:21 -0700)]
Upgrade SDK to Preview 5 (#70117)

Upgrade to released Preview 5 build

2 years agoMake ConnectWithRevocation_StapledOcsp more resilient to being slow
Jeremy Barton [Wed, 15 Jun 2022 22:07:12 +0000 (15:07 -0700)]
Make ConnectWithRevocation_StapledOcsp more resilient to being slow

2 years agoRemove GSS_KRB5_CRED_NO_CI_FLAGS_X code (#70772)
Filip Navara [Wed, 15 Jun 2022 21:36:10 +0000 (23:36 +0200)]
Remove GSS_KRB5_CRED_NO_CI_FLAGS_X code (#70772)

The support for building with GSS_KRB5_CRED_NO_CI_FLAGS_X was broken for quite some time. Attempts to reenable it failed due to bug in the krb5 GSSAPI implementation resulting in invalid memory accesses.

2 years agoEnable IlcTrimMetadata by default (#70201)
Michal Strehovský [Wed, 15 Jun 2022 20:46:25 +0000 (05:46 +0900)]
Enable IlcTrimMetadata by default (#70201)

Enables more aggressive metadata stripping by default. In this mode, the AOT compiler only generates reflection metadata for artifacts that were deemed reflection-visible by either dataflow analysis, or user inputs. Previously we would consider everything that got generated reflection-visible.

* Change the defaults within the compiler (making the conservative mode opt-in).
* Add tests for scenarios in https://github.com/dotnet/runtimelab/issues/656 (resolves dotnet/runtimelab#656).
* Update tests
* Do more marking where it was necessary

2 years agoUpdate .net version for asp.net spmi collection script (#70778)
Andy Ayers [Wed, 15 Jun 2022 20:42:35 +0000 (13:42 -0700)]
Update .net version for asp.net spmi collection script (#70778)

2 years agoJIT: Faster long->int overflow checks (#69865)
Egor Bogatov [Wed, 15 Jun 2022 19:53:41 +0000 (21:53 +0200)]
JIT: Faster long->int overflow checks (#69865)

2 years agoJIT: Enable addressing modes for gc types (#70749)
Egor Bogatov [Wed, 15 Jun 2022 19:24:26 +0000 (21:24 +0200)]
JIT: Enable addressing modes for gc types (#70749)

2 years agoPredicate for valid Tracker Reference is inverted (#70709)
Aaron Robinson [Wed, 15 Jun 2022 18:16:22 +0000 (11:16 -0700)]
Predicate for valid Tracker Reference is inverted (#70709)

* Predicate for valid Tracker Reference is inverted

* Fix test to not inline wrapper creation function.

2 years agoHandle HW exceptions on Windows without redirection (#70428)
Jan Vorlicek [Wed, 15 Jun 2022 17:30:07 +0000 (19:30 +0200)]
Handle HW exceptions on Windows without redirection (#70428)

This change modifies the way hardware exceptions are propagated from the
vectored exception handler. Until now, runtime was returning from the
vectored exception handler with instruction pointer in the context set
to an asm helper. That redirected the thread to that helper and we have
raised an exception from its call chain.
While working on CET support, it was found that propagating exceptions
from the vectored exception handler directly works just fine. So this
change makes it work that way for all Windows targets.

2 years agoEnable redirection on arm64 (#70769)
Vladimir Sadov [Wed, 15 Jun 2022 16:59:22 +0000 (09:59 -0700)]
Enable redirection on arm64 (#70769)

2 years agoFix race condition in LoaderAllocator::CompareExchangeValueInHandle (#70765)
Jan Kotas [Wed, 15 Jun 2022 15:42:50 +0000 (08:42 -0700)]
Fix race condition in LoaderAllocator::CompareExchangeValueInHandle (#70765)

The method was not actually using interlocked operation. It made it possible for multiple different values to win.

Fixes #70742

2 years ago[Mono] Fix C4018 round I (#70417)
Fan Yang [Wed, 15 Jun 2022 15:40:44 +0000 (11:40 -0400)]
[Mono] Fix C4018 round I (#70417)

* First round of change of fixing C4018

* Address part of review feedback

* Change the type of idx to unsigned for `effective_table_slow`

* Add idx range check after the type was changed

* Address review feedback for `class-init.c`

* Change the return type of `*table_num_rows*` to `guint32`. Deal with the consequence of return type change of `table_info_get_rows`. Correct the type of a few local variables which store the return of `mono_metadata_token_index`.

* Update return type

* Address review feedbacks of metadata.c

* Fix native crash

* Make counter private to for-loop

* Address review feedbacks

* Address review feedbacks

2 years agoNativeAOT Unlock assignability comparison in reflection-free (#70726)
Andrii Kurdiumov [Wed, 15 Jun 2022 14:53:12 +0000 (20:53 +0600)]
NativeAOT Unlock assignability comparison in reflection-free (#70726)

* NativeAOT Unlock assignability comparison in reflection-free
Closes #69960

* Document support for `IsAssignableFrom`

* Document support for `IsInstanceOfType`

* Document `IsAssignableTo`

* Add suggestion from Michal

* Update src/coreclr/nativeaot/System.Private.DisabledReflection/src/Internal/Reflection/RuntimeTypeInfo.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* Remove whitespaces

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
2 years agoDsiable CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback on Andro...
Radek Zikmund [Wed, 15 Jun 2022 14:35:55 +0000 (16:35 +0200)]
Dsiable CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback on Android (#70768)

2 years agoUpdating HWIntrinsicInfo::lookupId to not accelerate Vector256 APIs when AVX2 is...
Tanner Gooding [Wed, 15 Jun 2022 13:30:25 +0000 (06:30 -0700)]
Updating HWIntrinsicInfo::lookupId to not accelerate Vector256 APIs when AVX2 is unsupported (#70686)

* Updating HWIntrinsicINfo::lookupId to not accelerate Vector256 APIs when AVX2 is unsupported

* Fixing a check in lookupId to properly negate the condition

* Ensure the special-cased EA_32BYTE constants only happen when AVX/AVX2 are supported

* Fixing a bad assert in morph

2 years agoSmall MsQuicStream refactorings (#70433)
Radek Zikmund [Wed, 15 Jun 2022 09:01:28 +0000 (11:01 +0200)]
Small MsQuicStream refactorings (#70433)

* Inline state transition helpers

Fixes #55437

* Add high level comments for HandleEventReceive and ReadAsync

2 years agoFix value numbering of HWI loads (#70621)
SingleAccretion [Wed, 15 Jun 2022 08:41:35 +0000 (11:41 +0300)]
Fix value numbering of HWI loads (#70621)

* Fix numbering of HWI loads

Take into account all operands and describe the exception sets precisely.

* Add a test

* Recast the check

2 years ago[NativeAOT] Enabling return address hijacking on ARM64 Windows (#70740)
Vladimir Sadov [Wed, 15 Jun 2022 05:57:42 +0000 (22:57 -0700)]
[NativeAOT] Enabling return address hijacking on ARM64 Windows (#70740)

* Enabling return address hijacking on ARM64 Windows

* pass right flags to the GcInfoDecoder

2 years agoAdd note about backward branch constraints to ECMA-335 augments (#70760)
Jan Kotas [Wed, 15 Jun 2022 03:19:07 +0000 (20:19 -0700)]
Add note about backward branch constraints to ECMA-335 augments (#70760)

2 years agoRevert "Fix usage of GSS_KRB5_CRED_NO_CI_FLAGS_X (#70447)" (#70747)
Tomas Weinfurt [Wed, 15 Jun 2022 02:32:53 +0000 (04:32 +0200)]
Revert "Fix usage of GSS_KRB5_CRED_NO_CI_FLAGS_X (#70447)" (#70747)

This reverts commit 84f7cad00ad834c365b5cd1297e1166525146b50.

2 years agoAllow `TYP_STRUCT` `LCL_FLD` on the RHS of block copies (#70633)
SingleAccretion [Wed, 15 Jun 2022 01:40:41 +0000 (04:40 +0300)]
Allow `TYP_STRUCT` `LCL_FLD` on the RHS of block copies (#70633)

* Delete the unused "GTF_USE_FLAGS"

It used to indicate that a branch operation didn't
need to materialize its operand and could just "use
flags" instead, but that purpose has long been lost
now that we have explicit SETCC nodes in lowering.

* Make GTF_DONT_EXTEND a shared flag

So that it can be used for "LCL_FLD" as well as "GT_IND".

No diffs.

* Enable TYP_STRUCT on the RHS

* fgMorphBlockOperand

* Tweak TYP_STRUCT LCL_FLD costs

Model it as two load, like OBJ.

Note we could be more precise here, by using the
register type of the layout. For now, we defer.

* Block CSE

Preserve previous behavior to avoid diffs.

2 years agoSupport `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on x86/Unix x64 (#70702)
SingleAccretion [Wed, 15 Jun 2022 01:33:45 +0000 (04:33 +0300)]
Support `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on x86/Unix x64 (#70702)

* Add GenTree::GetLayout

* x86/Unix x64: lowering

* x86/Unix x64: "genConsumePutStructArgStk"

* x86/Unix x64: "genStructPutArgUnroll"

* x86/Unix x64: codegen asserts

* x86: "genStructPutArgPush"

* Unix x64: "genStructPutArgPartialRepMovs"

2 years agoSupport `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on ARM/64 (#70256)
SingleAccretion [Wed, 15 Jun 2022 01:11:57 +0000 (04:11 +0300)]
Support `PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)` on ARM/64 (#70256)

* Separate out LowerPutArgStk

Call it from "LowerArg" instead of "ContainCheckCallOperands",
as it does more than just containment analysis.

* Support "PUTARG_STK(STRUCT LCL_VAR/LCL_FLD)" on ARM/64

To test this, transform "OBJ(LCL_VAR|FLD_ADDR)" to "LCL_FLD" on lowering.

This additionally simplified the codegen code as it doesn't have to support
two representations of the same thing.

2 years agoDo not change `gtRetClsHnd` in `impNormStructVal` (#70699)
SingleAccretion [Wed, 15 Jun 2022 00:41:43 +0000 (03:41 +0300)]
Do not change `gtRetClsHnd` in `impNormStructVal` (#70699)

* Do not change "gtRetClsHdl" in "impNormStructVal"

Doing so leads breaking the proper ABI handling for the call.

* Add a test

2 years agoRefactor how implicit byrefs are morphed (#70243)
SingleAccretion [Wed, 15 Jun 2022 00:31:54 +0000 (03:31 +0300)]
Refactor how implicit byrefs are morphed (#70243)

* Refactor implicit by-refs morphing

Move it to "fgMorphLocal".

Enabled folding in "LocalAddressVisitor".

* Add FEATURE_IMPLICIT_BYREFS

And use it in all the necessary places.

Resolves the TP regression on Unix x64, turning it into a TP improvement.

* Add a zero-diff quirk

2 years agoHandle mis-sized structs in ARM/64 `PUTARG_SPLIT` codegen (#70249)
SingleAccretion [Wed, 15 Jun 2022 00:09:49 +0000 (03:09 +0300)]
Handle mis-sized structs in ARM/64 `PUTARG_SPLIT` codegen (#70249)

* Add a test

* Fix out-of-bounds loads in ARM/64's "genPutArgSplit"

* Split the test out

2 years agoFix AttributePresence in composite mode (#70737)
Tomáš Rylek [Wed, 15 Jun 2022 00:07:05 +0000 (02:07 +0200)]
Fix AttributePresence in composite mode (#70737)

According to my comparative perf measurements composite framework
spends about 5M more instructions in the method

coreclr.dll!CMiniMdTemplate<CMiniMd>::SearchTableForMultipleRows(CMiniColDef sColumn)

I tracked this down to the R2R table AttributePresence which is
used to speed up attribute queries against the ECMA metadata model.
In composite mode we were putting the table in the image header,
not component header, and so the runtime was unable to locate it.
This change fixes generation of the table in Crossgen2; I have
verified that with this change I no longer see the 5M outlier.

Thanks

Tomas