platform/upstream/dotnet/runtime.git
15 months agoUpdate version of MSDia and default to using shipped versions (#87782)
Juan Hoyos [Tue, 20 Jun 2023 09:17:03 +0000 (02:17 -0700)]
Update version of MSDia and default to using shipped versions (#87782)

15 months agoInvoke `where` with `/Q` when looking for tools (#87803)
Michal Strehovský [Tue, 20 Jun 2023 08:28:25 +0000 (17:28 +0900)]
Invoke `where` with `/Q` when looking for tools (#87803)

Avoids printing `INFO: Could not find files for the given pattern(s).` to build output.

15 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 220513...
dotnet bot [Tue, 20 Jun 2023 07:02:45 +0000 (09:02 +0200)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2205134 (#87788)

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2204780

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2204780

15 months ago[mono][mini] Fix conversion from r4/r8 to native u (#85964)
Vlad Brezae [Tue, 20 Jun 2023 06:08:35 +0000 (09:08 +0300)]
[mono][mini] Fix conversion from r4/r8 to native u (#85964)

* [mono][mini] Fix conversion from r4/r8 to native u

When converting from float point to unsigned integer, we always do a conversion to u8, then do a simple integer conversion with range checks. The problem is that the first conversion to u8 pushes a STACK_I8 and doing a further conversion to u8 is not actually a nop since it will throw if the result of the previous conversion is negative.

* Enable tests

* [mono][jit] Reuse conv ovf methods used by interpreter

These follow CoreCLR implementation and don't rely on undefined behavior from out of range conversions.

15 months agoFix outerloop CI error (#87789)
David Wrighton [Tue, 20 Jun 2023 03:32:08 +0000 (20:32 -0700)]
Fix outerloop CI error (#87789)

* Fix issue where type validation checker failed to instantiate signature before performing signature comparison

15 months agoAdd missing Free methods for our Com interface marshallers. (#87777)
Jeremy Koritzinsky [Tue, 20 Jun 2023 03:18:18 +0000 (20:18 -0700)]
Add missing Free methods for our Com interface marshallers. (#87777)

15 months agoAdd DebuggerDisplay to Logger and Logger<T> (#87754)
James Newton-King [Tue, 20 Jun 2023 03:16:01 +0000 (11:16 +0800)]
Add DebuggerDisplay to Logger and Logger<T> (#87754)

15 months agoEnsure that the various Min and Max APIs are accelerated where possible (#87641)
Tanner Gooding [Tue, 20 Jun 2023 00:55:56 +0000 (17:55 -0700)]
Ensure that the various Min and Max APIs are accelerated where possible (#87641)

* Updating Math.Max and Math.Min to utilize AVX512 when available

* Ensure that Single/Double APIs can be directly handled as intrinsic

* Ensure that the various Min and Max APIs are accelerated where possible

* Don't include ILogB for the time being

* Ensure FixupScalar is passed all 4 parameters

* Apply suggestions from code review

15 months ago[mono][aot] Fix an assertion. (#87692)
Zoltan Varga [Tue, 20 Jun 2023 00:41:17 +0000 (20:41 -0400)]
[mono][aot] Fix an assertion. (#87692)

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

15 months agoMake idSmallCns signed to allow including -1 (#87373)
Tanner Gooding [Tue, 20 Jun 2023 00:19:59 +0000 (17:19 -0700)]
Make idSmallCns signed to allow including -1 (#87373)

* Make idSmallCns signed on xarch

* Ensure EMITTER_STATS are correctly tracked

* Use signed _idSmallCns on other platforms as well

* Have EMITTER_STATS track additional information about constants

* Also track whether the constant fits into 8, 16, or 32-bits

* Fix the formatting/ordering of the EMITTER_STATS header

* Ensure the EMITTER_STATS header covers all the instrDesc types

* Ensure that instrDesc counts are all being tracked by EMITTER_STATS

* Apply suggestions from code review

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
---------

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
15 months agofix mono HelloWorld sample (#87778)
Aleksey Kliger (λgeek) [Mon, 19 Jun 2023 23:51:49 +0000 (19:51 -0400)]
fix mono HelloWorld sample (#87778)

* fix mono HelloWorld sample

Set SelfContained=true.  Otherwise we get this when trying to run the
app:

```
./artifacts/bin/H
elloWorld/arm64/Release/osx-arm64/publish/HelloWorld
You must install or update .NET to run this application.

App: /Users/alklig/work/dotnet-runtime/runtime-review/artifacts/bin/HelloWorld/arm64/Release/osx-arm64/publish/HelloWorld
```

* fix samples

15 months agoUpdate generators.targets (#87784)
Viktor Hofer [Mon, 19 Jun 2023 21:56:20 +0000 (23:56 +0200)]
Update generators.targets (#87784)

15 months agoExpose AVX512 Compare and BlendVariable APIs (#87404)
Tanner Gooding [Mon, 19 Jun 2023 21:55:20 +0000 (14:55 -0700)]
Expose AVX512 Compare and BlendVariable APIs (#87404)

* Expose AVX512 Compare APIs

* Expose AVX512 Compare Tests

* Ensure AVX512 Compare are supported by the JIT

* Expose AVX512 BlendVariable APIs

* Expose AVX512 BlendVariable Tests

* Ensure AVX512 BlendVariable is supported by the JIT

* Apply formatting patch

* Ensure the register is sign-extended for vblendvps

15 months agoUse pairwise load in `WidenAsciiToUtf16` (#87737)
xtqqczze [Mon, 19 Jun 2023 21:43:38 +0000 (22:43 +0100)]
Use pairwise load in `WidenAsciiToUtf16` (#87737)

15 months agoUnconditionally suppress IL2026 for StartupHookProvider.CallStartupHook (#87779)
Justin Anderson [Mon, 19 Jun 2023 21:36:58 +0000 (14:36 -0700)]
Unconditionally suppress IL2026 for StartupHookProvider.CallStartupHook (#87779)

15 months agoUse analyzers from targeting pack for NetCoreAppCurrent (#87726)
Viktor Hofer [Mon, 19 Jun 2023 21:27:38 +0000 (23:27 +0200)]
Use analyzers from targeting pack for NetCoreAppCurrent (#87726)

* Use analyzers from targeting pack for NetCoreAppCurrent

Fixes that analyzer failures didn't show-up in #74897

Add analyzers to the frameworklist that OOB projects in src/libraries
use, and only auto ProjectReference the analyzers in generators.targets
when not using the analyzers from the targeting pack.

Also move the generator projects related code into a separate file.

Continuation of https://github.com/dotnet/runtime/pull/75093

* Fix project build

* Add missing reference to Regex tests

* Add missing generators for netfx build

* Fix paht in test project

* Fix typo

* Disable runtime marshalling for SharedTypes.csproj

* Disable runtime marshalling for NativeExports.csproj

15 months ago[PERF] Fix crossgen zip missing error (#87662)
Parker Bibus [Mon, 19 Jun 2023 21:09:15 +0000 (14:09 -0700)]
[PERF] Fix crossgen zip missing error (#87662)

Only run ArchiveFiles for runKinds that use it.

15 months agoFixed System.Tests.DateTimeTests.TryFormat_MatchesToString test (#87693)
Alexander Radchenko [Mon, 19 Jun 2023 21:05:54 +0000 (03:05 +0600)]
Fixed System.Tests.DateTimeTests.TryFormat_MatchesToString test (#87693)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
15 months agoJIT: Cache significant segments computations for layouts in physical promotion (...
Jakob Botsch Nielsen [Mon, 19 Jun 2023 20:30:19 +0000 (22:30 +0200)]
JIT: Cache significant segments computations for layouts in physical promotion (#87745)

Before:
JitEnablePhysicalPromotion=1
benchmarks.run_pgo:
Total num SignificantSegments calls: 2543
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>     312 count ( 37% of total)
      2 ..       2 ===>      58 count ( 44% of total)
      3 ..       3 ===>     181 count ( 66% of total)
      4 ..       5 ===>     191 count ( 90% of total)
      6 ..      10 ===>      66 count ( 98% of total)
     11 ..      20 ===>      12 count ( 99% of total)
     21 ..      35 ===>       4 count (100% of total)
     36 ..      50 ===>       0 count (100% of total)
     51 ..      75 ===>       0 count (100% of total)
     76 ..     100 ===>       0 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     250 ===>       0 count (100% of total)
    251 ..     500 ===>       0 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

libraries.pmi:
Total num SignificantSegments calls: 28525
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>    1154 count ( 19% of total)
      2 ..       2 ===>    1878 count ( 50% of total)
      3 ..       3 ===>     809 count ( 64% of total)
      4 ..       5 ===>     782 count ( 77% of total)
      6 ..      10 ===>     831 count ( 91% of total)
     11 ..      20 ===>     357 count ( 97% of total)
     21 ..      35 ===>     101 count ( 98% of total)
     36 ..      50 ===>      29 count ( 99% of total)
     51 ..      75 ===>      29 count ( 99% of total)
     76 ..     100 ===>       8 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     250 ===>       0 count (100% of total)
    251 ..     500 ===>       0 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

JitEnablePhysicalPromotion=1;JitStressModeNames=STRESS_NO_OLD_PROMOTION
benchmarks.run_pgo:
Total num SignificantSegments calls: 90839
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>     681 count (  7% of total)
      2 ..       2 ===>    1035 count ( 17% of total)
      3 ..       3 ===>    1635 count ( 34% of total)
      4 ..       5 ===>    1053 count ( 45% of total)
      6 ..      10 ===>    3162 count ( 78% of total)
     11 ..      20 ===>     814 count ( 87% of total)
     21 ..      35 ===>     931 count ( 96% of total)
     36 ..      50 ===>     215 count ( 99% of total)
     51 ..      75 ===>      69 count ( 99% of total)
     76 ..     100 ===>       4 count ( 99% of total)
    101 ..     150 ===>       4 count ( 99% of total)
    151 ..     250 ===>       0 count ( 99% of total)
    251 ..     500 ===>      11 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

libraries.pmi:
Total num SignificantSegments calls: 277708
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>    6993 count ( 17% of total)
      2 ..       2 ===>    8197 count ( 38% of total)
      3 ..       3 ===>    5225 count ( 51% of total)
      4 ..       5 ===>    5380 count ( 65% of total)
      6 ..      10 ===>    7141 count ( 83% of total)
     11 ..      20 ===>    4094 count ( 93% of total)
     21 ..      35 ===>    1627 count ( 97% of total)
     36 ..      50 ===>     519 count ( 98% of total)
     51 ..      75 ===>     292 count ( 99% of total)
     76 ..     100 ===>      98 count ( 99% of total)
    101 ..     150 ===>      59 count ( 99% of total)
    151 ..     250 ===>      11 count ( 99% of total)
    251 ..     500 ===>       4 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

After:
benchmarks.run_pgo:
Total num SignificantSegments calls: 915
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>     741 count ( 89% of total)
      2 ..       2 ===>      75 count ( 99% of total)
      3 ..       3 ===>       8 count (100% of total)
      4 ..       5 ===>       0 count (100% of total)
      6 ..      10 ===>       0 count (100% of total)
     11 ..      20 ===>       0 count (100% of total)
     21 ..      35 ===>       0 count (100% of total)
     36 ..      50 ===>       0 count (100% of total)
     51 ..      75 ===>       0 count (100% of total)
     76 ..     100 ===>       0 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     250 ===>       0 count (100% of total)
    251 ..     500 ===>       0 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

libraries.pmi:
Total num SignificantSegments calls: 9061
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>    4172 count ( 69% of total)
      2 ..       2 ===>    1105 count ( 88% of total)
      3 ..       3 ===>     416 count ( 95% of total)
      4 ..       5 ===>     214 count ( 98% of total)
      6 ..      10 ===>      67 count ( 99% of total)
     11 ..      20 ===>       3 count ( 99% of total)
     21 ..      35 ===>       1 count (100% of total)
     36 ..      50 ===>       0 count (100% of total)
     51 ..      75 ===>       0 count (100% of total)
     76 ..     100 ===>       0 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     250 ===>       0 count (100% of total)
    251 ..     500 ===>       0 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

JitEnablePhysicalPromotion=1;JitStressModeNames=STRESS_NO_OLD_PROMOTION
benchmarks.run_pgo:
Total num SignificantSegments calls: 15082
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>    6709 count ( 69% of total)
      2 ..       2 ===>    1735 count ( 87% of total)
      3 ..       3 ===>     462 count ( 92% of total)
      4 ..       5 ===>     471 count ( 97% of total)
      6 ..      10 ===>     237 count (100% of total)
     11 ..      20 ===>       0 count (100% of total)
     21 ..      35 ===>       0 count (100% of total)
     36 ..      50 ===>       0 count (100% of total)
     51 ..      75 ===>       0 count (100% of total)
     76 ..     100 ===>       0 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     250 ===>       0 count (100% of total)
    251 ..     500 ===>       0 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

libraries.pmi:
Total uncached SignificantSegments calls: 68938
(Per context) SignificantSegments calls
     <=          0 ===>       0 count (  0% of total)
      1 ..       1 ===>   24323 count ( 61% of total)
      2 ..       2 ===>    8687 count ( 83% of total)
      3 ..       3 ===>    3357 count ( 91% of total)
      4 ..       5 ===>    2378 count ( 97% of total)
      6 ..      10 ===>     789 count ( 99% of total)
     11 ..      20 ===>     105 count ( 99% of total)
     21 ..      35 ===>       1 count (100% of total)
     36 ..      50 ===>       0 count (100% of total)
     51 ..      75 ===>       0 count (100% of total)
     76 ..     100 ===>       0 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     250 ===>       0 count (100% of total)
    251 ..     500 ===>       0 count (100% of total)
    501 ..    1000 ===>       0 count (100% of total)

15 months agoJIT: Fix LocalUses::FindAccess (#87732)
Jakob Botsch Nielsen [Mon, 19 Jun 2023 20:29:54 +0000 (22:29 +0200)]
JIT: Fix LocalUses::FindAccess (#87732)

The function is looking for access information with a specified type at
a specified offset, but was using the wrong list here. That would in
some cases with overlapping accesses cause us to fail to find the
Access. The net result is that we rarely end up not promoting some
induced accesses that we would otherwise promote.

15 months agoEnable GDV with multiple guesses for NativeAOT (#87380)
Egor Bogatov [Mon, 19 Jun 2023 20:17:24 +0000 (22:17 +0200)]
Enable GDV with multiple guesses for NativeAOT (#87380)

15 months agoRevert "Upgrade ios perf queue to osx 13 (#86574)" (#87780)
Milos Kotlar [Mon, 19 Jun 2023 20:09:39 +0000 (22:09 +0200)]
Revert "Upgrade ios perf queue to osx 13 (#86574)" (#87780)

This reverts commit da712842c32eeb34a97d7d2db927a22b4981ecfb.

15 months agoadd zero byte read to SslStream (#87563)
Tomas Weinfurt [Mon, 19 Jun 2023 18:37:24 +0000 (20:37 +0200)]
add zero byte read to SslStream (#87563)

* add zero byte read to SslStream

* fix test

* Apply suggestions from code review

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

* add back missing line

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
15 months agoMake sure that intellisense files are copied (#87603)
Viktor Hofer [Mon, 19 Jun 2023 17:31:33 +0000 (19:31 +0200)]
Make sure that intellisense files are copied (#87603)

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

When looking at the 8.0 Preview 5 SDK, xml files are missing for certain
assemblies. This is likely because of the TargetFramework condition in
intellisense.targets. Instead of conditioning on the rid-less net8.0
TFM, use the sfx.proj which already assemblies the shared framework and
targeting pack layout to copy the documentation files.

Additionally, remove the XmlDocDir and copy the files into the targeting
pack folder which was a difference between the "real" targeting pack and
the "fake" one that libraries generates.

15 months agoLSRA-throughput: Iterate over the regMaskTP instead all registers (#87424)
Kunal Pathak [Mon, 19 Jun 2023 16:40:16 +0000 (09:40 -0700)]
LSRA-throughput: Iterate over the regMaskTP instead all registers (#87424)

* replace for-loop with regMaspTP iterator

* jit format

* REVERT

* fix a bug

* address review feedback

* Add genFirstRegNumFromMaskAndToggle and genFirstRegNumFromMask

* Use actualRegistersMask

* jit format

* review feedback

* Inline BitScanForward

* fix build error

* remove commented code

15 months agoJIT: Add some limits in physical promotion (#87729)
Jakob Botsch Nielsen [Mon, 19 Jun 2023 16:20:58 +0000 (18:20 +0200)]
JIT: Add some limits in physical promotion (#87729)

Add limits on how many fields we promote in each struct and how many
total fields we promote. These limits are put in place to avoid
pathological cases; we do not hit any of them over all of our SPMI
collections (at least on win-x64).

The limits were selected based on histograms of physical promotion stats
over our collections. Here they are for some of the important
collections:

JitEnablePhysicalPromotion=1:
benchmarks.run_pgo:

```
(Per context) How many fields are promoted:
     <=          0 ===>    1654 count ( 66% of total)
      1 ..       1 ===>     206 count ( 75% of total)
      2 ..       2 ===>     259 count ( 85% of total)
      3 ..       3 ===>     127 count ( 90% of total)
      4 ..       4 ===>      46 count ( 92% of total)
      5 ..       5 ===>      30 count ( 93% of total)
      6 ..      10 ===>      99 count ( 97% of total)
     11 ..      15 ===>      17 count ( 98% of total)
     16 ..      20 ===>      21 count ( 99% of total)
     21 ..      30 ===>      16 count ( 99% of total)
     31 ..      40 ===>       3 count (100% of total)
     41 ..      50 ===>       0 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     200 ===>       0 count (100% of total)
    201 ..     300 ===>       0 count (100% of total)
    301 ..     400 ===>       0 count (100% of total)
    401 ..     500 ===>       0 count (100% of total)
    501 ..     700 ===>       0 count (100% of total)
    701 ..    1000 ===>       0 count (100% of total)
   1001 ..    2000 ===>       0 count (100% of total)
   2001 ..    3000 ===>       0 count (100% of total)
   3001 ..    4000 ===>       0 count (100% of total)
   4001 ..    5000 ===>       0 count (100% of total)

(Per struct) How many fields are promoted:
     <=          0 ===>     980 count ( 39% of total)
      1 ..       1 ===>     760 count ( 69% of total)
      2 ..       2 ===>     423 count ( 86% of total)
      3 ..       3 ===>      73 count ( 89% of total)
      4 ..       4 ===>      30 count ( 90% of total)
      5 ..       5 ===>      46 count ( 92% of total)
      6 ..       6 ===>     181 count ( 99% of total)
      7 ..       8 ===>       2 count (100% of total)
      9 ..      10 ===>       0 count (100% of total)
     11 ..      15 ===>       0 count (100% of total)
     16 ..      20 ===>       0 count (100% of total)
     21 ..      30 ===>       0 count (100% of total)
     31 ..      50 ===>       0 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     200 ===>       0 count (100% of total)
    201 ..     400 ===>       0 count (100% of total)
```

libraries.pmi:

```
(Per context) How many fields are promoted:
     <=          0 ===>   19677 count ( 76% of total)
      1 ..       1 ===>    1717 count ( 83% of total)
      2 ..       2 ===>     899 count ( 86% of total)
      3 ..       3 ===>     616 count ( 89% of total)
      4 ..       4 ===>     660 count ( 91% of total)
      5 ..       5 ===>     285 count ( 92% of total)
      6 ..      10 ===>     932 count ( 96% of total)
     11 ..      15 ===>     377 count ( 98% of total)
     16 ..      20 ===>     164 count ( 98% of total)
     21 ..      30 ===>     165 count ( 99% of total)
     31 ..      40 ===>      68 count ( 99% of total)
     41 ..      50 ===>      28 count ( 99% of total)
     51 ..     100 ===>      51 count ( 99% of total)
    101 ..     150 ===>      14 count ( 99% of total)
    151 ..     200 ===>       2 count ( 99% of total)
    201 ..     300 ===>       0 count ( 99% of total)
    301 ..     400 ===>       1 count (100% of total)
    401 ..     500 ===>       0 count (100% of total)
    501 ..     700 ===>       0 count (100% of total)
    701 ..    1000 ===>       0 count (100% of total)
   1001 ..    2000 ===>       0 count (100% of total)
   2001 ..    3000 ===>       0 count (100% of total)
   3001 ..    4000 ===>       0 count (100% of total)
   4001 ..    5000 ===>       0 count (100% of total)

(Per struct) How many fields are promoted:
     <=          0 ===>    6218 count ( 31% of total)
      1 ..       1 ===>    5075 count ( 57% of total)
      2 ..       2 ===>    1440 count ( 65% of total)
      3 ..       3 ===>    1859 count ( 74% of total)
      4 ..       4 ===>    2682 count ( 88% of total)
      5 ..       5 ===>     974 count ( 93% of total)
      6 ..       6 ===>     624 count ( 96% of total)
      7 ..       8 ===>     533 count ( 99% of total)
      9 ..      10 ===>      37 count ( 99% of total)
     11 ..      15 ===>      65 count ( 99% of total)
     16 ..      20 ===>       2 count ( 99% of total)
     21 ..      30 ===>       0 count ( 99% of total)
     31 ..      50 ===>       1 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     200 ===>       0 count (100% of total)
    201 ..     400 ===>       0 count (100% of total)
```

realworld:

```
(Per context) How many fields are promoted:
     <=          0 ===>    1807 count ( 54% of total)
      1 ..       1 ===>     407 count ( 66% of total)
      2 ..       2 ===>     230 count ( 73% of total)
      3 ..       3 ===>     146 count ( 77% of total)
      4 ..       4 ===>     122 count ( 81% of total)
      5 ..       5 ===>      86 count ( 83% of total)
      6 ..      10 ===>     218 count ( 90% of total)
     11 ..      15 ===>     147 count ( 94% of total)
     16 ..      20 ===>      59 count ( 96% of total)
     21 ..      30 ===>      66 count ( 98% of total)
     31 ..      40 ===>      19 count ( 98% of total)
     41 ..      50 ===>      12 count ( 99% of total)
     51 ..     100 ===>      14 count ( 99% of total)
    101 ..     150 ===>       3 count ( 99% of total)
    151 ..     200 ===>       2 count ( 99% of total)
    201 ..     300 ===>       4 count ( 99% of total)
    301 ..     400 ===>       0 count ( 99% of total)
    401 ..     500 ===>       0 count ( 99% of total)
    501 ..     700 ===>       2 count (100% of total)
    701 ..    1000 ===>       0 count (100% of total)
   1001 ..    2000 ===>       0 count (100% of total)
   2001 ..    3000 ===>       0 count (100% of total)
   3001 ..    4000 ===>       0 count (100% of total)
   4001 ..    5000 ===>       0 count (100% of total)

(Per struct) How many fields are promoted:
     <=          0 ===>    2012 count ( 32% of total)
      1 ..       1 ===>    1421 count ( 55% of total)
      2 ..       2 ===>     499 count ( 63% of total)
      3 ..       3 ===>     521 count ( 71% of total)
      4 ..       4 ===>     565 count ( 80% of total)
      5 ..       5 ===>     446 count ( 87% of total)
      6 ..       6 ===>     503 count ( 96% of total)
      7 ..       8 ===>     139 count ( 98% of total)
      9 ..      10 ===>      71 count ( 99% of total)
     11 ..      15 ===>      34 count ( 99% of total)
     16 ..      20 ===>       3 count (100% of total)
     21 ..      30 ===>       0 count (100% of total)
     31 ..      50 ===>       0 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     200 ===>       0 count (100% of total)
    201 ..     400 ===>       0 count (100% of total)
```

JitEnablePhysicalPromotion=1;JitStressModeNames=STRESS_NO_OLD_PROMOTION:
benchmarks.run_pgo:

```
(Per context) How many fields are promoted:
     <=          0 ===>    1654 count ( 66% of total)
      1 ..       1 ===>     206 count ( 75% of total)
      2 ..       2 ===>     259 count ( 85% of total)
      3 ..       3 ===>     127 count ( 90% of total)
      4 ..       4 ===>      46 count ( 92% of total)
      5 ..       5 ===>      30 count ( 93% of total)
      6 ..      10 ===>      99 count ( 97% of total)
     11 ..      15 ===>      17 count ( 98% of total)
     16 ..      20 ===>      21 count ( 99% of total)
     21 ..      30 ===>      16 count ( 99% of total)
     31 ..      40 ===>       3 count (100% of total)
     41 ..      50 ===>       0 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     150 ===>       0 count (100% of total)
    151 ..     200 ===>       0 count (100% of total)
    201 ..     300 ===>       0 count (100% of total)
    301 ..     400 ===>       0 count (100% of total)
    401 ..     500 ===>       0 count (100% of total)
    501 ..     700 ===>       0 count (100% of total)
    701 ..    1000 ===>       0 count (100% of total)
   1001 ..    2000 ===>       0 count (100% of total)
   2001 ..    3000 ===>       0 count (100% of total)
   3001 ..    4000 ===>       0 count (100% of total)
   4001 ..    5000 ===>       0 count (100% of total)

(Per struct) How many fields are promoted:
     <=          0 ===>     980 count ( 39% of total)
      1 ..       1 ===>     760 count ( 69% of total)
      2 ..       2 ===>     423 count ( 86% of total)
      3 ..       3 ===>      73 count ( 89% of total)
      4 ..       4 ===>      30 count ( 90% of total)
      5 ..       5 ===>      46 count ( 92% of total)
      6 ..       6 ===>     181 count ( 99% of total)
      7 ..       8 ===>       2 count (100% of total)
      9 ..      10 ===>       0 count (100% of total)
     11 ..      15 ===>       0 count (100% of total)
     16 ..      20 ===>       0 count (100% of total)
     21 ..      30 ===>       0 count (100% of total)
     31 ..      50 ===>       0 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     200 ===>       0 count (100% of total)
    201 ..     400 ===>       0 count (100% of total)
```

libraries.pmi:
```
(Per context) How many fields are promoted:
     <=          0 ===>   37477 count ( 48% of total)
      1 ..       1 ===>    7987 count ( 58% of total)
      2 ..       2 ===>    7292 count ( 68% of total)
      3 ..       3 ===>    2988 count ( 72% of total)
      4 ..       4 ===>    4927 count ( 78% of total)
      5 ..       5 ===>    1835 count ( 81% of total)
      6 ..      10 ===>    7147 count ( 90% of total)
     11 ..      15 ===>    2694 count ( 93% of total)
     16 ..      20 ===>    1667 count ( 95% of total)
     21 ..      30 ===>    1346 count ( 97% of total)
     31 ..      40 ===>     758 count ( 98% of total)
     41 ..      50 ===>     335 count ( 99% of total)
     51 ..     100 ===>     510 count ( 99% of total)
    101 ..     150 ===>     107 count ( 99% of total)
    151 ..     200 ===>      34 count ( 99% of total)
    201 ..     300 ===>      12 count ( 99% of total)
    301 ..     400 ===>       2 count ( 99% of total)
    401 ..     500 ===>       2 count (100% of total)
    501 ..     700 ===>       0 count (100% of total)
    701 ..    1000 ===>       0 count (100% of total)
   1001 ..    2000 ===>       0 count (100% of total)
   2001 ..    3000 ===>       0 count (100% of total)
   3001 ..    4000 ===>       0 count (100% of total)
   4001 ..    5000 ===>       0 count (100% of total)

(Per struct) How many fields are promoted:
     <=          0 ===>  102669 count ( 39% of total)
      1 ..       1 ===>   57467 count ( 61% of total)
      2 ..       2 ===>   69010 count ( 88% of total)
      3 ..       3 ===>   11494 count ( 92% of total)
      4 ..       4 ===>   16887 count ( 99% of total)
      5 ..       5 ===>    1043 count ( 99% of total)
      6 ..       6 ===>     618 count ( 99% of total)
      7 ..       8 ===>     579 count ( 99% of total)
      9 ..      10 ===>      57 count ( 99% of total)
     11 ..      15 ===>      71 count ( 99% of total)
     16 ..      20 ===>       5 count ( 99% of total)
     21 ..      30 ===>       0 count ( 99% of total)
     31 ..      50 ===>       1 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     200 ===>       0 count (100% of total)
    201 ..     400 ===>       0 count (100% of total)
```

realworld:
```
(Per context) How many fields are promoted:
     <=          0 ===>    5617 count ( 41% of total)
      1 ..       1 ===>    1657 count ( 53% of total)
      2 ..       2 ===>    1164 count ( 62% of total)
      3 ..       3 ===>     522 count ( 66% of total)
      4 ..       4 ===>     878 count ( 72% of total)
      5 ..       5 ===>     472 count ( 76% of total)
      6 ..      10 ===>    1383 count ( 86% of total)
     11 ..      15 ===>     619 count ( 91% of total)
     16 ..      20 ===>     335 count ( 93% of total)
     21 ..      30 ===>     361 count ( 96% of total)
     31 ..      40 ===>     165 count ( 97% of total)
     41 ..      50 ===>     101 count ( 98% of total)
     51 ..     100 ===>     177 count ( 99% of total)
    101 ..     150 ===>      38 count ( 99% of total)
    151 ..     200 ===>      18 count ( 99% of total)
    201 ..     300 ===>      12 count ( 99% of total)
    301 ..     400 ===>       1 count ( 99% of total)
    401 ..     500 ===>       1 count ( 99% of total)
    501 ..     700 ===>       2 count (100% of total)
    701 ..    1000 ===>       0 count (100% of total)
   1001 ..    2000 ===>       0 count (100% of total)
   2001 ..    3000 ===>       0 count (100% of total)
   3001 ..    4000 ===>       0 count (100% of total)
   4001 ..    5000 ===>       0 count (100% of total)

(Per struct) How many fields are promoted:
     <=          0 ===>   23630 count ( 37% of total)
      1 ..       1 ===>   13267 count ( 59% of total)
      2 ..       2 ===>   16731 count ( 86% of total)
      3 ..       3 ===>    4677 count ( 93% of total)
      4 ..       4 ===>    2727 count ( 97% of total)
      5 ..       5 ===>     492 count ( 98% of total)
      6 ..       6 ===>     496 count ( 99% of total)
      7 ..       8 ===>     150 count ( 99% of total)
      9 ..      10 ===>      92 count ( 99% of total)
     11 ..      15 ===>      41 count ( 99% of total)
     16 ..      20 ===>       3 count ( 99% of total)
     21 ..      30 ===>       3 count ( 99% of total)
     31 ..      50 ===>       3 count (100% of total)
     51 ..     100 ===>       0 count (100% of total)
    101 ..     200 ===>       0 count (100% of total)
    201 ..     400 ===>       0 count (100% of total)
```

15 months agoFix ParseQuoteString handling of non-ASCII chars (#87756)
Stephen Toub [Mon, 19 Jun 2023 16:00:01 +0000 (12:00 -0400)]
Fix ParseQuoteString handling of non-ASCII chars (#87756)

15 months agoadd review comment to sb files (#87003)
Oleksandr Didyk [Mon, 19 Jun 2023 14:42:29 +0000 (16:42 +0200)]
add review comment to sb files (#87003)

15 months ago[wasm] Add helix retries for debugger tests (#87565)
Ankit Jain [Mon, 19 Jun 2023 14:22:41 +0000 (10:22 -0400)]
[wasm] Add helix retries for debugger tests (#87565)

.. when chrome fails to launch. For example:

```
  Error Message:
   System.IO.IOException : Process for /root/helix/work/correlation/chrome-linux/chrome unexpectedly exited with 127 during startup.
  Stack Trace:
     at DebuggerTests.WasmHostProvider.LaunchHostAsync(ProcessStartInfo psi, HttpContext context, Func`2 checkBrowserReady, String messagePrefix, Int32 hostReadyTimeoutMs, CancellationToken token) in /_/src/mono/wasm/debugger/DebuggerTestSuite/WasmHostProvider.cs:line 77
   at DebuggerTests.ChromeProvider.StartBrowserAndProxyAsync(HttpContext context, String targetUrl, Int32 remoteDebuggingPort, String messagePrefix, ILoggerFactory loggerFactory, CancellationTokenSource cts, Int32 browserReadyTimeoutMs, String locale) in /_/src/mono/wasm/debugger/DebuggerTestSuite/ChromeProvider.cs:line 60
   at DebuggerTests.TestHarnessStartup.<>c__DisplayClass13_0.<<Configure>b__2>d.MoveNext() in /_/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessStartup.cs:line 143
--- End of stack trace from previous location ---
   at DebuggerTests.Inspector.OpenSessionAsync(Func`3 getInitCmds, String urlToInspect, TimeSpan span) in /_/src/mono/wasm/debugger/DebuggerTestSuite/Inspector.cs:line 414
   at DebuggerTests.DebuggerTestBase.InitializeAsync() in /_/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs:line 173
```

15 months ago[wasm] Add more load PackedSimd methods (#87403)
Radek Doulik [Mon, 19 Jun 2023 13:02:34 +0000 (15:02 +0200)]
[wasm] Add more load PackedSimd methods (#87403)

* [wasm] Add more load PackedSimd methods

* Add custom attributes to PlatformNotSupported version

* Add default cases

15 months agoJIT: Insert writebacks in proper post-order location (#87612)
Jakob Botsch Nielsen [Mon, 19 Jun 2023 12:59:22 +0000 (14:59 +0200)]
JIT: Insert writebacks in proper post-order location (#87612)

For struct uses we need to take care to insert any necessary writeback
when we see the local in post-order. The existing approach waits until
it sees the GT_RETURN or GT_CALL node to create writebacks for the
operand, which can cause us to create a writeback that overlaps
improperly with a previous LCL_VAR. For example:

```
Processing use [000014] of V00.[002..004)
STMT00008 ( 0x023[E-] ... ??? )
               [000025] --CXG------                         ▌  CALL      byref  Program:M1(S0,short):byref
               [000023] ----------- arg0                    ├──▌  LCL_VAR   struct<S0, 12> V00 loc0
               [000021] --CXG------ arg1                    └──▌  CAST      int <- short <- int
               [000020] --CXG------                            └──▌  IND       int
               [000018] --CXG------                               └──▌  CALL      byref  Program:M1(S0,short):byref
               [000016] ----------- arg0                             ├──▌  LCL_VAR   struct<S0, 12> V00 loc0
               [000017] ----------- arg1                             └──▌  LCL_VAR   int    V01 loc1          (last use)
New statement:
STMT00008 ( 0x023[E-] ... ??? )
               [000025] -ACXG------                         ▌  CALL      byref  Program:M1(S0,short):byref
               [000023] ----------- arg0                    ├──▌  LCL_VAR   struct<S0, 12> V00 loc0
               [000021] -ACXG------ arg1                    └──▌  CAST      int <- short <- int
               [000020] -ACXG------                            └──▌  IND       int
               [000018] -ACXG------                               └──▌  CALL      byref  Program:M1(S0,short):byref
               [000089] -A--------- arg0                             ├──▌  COMMA     struct
               [000088] UA---------                                  │  ├──▌  STORE_LCL_FLD ushort V00 loc0         [+0]
               [000087] -----------                                  │  │  └──▌  LCL_VAR   int    V09 tmp6
               [000016] -----------                                  │  └──▌  LCL_VAR   struct<S0, 12> V00 loc0          (last use)
               [000017] ----------- arg1                             └──▌  LCL_VAR   int    V01 loc1          (last use)
```

The writeback `[000088]` should have been created before `[000023]`.

This change fixes the problem by moving the writeback logic into
ReplaceLocal. To properly handle commas we need to keep track of the
ancestor stack now.

Fix #87611

15 months ago[mono] Add conditional substitution for IsDynamicCodeSupported when targeting ios...
Ivan Povazan [Mon, 19 Jun 2023 12:08:10 +0000 (14:08 +0200)]
[mono] Add conditional substitution for IsDynamicCodeSupported when targeting ios-like platforms (#86971)

15 months ago[wasm][debugger] Showing "Frame not in module" after vscode-js-debug bump on VS ...
Thays Grazia [Mon, 19 Jun 2023 10:28:05 +0000 (07:28 -0300)]
[wasm][debugger] Showing "Frame not in module" after vscode-js-debug bump on VS (#87154)

* We were sending the scriptId of a context that was already destroyed and vscode-js-debug extension started to consider this information that was ignored before.

* addressing @radical comments

15 months agoUse local variable to evaluate property value only once in JsonSourceGenerator (...
etemi [Mon, 19 Jun 2023 10:19:33 +0000 (12:19 +0200)]
Use local variable to evaluate property value only once in JsonSourceGenerator (#87725)

* Use temporary variable to evaluate property value only once

* Add test

15 months agoUpgrade ios perf queue to osx 13 (#86574)
Milos Kotlar [Mon, 19 Jun 2023 10:05:25 +0000 (12:05 +0200)]
Upgrade ios perf queue to osx 13 (#86574)

15 months ago[browser] make cwraps more conditional (#87274)
Pavel Savara [Mon, 19 Jun 2023 09:26:35 +0000 (11:26 +0200)]
[browser] make cwraps more conditional (#87274)

15 months ago[mono][ios] Add support for stripping during AOT compilation on iOS (#87728)
Milos Kotlar [Mon, 19 Jun 2023 09:09:41 +0000 (11:09 +0200)]
[mono][ios] Add support for stripping during AOT compilation on iOS (#87728)

* Add support for stripping debug symbols and enabling IL stripping during AOT compilation on iOS

15 months agoChange JitGuardedDevirtualizationChainStatements to 1 (#87437)
Egor Bogatov [Mon, 19 Jun 2023 07:51:06 +0000 (09:51 +0200)]
Change JitGuardedDevirtualizationChainStatements to 1 (#87437)

15 months agoGDV: don't emit fallback call if classes are "exact" (#87055)
Egor Bogatov [Mon, 19 Jun 2023 07:50:46 +0000 (09:50 +0200)]
GDV: don't emit fallback call if classes are "exact" (#87055)

15 months agoCVE-2023-24936: Check type is allowed when deserializing instance types that implemen...
Shay Rojansky [Mon, 19 Jun 2023 07:11:34 +0000 (09:11 +0200)]
CVE-2023-24936: Check type is allowed when deserializing instance types that implements INullable (#87702)

Co-authored-by: Arthur Vickers <ajcvickers@hotmail.com>
15 months agoUpdate ExperimentalAttribute.cs (#87759)
Igor Velikorossov [Mon, 19 Jun 2023 03:58:06 +0000 (13:58 +1000)]
Update ExperimentalAttribute.cs (#87759)

Fix xml-doc

15 months agoClaims identity and principal debugging update (#87742)
James Newton-King [Mon, 19 Jun 2023 02:05:48 +0000 (10:05 +0800)]
Claims identity and principal debugging update (#87742)

* Claims identity and principal debugging update

* Comment

15 months agoAdd LoggerMessageAttribute constructor's overloads (#87738)
Tarek Mahmoud Sayed [Sun, 18 Jun 2023 22:20:40 +0000 (15:20 -0700)]
Add LoggerMessageAttribute constructor's overloads (#87738)

15 months agoFix the namespace of IServiceCollection.AddMetrics (#87736)
Tarek Mahmoud Sayed [Sun, 18 Jun 2023 16:50:43 +0000 (09:50 -0700)]
Fix the namespace of IServiceCollection.AddMetrics (#87736)

15 months agoJIT: Regularize readbacks for parameters/OSR-locals in physical promotion (#87165)
Jakob Botsch Nielsen [Sat, 17 Jun 2023 18:37:57 +0000 (20:37 +0200)]
JIT: Regularize readbacks for parameters/OSR-locals in physical promotion (#87165)

Handle readbacks for parameters/OSR-locals like any other readback is
handled. Previously they were handled by creating the scratch BB and
then inserting IR after the main replacement had already been done; now,
we instead create the scratch BB eagerly and mark these as requiring a
read back at the beginning of the scratch BB, and leave normal
replacement logic up to handle it.

The main benefit is that this unification makes it easier to ensure that
future smarter handling of readbacks/writebacks (e.g. "resolution")
automatically kicks in for the common case of parameters.

Introduce another invariant, which is that we only ever mark a field as
requiring readback if it is live. Previously we would always mark them
as requiring read backs, but would then check liveness before inserting
the actual IR to do the read back. But we don't always have the liveness
information at the point where we insert IR for readbacks after #86706.

Also expand some debug logging, and address some feedback from #86706.

15 months agoCurrencyNegativePattern can be 16 (#87671)
Alexander Radchenko [Sat, 17 Jun 2023 17:18:31 +0000 (23:18 +0600)]
CurrencyNegativePattern can be 16 (#87671)

15 months agoJIT: Add a check for forward sub store interference (#87615)
Jakob Botsch Nielsen [Sat, 17 Jun 2023 07:45:27 +0000 (09:45 +0200)]
JIT: Add a check for forward sub store interference (#87615)

Forward sub was not taking into account that the source of the candidate
def can contain locals that may be changed by next statement that is
being forward substituted into. For example, it is not legal to forward
substitute V06 in the following case:

```
[000104] DA--G------ ▌  STORE_LCL_VAR short  V06 tmp5
[000109] ----------- └──▌  LCL_VAR   short  V07 tmp6          (last use)

[000139] -A--------- ▌  COMMA     void
[000121] DA--------- ├──▌  STORE_LCL_VAR int    V07 tmp6
[000145] ----------- │  └──▌  CAST      int <- short <- int
[000074] ----------- │     └──▌  CNS_INT   int    1
[000129] UA--------- └──▌  STORE_LCL_FLD short  V00 arg0         [+16]
[000143] -----------    └──▌  CAST      int <- short <- int
[000090] -----------       └──▌  LCL_VAR   int    V06 tmp5          (last use)
```

Fix #87614

15 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 220325...
dotnet bot [Sat, 17 Jun 2023 07:35:44 +0000 (09:35 +0200)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2203250 (#87714)

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2203090

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2203090

15 months agoEnable CS1591 for projects that don't use intellisense package XML file (#84917)
Viktor Hofer [Sat, 17 Jun 2023 07:35:30 +0000 (09:35 +0200)]
Enable CS1591 for projects that don't use intellisense package XML file (#84917)

* Enable CS1591 for projects that don't use intellisense package XML file

* Update Directory.Build.targets

* Update Directory.Build.targets

* Update intellisense.targets

* Update intellisense.targets

* Update Microsoft.NETCore.Platforms.csproj

* Backport docs: Microsoft.Extensions.Hosting.WindowsServices

* Backport docs: Microsoft.Extensions.Hosting.Systemd

* Remove unnecessary full namespaces in triple slash.

* Fix xml comment formatting.

* Update System.Numerics.Tensors.csproj

* Update Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj

* Update System.Threading.RateLimiting.csproj

* Update WindowsServiceLifetimeOptions.cs

* Update SystemdNotifier.cs

* Update Microsoft.Bcl.AsyncInterfaces.csproj

* Update System.Speech.csproj

* Update System.Threading.RateLimiting.csproj

---------

Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
15 months agoCheck Locations length before accessing (#87659)
Sven Boemer [Sat, 17 Jun 2023 02:27:15 +0000 (19:27 -0700)]
Check Locations length before accessing (#87659)

Fixes an `IndexOutOfRangeException` thrown by the analyzer when
analyzing method parameters for the implicitly generated Main
method when using top-level statements. These method parameters
don't have location info because they are not in user code.

This also adds checks in the other places this analyzer accesses
`Locations[0]`, to be safe.

15 months agoInvoke startup hook from ApplyStartupHook diagnostic command (#87490)
Justin Anderson [Sat, 17 Jun 2023 00:20:29 +0000 (17:20 -0700)]
Invoke startup hook from ApplyStartupHook diagnostic command (#87490)

15 months agoFix TLS access on Bionic (#87670)
Michal Strehovský [Fri, 16 Jun 2023 23:49:24 +0000 (08:49 +0900)]
Fix TLS access on Bionic (#87670)

Avoid inlined threadstatics for now.

15 months agoDo not quote rpath passed to linker for Bionic (#87669)
Michal Strehovský [Fri, 16 Jun 2023 23:36:56 +0000 (08:36 +0900)]
Do not quote rpath passed to linker for Bionic (#87669)

* Do not quote rpath passed to linker

Looks like this is preserved literally, with the `'`.

The Android loader doesn't like this: `WARNING: linker: Warning: unable to normalize "'/data/data/com.termux/files/home'" (ignoring)`.

* Update Microsoft.NETCore.Native.Unix.targets

* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
15 months agoHardcode Debugger.IsAttached to false (#87677)
Michal Strehovský [Fri, 16 Jun 2023 23:36:25 +0000 (08:36 +0900)]
Hardcode Debugger.IsAttached to false (#87677)

Fixes #84736

15 months agoLimit number of tracked values in trim dataflow analysis (#87634)
Sven Boemer [Fri, 16 Jun 2023 23:34:33 +0000 (16:34 -0700)]
Limit number of tracked values in trim dataflow analysis (#87634)

Places a limit on the number of values tracked in our dataflow analysis, to
prevent hangs in the illink analyzer. This avoids hangs when analyzing patterns
that currently lead to an exponential number of tracked values.

15 months agoFix missing assemblyref for typeref only kept for debug info in illink (#87575)
Sven Boemer [Fri, 16 Jun 2023 23:33:31 +0000 (16:33 -0700)]
Fix missing assemblyref for typeref only kept for debug info in illink (#87575)

Fixes https://github.com/dotnet/runtime/issues/86462 by walking
debug info to discover typerefs in the assembly that are only
preserved due to debug info. In this case the assembly has the
'save' action, so the reference to the typeref in the debug info
is not swept. This means that the presence of the typeref in the
final output depends on whether we are linking the PDB. Walking
the typeref will preserve the assemblyref that it refers to,
fixing the issue.

The fix also needs to walk up the parent import scopes,
discovered by reproducing the issue in our test infra.

The behavior needs to depend on whether we are linking debug
symbols, otherwise we will keep the assemblyref (but not the
typeref that uses it) when PDBs are present, and the output
should not depend on the presence of
PDBs. `AssemblyOnlyUsedByUsingSaveAction` tests this case - see
comments in there for more detail.

This includes some unrelated test infra changes (supporting
multiple additional compiler arguments) which were useful for
iterating on this, even though they aren't necessary in the final
version of the testcases.

15 months agoMake JIT-EE interface formatting a little more consistent
Bruce Forstall [Fri, 16 Jun 2023 18:22:12 +0000 (11:22 -0700)]
Make JIT-EE interface formatting a little more consistent

15 months agoRemove slotNum argument from recordRelocation
Bruce Forstall [Fri, 16 Jun 2023 17:56:42 +0000 (10:56 -0700)]
Remove slotNum argument from recordRelocation

15 months agoRemove CORINFO_DESKTOP_ABI
Bruce Forstall [Fri, 16 Jun 2023 17:41:23 +0000 (10:41 -0700)]
Remove CORINFO_DESKTOP_ABI

15 months agoRemove getMethodModule
Bruce Forstall [Fri, 16 Jun 2023 17:34:40 +0000 (10:34 -0700)]
Remove getMethodModule

15 months agoRemove isValidStringRef
Bruce Forstall [Fri, 16 Jun 2023 17:28:44 +0000 (10:28 -0700)]
Remove isValidStringRef

15 months agoRemove isValidToken
Bruce Forstall [Fri, 16 Jun 2023 17:21:25 +0000 (10:21 -0700)]
Remove isValidToken

15 months agoRemove tryResolveToken
Bruce Forstall [Fri, 16 Jun 2023 17:14:43 +0000 (10:14 -0700)]
Remove tryResolveToken

15 months agoRemove isRIDClassDomainID
Bruce Forstall [Thu, 15 Jun 2023 23:43:30 +0000 (16:43 -0700)]
Remove isRIDClassDomainID

15 months agoRemove canAccessFamily
Bruce Forstall [Thu, 15 Jun 2023 23:37:25 +0000 (16:37 -0700)]
Remove canAccessFamily

15 months agoRemove getInlinedCallFrameVptr
Bruce Forstall [Thu, 15 Jun 2023 23:28:31 +0000 (16:28 -0700)]
Remove getInlinedCallFrameVptr

15 months agoRemove findNameOfToken
Bruce Forstall [Thu, 15 Jun 2023 23:23:19 +0000 (16:23 -0700)]
Remove findNameOfToken

15 months agoRemove satisfiesClassConstraints
Bruce Forstall [Thu, 15 Jun 2023 23:14:27 +0000 (16:14 -0700)]
Remove satisfiesClassConstraints

15 months agoRemove mergeClasses
Bruce Forstall [Thu, 15 Jun 2023 23:06:51 +0000 (16:06 -0700)]
Remove mergeClasses

15 months agoRemove isCompatibleDelegate
Bruce Forstall [Thu, 15 Jun 2023 21:54:05 +0000 (14:54 -0700)]
Remove isCompatibleDelegate

15 months agoRemove unused STRESS_PINVOKE_RESTORE_ESP
Bruce Forstall [Thu, 15 Jun 2023 21:23:55 +0000 (14:23 -0700)]
Remove unused STRESS_PINVOKE_RESTORE_ESP

15 months agoClean up JIT flags
Bruce Forstall [Thu, 15 Jun 2023 01:45:13 +0000 (18:45 -0700)]
Clean up JIT flags

1. Remove never set CORJIT_MCJIT_BACKGROUND.
2. Remove never checked CORJIT_PINVOKE_RESTORE_ESP (x86 only). Remove related
`COMPUTED_IS_PRE_V4_ASSEMBLY`, `IS_PRE_V4_ASSEMBLY`, `IsPreV4Assembly()`.
3. Remove unused CORJIT_FEATURE_SIMD.
4. Remove all the "UNUSED" flags, which only cause clutter.
5. Renumber/pack all the remaining flags. Ensure that all flags have unique
numbers, even for different platforms.
6. Add missing flags in a few cases: the JIT/CORJIT equality asserts, mcs "-jitflags"
dumpers, `CorJitFlagToString()`, `CorJitFlag` type.

15 months agoAddress feedback from #87680. (#87695)
Eirik Tsarpalis [Fri, 16 Jun 2023 22:30:41 +0000 (23:30 +0100)]
Address feedback from #87680. (#87695)

* Address feedback from #87680.

* Update src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerWrapper.Reflection.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
---------

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
15 months agoEnable async-over-sync FileStream read/writes to be cancelable on Windows (#87103)
Stephen Toub [Fri, 16 Jun 2023 22:07:57 +0000 (18:07 -0400)]
Enable async-over-sync FileStream read/writes to be cancelable on Windows (#87103)

* Enable async-over-sync FileStream read/writes to be cancelable on Windows

Using the same helpers we previously used to enable this in pipe streams on Windows, enable FileStream.Read/WriteAsync on a FileStream created for synchronous I/O to be cancelable.  This also makes some tweaks to those helpers to reduce allocation when a cancelable token is supplied.

* Update src/libraries/Common/src/System/Threading/AsyncOverSyncWithIoCancellation.cs

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
---------

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
15 months agoFully qualify return type on UnreachableException methods (#87661)
Jackson Schuster [Fri, 16 Jun 2023 21:54:02 +0000 (14:54 -0700)]
Fully qualify return type on UnreachableException methods (#87661)

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
15 months agoJIT: Add support for induced field accesses in physical promotion (#87410)
Jakob Botsch Nielsen [Fri, 16 Jun 2023 21:30:03 +0000 (23:30 +0200)]
JIT: Add support for induced field accesses in physical promotion (#87410)

Add support for promoting fields based on the fact that store decomposition
induces new field accesses. To do so we store all struct stores that involve
candidates for physical promotion as part of the initial accounting pass. Then
when picking the replacements we do it as a fixpoint computation, iteratively
expanding the set of replacements based on field accesses induced by store
decomposition with the existing set of replacements.

Fix #87371

15 months agoRestore removed API from Extensions (#85846)
Eric StJohn [Fri, 16 Jun 2023 20:27:26 +0000 (13:27 -0700)]
Restore removed API from Extensions (#85846)

* Restore missing API from Extensions

* Fix a couple missing interfaces

* Fix EventLog test

* Undo interface heirarchy change in hosting

We can't push members down in interfaces.  While this works for implicit
interface implementations, the runtime will fail the type load if the
type explicitly implemented those members in the old interface.

* Add API compat validation for old Extensions baseline

* Bring back less logging API and baseline missing

* Implement obsolete console API

* Fix the download of extensions compat packages

* Remove ConsoleLifetime overload

This method was creating a binding ambiguity for DI.
It has zero usage, so just exclude it.

* Update obsolete message on InplaceStringBuilder

* Fill in implementation of obsolete logging methods

* Update console->config ref dependency

* Update Obsolete messages and make error

* Suppress compat around Obsolete(..., error: true)

* Fix more obsolete messages

* Remove ConsoleLoggerProvider ctor overloads

These don't have much usage and their addition could create problems for
DI Providers.

* Omit ConfigurationSection .ctor overload

This overload has a source compatible replacement, and is only used by
one package in all of nuget.org - which already has assets targeting new
TargetFrameworks which don't depend on this API.

* Remove OptionsWrapper members

These were only available as non-obsolete in 2.0 and there is zero usage
on nuget.org.

* Mark restored obsoleted API as EditorBrowsable=never

* Remove extensions 2.1 compat infrastructure

* Remove unused usings

15 months agoFix invalid lowering for SELECT over mixed neg/not operands (#87674)
SwapnilGaikwad [Fri, 16 Jun 2023 19:18:30 +0000 (20:18 +0100)]
Fix invalid lowering for SELECT over mixed neg/not operands (#87674)

15 months agoUpdate dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimizati...
dotnet-maestro[bot] [Fri, 16 Jun 2023 17:39:30 +0000 (12:39 -0500)]
Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230615.5 (#87686)

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

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
15 months agofix(66900): Adding test for confirm bug fix. (#87167)
Maksim Golev [Fri, 16 Jun 2023 16:32:56 +0000 (20:32 +0400)]
fix(66900): Adding test for confirm bug fix. (#87167)

Co-authored-by: Maksim Golev <mgolev@htc-cs.ru>
15 months ago[hot reload][mono] Implement support for adding static and instance fields to generic...
Aleksey Kliger (λgeek) [Fri, 16 Jun 2023 16:19:17 +0000 (12:19 -0400)]
[hot reload][mono] Implement support for adding static and instance fields to generic classes (#87285)

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

* new test adding a generic field

* workaround roslyn issue to generate generic static field test

   https://github.com/dotnet/roslyn/issues/68293 we get an error if we add a generic field and try to use it during the same edit. workaround is to do two separate edits

* implement hot reload for static fields in generics

   ldsflda seems to be working

* Add a generic instance add instance field test

* add reflection testing to the generic instance added field test

* fixup valuetype loads

* add non-generic valuetype ldflda test

* Mark failing tests for CoreCLR

* light up GenericAddFieldToExistingType capability

* use interp_emit_ldobj for metadata-update; add barrier if volatile

15 months agoFix `File.Copy` onto a symlink on macOS (#87600)
Hamish Arblaster [Fri, 16 Jun 2023 16:05:53 +0000 (02:05 +1000)]
Fix `File.Copy` onto a symlink on macOS (#87600)

* Initial commit

* Fix compile error

* Update SafeFileHandle.Unix.cs

* Fix macOS compilation errors

* Somehow I forgot overwrite = true

* Implement feedback

15 months ago[mono][interp] Fix concurrency issues with publishing transfomed imethod (#87555)
Vlad Brezae [Fri, 16 Jun 2023 15:22:22 +0000 (18:22 +0300)]
[mono][interp] Fix concurrency issues with publishing transfomed imethod (#87555)

* [mono][utils] Move all membar code to single file

* [mono][utils] Redefine write and read memory barriers

Before this change they were doing a full memory barrier, regardless of architecture. We have a beginning of more precise implementation via the *_FENCE defines. Implement mono_memory_write_barrier and mono_memory_read_barrier reusing these defines instead.

The only consequence of this change is that, on x86 and amd64, `mono_memory_write_barrier` and `mono_memory_read_barrier` become a compiler barrier instead of a full mfence.

* [mono][interp] Fix concurrency issues with publishing transfomed imethod

When publishing a transformed InterpMethod*, we first set all relevant fields (like `code`, `alloca_size` etc), we execute a write barrier and finally we set the `transformed` flag. On relaxed memory arches we need to have a read barrier on the consumer, since there is no data dependency between `transformed` and the other fields of `InterpMethod`.

On arm this change does a full barrier (we could get away with just a load acquire but we haven't yet added support for emitting this in the runtime). Still, this doesn't seem to introduce a heavy perf penalty (on my arm64 M1) but we can revisit if necessary. On x86/amd64 this is a compiler barrier so it should have no impact. WASM is single threaded for now.

15 months agoUnblock CI by removing AlmaLinux from libraries tests (#87668)
Andy Gocke [Fri, 16 Jun 2023 14:41:30 +0000 (07:41 -0700)]
Unblock CI by removing AlmaLinux from libraries tests (#87668)

Tracking issue: https://github.com/dotnet/runtime/issues/87667

15 months agoFix broken link in editing-and-debugging.md (#87681)
Eric Mutta [Fri, 16 Jun 2023 13:00:16 +0000 (16:00 +0300)]
Fix broken link in editing-and-debugging.md (#87681)

15 months agoAttempt to fix browser-wasm test failures. (#87680)
Eirik Tsarpalis [Fri, 16 Jun 2023 12:50:21 +0000 (13:50 +0100)]
Attempt to fix browser-wasm test failures. (#87680)

* Attempt to fix browser-wasm test failures.

* Address feedback.

15 months agoFix DependencyModel tests on NativeAOT (#87666)
Eric Erhardt [Fri, 16 Jun 2023 12:40:11 +0000 (07:40 -0500)]
Fix DependencyModel tests on NativeAOT (#87666)

15 months agoFix broken link in CONTRIBUTING.md (#87685)
Eric Mutta [Fri, 16 Jun 2023 12:37:23 +0000 (15:37 +0300)]
Fix broken link in CONTRIBUTING.md (#87685)

Update link to point to the [Pull Request Guide](https://github.com/dotnet/runtime/blob/main/docs/workflow/ci/pr-guide.md) in its current location.

15 months ago[mono][llvm] Fixed personality function on Windows (#87675)
Jan Dupej [Fri, 16 Jun 2023 11:50:19 +0000 (13:50 +0200)]
[mono][llvm] Fixed personality function on Windows (#87675)

* Fixed personality function on Windows.

* Removed unnecessary files.

15 months agoReimplement NegotiateStream using (mostly) public NegotiateAuthenticaton API (#86948)
Filip Navara [Fri, 16 Jun 2023 10:47:47 +0000 (12:47 +0200)]
Reimplement NegotiateStream using (mostly) public NegotiateAuthenticaton API (#86948)

* Reimplement NegotiateStream using (mostly) public NegotiateAuthentication API

* Minor adjustment to NegotiateStreamPal on Android/tvOS to allow NegotiateStream to work

* Remove unrelated ApiCompat
suppression changes

15 months agoFix redundant MethodInfo lookup in UnixNativeCodeManager (#87664)
Jan Kotas [Fri, 16 Jun 2023 08:17:59 +0000 (01:17 -0700)]
Fix redundant MethodInfo lookup in UnixNativeCodeManager (#87664)

Fixes #75807

15 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 220232...
dotnet bot [Fri, 16 Jun 2023 07:10:57 +0000 (09:10 +0200)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2202323 (#87660)

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2202051

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2202051

15 months agoRemove dead code (#87399)
Filip Navara [Fri, 16 Jun 2023 05:43:29 +0000 (07:43 +0200)]
Remove dead code (#87399)

15 months agoBuild integration support for Bionic in NativeAOT (#87595)
Michal Strehovský [Fri, 16 Jun 2023 05:25:31 +0000 (14:25 +0900)]
Build integration support for Bionic in NativeAOT (#87595)

Doesn't actually work E2E because the inline threadstatics work broke our Android support (the one added in https://github.com/dotnet/corert/pull/8323).

```
  C:\Users\michals\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\8.0.0-preview.6.23307.4/r
  untimes/linux-bionic-arm64/\native\libRuntime.WorkstationGC.a(MiscStubs.S.o): In function `RhpGetInlinedThreadStaticB
  ase':
  /__w/1/s/src/coreclr/nativeaot/Runtime/arm64/MiscStubs.S:12: undefined reference to `tls_InlinedThreadStatics'
  /__w/1/s/src/coreclr/nativeaot/Runtime/arm64/MiscStubs.S:12: undefined reference to `tls_InlinedThreadStatics'
  /__w/1/s/src/coreclr/nativeaot/Runtime/arm64/MiscStubs.S:12: undefined reference to `tls_InlinedThreadStatics'
  /__w/1/s/src/coreclr/nativeaot/Runtime/arm64/MiscStubs.S:12: undefined reference to `tls_InlinedThreadStatics'
```

15 months ago[Mono] Add mono hot reload support for updating parameter name (#85796)
Fan Yang [Fri, 16 Jun 2023 04:53:52 +0000 (00:53 -0400)]
[Mono] Add mono hot reload support for updating parameter name (#85796)

Fixes #56626
Fixes #50978

* Add mono hot reload support for updating parameter name

* Add a debugger test

* Don't invalidate the whole assembly when using hot reload

* don't ignore reflection cache entries when the "no invalidate" flag is set

---------

Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
15 months agoAdd DebuggerDisplay to some hosting types (#87599)
James Newton-King [Fri, 16 Jun 2023 04:17:52 +0000 (12:17 +0800)]
Add DebuggerDisplay to some hosting types (#87599)

15 months agoRemove KeyValuePairConverter. (#87637)
Eirik Tsarpalis [Fri, 16 Jun 2023 04:11:07 +0000 (05:11 +0100)]
Remove KeyValuePairConverter. (#87637)

15 months agoFaster optimized frozen dictionary creation (2/n) (#87630)
Adam Sitnik [Fri, 16 Jun 2023 04:10:16 +0000 (06:10 +0200)]
Faster optimized frozen dictionary creation (2/n) (#87630)

* use stackalloc for smaller sizes

* Revert "use stackalloc for smaller sizes", it did not help much

This reverts commit 204e1752d828fac0f772d144b0daaf7dd4ab93ec.

* let the caller of FrozenHashTable.Create provide the hashcodes, it avoids a closure, index boundary checks and helps with inlining (7% gain)

in case of hash set of integers it avoids renting and copying all integers to just have a copy of them

* keys and values are needed for every strategy, lets create them up-front (2-4% gain)

* in CreateLengthBucketsFrozenDictionaryIfAppropriate iterate over array rather than dictionary
* in OrdinalStringFrozenDictionary ctor avoid creating a copy of all entires (we already have a copy of keys)

* refactor: there is no need to pass entriesLength anymore (hashCodes.Length is the replacement)

15 months agoAdd ContainsAny{Except} (#87621)
Miha Zupan [Fri, 16 Jun 2023 04:03:27 +0000 (06:03 +0200)]
Add ContainsAny{Except} (#87621)

* Add ContainsAny{Except}

* Use it everywhere

* Test coverage

* Fix ContainsAny on a string

* Reword summaries on ContainsAny

* Appease older TFMs

* Revert TestFilter.cs changes

* Appease older TFMs part 2

15 months ago[wasm] Fix inclusion of `marshal-ilgen` component (#87629)
Ankit Jain [Fri, 16 Jun 2023 03:00:20 +0000 (23:00 -0400)]
[wasm] Fix inclusion of `marshal-ilgen` component (#87629)

* [wasm] Fix inclusion of `marshal-ilgen`

Issue: `marshal-ilgen` component never included

Reason:
The item inclusion was being done *outside* any targets, which would get
evaluated *before* any targets are run.

But the item that it depends on to decide whether to include
`marshal-ilgen` is in target
`_ScanAssembliesDecideLightweightMarshaler`.

This broke microbenchmarks with:
```
Error: [MONO] * Assertion at /__w/1/s/src/mono/mono/component/marshal-ilgen-stub.c:28, condition `!m_type_is_byref(t)' not met

    at ft (/home/helixbot/work/96640802/w/B9C40A15/e/performance/artifacts/bin/for-running/MicroBenchmarks/fa21f9df-08d0-43a4-b28d-0078821ea492/bin/net8.0/browser-wasm/AppBundle/dotnet.runtime.js:3:12422)
    at mt (/home/helixbot/work/96640802/w/B9C40A15/e/performance/artifacts/bin/for-running/MicroBenchmarks/fa21f9df-08d0-43a4-b28d-0078821ea492/bin/net8.0/browser-wasm/AppBundle/dotnet.runtime.js:3:12676)
    at wasm_trace_logger (wasm://wasm/00a5f7d6:wasm-function[7879]:0x1e41d0)
    at eglib_log_adapter (wasm://wasm/00a5f7d6:wasm-function[581]:0x37fbb)
    at monoeg_g_logv_nofree (wasm://wasm/00a5f7d6:wasm-function[504]:0x35f57)
    at monoeg_assertion_message (wasm://wasm/00a5f7d6:wasm-function[508]:0x36078)
    at mono_assertion_message (wasm://wasm/00a5f7d6:wasm-function[510]:0x360bb)
    at stub_emit_marshal_ilgen (wasm://wasm/00a5f7d6:wasm-function[1300]:0x66db1)
    at mono_emit_marshal (wasm://wasm/00a5f7d6:wasm-function[1820]:0x8990b)
    at emit_native_wrapper_ilgen (wasm://wasm/00a5f7d6:wasm-function[2651]:0xb86de)
```

* [wasm] WBT: Use sdk 8.0.100-preview.6.23314.19

.. to workaround https://github.com/dotnet/runtime/issues/87647 .

* [wasm] Add test for marshal-ilgen - wbt

* add missing file