platform/upstream/dotnet/runtime.git
13 months agoAdd marshalling tests and warn if interface is not partial (#87146)
Jackson Schuster [Fri, 9 Jun 2023 22:25:44 +0000 (17:25 -0500)]
Add marshalling tests and warn if interface is not partial (#87146)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #86410

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

Not needed after build is complete when PostBuildSign != true

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

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

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

Related #87275

13 months agoSet PublishTrimmed in NativeAOT targets (#87304)
Michal Strehovský [Fri, 9 Jun 2023 04:06:18 +0000 (13:06 +0900)]
Set PublishTrimmed in NativeAOT targets (#87304)

Looks like this is still needed. Fixes #87303.

13 months agoEnsure that Vector<T> is tracked as "optimistic" for crossgen2 (#87240)
Tanner Gooding [Fri, 9 Jun 2023 03:52:42 +0000 (20:52 -0700)]
Ensure that Vector<T> is tracked as "optimistic" for crossgen2 (#87240)

13 months agoAdd analyzers and code-fixes to help adoption of source-generated COM (#87223)
Jeremy Koritzinsky [Fri, 9 Jun 2023 03:36:25 +0000 (20:36 -0700)]
Add analyzers and code-fixes to help adoption of source-generated COM (#87223)

* Add first pass of the "convert to generated COM interface" analyzer and add tests for the various other analyzers we are going to introduce.

* Get all analyzer-specific components of the "convert" tests passing.

* Implement all interface-attribute-level changes in the code fixer.

* Add bool marshalling insertion logic to the fixer.

* Add support for removing shadowing members from interfaces.

* Rename fixer

* ActiveIssue the new tests

* Implement basic AddGeneratedComClass analyzer/fixer

* Add ComHosting + GeneratedComInterface analyzer implementation.

* Implement the "runtime COM APIs with source-generated COM types" analyzer.

* Factor out a base class from the ConvertToLibraryImportFixer so we can share it with the ComInterfaceGenerator-family of fixers.

* Move more of the ConvertToLibraryImportFixer to use SyntaxGenerator APIs instead of dropping to C#-specific syntax APIs (improves consistency throughout our code fixes)

* Move support for specifying explicit boolean marshalling rules up to the base class.

* Move the code fixes in ComInterfaceGenerator over to using the ConvertToSourceGeneratedInteropFixer base type.

* Remove use of multicasted delegates and use a more traditional "array of delegates" model.

* Do some refactoring to move more into the new fixer base class.

* Remove custom CodeAction-derived types now that we have a record type to represent fixes from the subclasses.

* Make sure we make types and containing types partial

* Fix negative test.

* Add tests for transitive interface inheritance and add iids.

* Change bool parsing for internal parsing and add warning annotation text. Update diagnostics list md.

13 months agoBump the max Dwarf warning limit (#87301)
Jan Kotas [Fri, 9 Jun 2023 03:24:32 +0000 (20:24 -0700)]
Bump the max Dwarf warning limit (#87301)

13 months agoGenerate debug info even if managed debug info not present (#87251)
Michal Strehovský [Fri, 9 Jun 2023 02:21:24 +0000 (11:21 +0900)]
Generate debug info even if managed debug info not present (#87251)

The names/types of parameters are available even without a PDB in .NET - surface them to the native debugger.

We could also surface fake information about locals because the type information is there (just no names/compiler generated bit), but it's unclear if that would be an improvement.

13 months agoDelete Debian 10 test runs (#87288)
Jan Kotas [Fri, 9 Jun 2023 00:26:27 +0000 (17:26 -0700)]
Delete Debian 10 test runs (#87288)

Debian 10 is not supported for .NET 8.

Fixes #87268

13 months agoRemove some dead code that threw file load exception (#87290)
Elinor Fung [Fri, 9 Jun 2023 00:10:47 +0000 (17:10 -0700)]
Remove some dead code that threw file load exception (#87290)

* Remove some dead code that threw file load exception

* Remove FUSION_E_CACHEFILE_FAILED

13 months agoFix typo in dac-notes.md (#87295)
t-mustafin [Fri, 9 Jun 2023 00:04:21 +0000 (03:04 +0300)]
Fix typo in dac-notes.md (#87295)

13 months ago[main] Update dependencies from 10 repositories (#87125)
dotnet-maestro[bot] [Thu, 8 Jun 2023 23:37:41 +0000 (16:37 -0700)]
[main] Update dependencies from 10 repositories (#87125)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: vitek-karas <10670590+vitek-karas@users.noreply.github.com>
13 months agoJIT: Handle primitive remainder stores to regularly promoted fields in physical promo...
Jakob Botsch Nielsen [Thu, 8 Jun 2023 20:20:44 +0000 (22:20 +0200)]
JIT: Handle primitive remainder stores to regularly promoted fields in physical promotion (#87217)

If the remainder of a block copy is handled as a primitive, then it is
possible that the destination or source is a regularly promoted field.
In this case we do not have to DNER it.

Example. Before:

```
Processing block operation [000009] that involves replacements
  V08 (field V02.hasValue (fldOffset=0x0)) <- V16 (V00.[000..001)) (last use)
  Remainder: [004..008)
  => Remainder strategy: int at +004

Local V00 should not be enregistered because: was accessed as a local field

Local V02 should not be enregistered because: was accessed as a local field
New statement:
STMT00003 ( 0x00D[E-] ... 0x00E )
               [000090] -A---------                         ▌  COMMA     void
               [000087] DA---------                         ├──▌  STORE_LCL_VAR bool   V08 tmp4
               [000086] -----------                         │  └──▌  LCL_VAR   bool   V16 tmp12         (last use)
               [000089] UA---------                         └──▌  STORE_LCL_FLD int   (P) V02 loc1         [+4]
                                                               ▌    bool   V02.<unknown class>:hasValue (offs=0x00) -> V08 tmp4
                                                               ▌    int    V02.<unknown class>:value (offs=0x04) -> V09 tmp5
               [000088] -----------                            └──▌  LCL_FLD   int    V00 arg0         [+4]
```

After:

```
Processing block operation [000009] that involves replacements
  V08 (field V02.hasValue (fldOffset=0x0)) <- V16 (V00.[000..001)) (last use)
  Remainder: [004..008)
  => Remainder strategy: int at +004

Local V00 should not be enregistered because: was accessed as a local field
New statement:
STMT00003 ( 0x00D[E-] ... 0x00E )
               [000090] -A---------                         ▌  COMMA     void
               [000087] DA---------                         ├──▌  STORE_LCL_VAR bool   V08 tmp4
               [000086] -----------                         │  └──▌  LCL_VAR   bool   V16 tmp12         (last use)
               [000089] DA---------                         └──▌  STORE_LCL_VAR int    V09 tmp5
               [000088] -----------                            └──▌  LCL_FLD   int    V00 arg0         [+4]

```

13 months agoMove DynamicCodeSupport default into aot targets (#87135)
Sven Boemer [Thu, 8 Jun 2023 19:43:18 +0000 (12:43 -0700)]
Move DynamicCodeSupport default into aot targets (#87135)

* Move DynamicCodeSupport default into aot targets

* Clean up redundant PublishTrimmed setting

13 months agoAdd IHostApplicationBuilder interface (#86974)
Eric Erhardt [Thu, 8 Jun 2023 19:25:49 +0000 (14:25 -0500)]
Add IHostApplicationBuilder interface (#86974)

* Add IHostApplicationBuilder and implement it in HostApplicationBuilder.

- Move ILoggingBuilder from MS.Ext.Logging to MS.Ext.Logging.Abstractions so IHostApplicationBuilder can reference it.
- Add IConfigurationManager and implement it in ConfigurationManager.
- Add CompatiibilitySuppressions. These errors are caused by ILoggingBuilder being moved to Logging.Abstractions, and ApiCompat not respecting TypeForwardedTo attributes.

Fix #85486

13 months agoFix DeserializeAsyncEnumerable generic recursion issue. (#87276)
Eirik Tsarpalis [Thu, 8 Jun 2023 18:39:04 +0000 (19:39 +0100)]
Fix DeserializeAsyncEnumerable generic recursion issue. (#87276)

13 months agoDon't enable ILLink analyzers for unsupported TFMs (#87071)
Sven Boemer [Thu, 8 Jun 2023 17:10:58 +0000 (10:10 -0700)]
Don't enable ILLink analyzers for unsupported TFMs (#87071)

* Don't enable ILLink analyzers for unsupported TFMs

This adds a condition to EnableSingleFileAnalyzer to prevent it from requiring
the ILLink pack that is only supported on netcoreapp3.0 and above.

Adding a condition on the TFM requires moving the setting into a targets file.

Also consolidates more of the analyzer logic into this file.

---------

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
13 months ago[wasm] Fix for getelema1 crash & cpblk crash in jiterpreter (#87246)
Katelyn Gadd [Thu, 8 Jun 2023 16:33:53 +0000 (09:33 -0700)]
[wasm] Fix for getelema1 crash & cpblk crash in jiterpreter (#87246)

* Fix for getelema1 crash in specific scenarios
* Check more of the zero page for nonzero data
* If we ever see garbage in the zero page disable it permanently
* Log an error if garbage appears in the zero page after startup
* Overhaul trace local variable naming and reuse
* Fix count not being initialized for cpblk in some cases

13 months agomake mono_wasm_invoke_method_bound safer with exception root (#87266)
Pavel Savara [Thu, 8 Jun 2023 16:17:24 +0000 (18:17 +0200)]
make mono_wasm_invoke_method_bound safer with exception root (#87266)

13 months agoRemove calls to GetHighPrecisionTimeStamp from allocate_uoh_object that made it into...
Peter Sollich [Thu, 8 Jun 2023 15:52:42 +0000 (17:52 +0200)]
Remove calls to GetHighPrecisionTimeStamp from allocate_uoh_object that made it into main by mistake (my bad). (#87273)

14 months agoJIT: Fix a couple of inequalities in promotion decomposition (#87186)
Jakob Botsch Nielsen [Thu, 8 Jun 2023 15:04:35 +0000 (17:04 +0200)]
JIT: Fix a couple of inequalities in promotion decomposition (#87186)

These checks were of the form `end < start` when more precisely they
can be `end <= start`. It was causing some unnecessarily conservative
writebacks to occur in some cases.

Also skip entries in the decomposition plan that are writing to the
remainder when the remainder is dead. Saw a bunch of these cases in
the regressions and realized we were missing this case.

14 months agoRemove Vector<T> fallbacks for Vector128<T> (#85916)
Stephen Toub [Thu, 8 Jun 2023 13:48:44 +0000 (09:48 -0400)]
Remove Vector<T> fallbacks for Vector128<T> (#85916)

* Remove Vector<T> fallbacks for Vector128<T>

* ifdef instead of deleting Vector<T> code paths

ifdef them to mono as they're not used by coreclr or nativeaot.  They can be deleted instead once mono's Vector128 support improves.

14 months agowe don't load timezone with mono_wasm_load_data_archive anymore (#87264)
Pavel Savara [Thu, 8 Jun 2023 13:37:10 +0000 (15:37 +0200)]
we don't load timezone with mono_wasm_load_data_archive anymore (#87264)

14 months agodon't use GetEarlyNode in impGetSpecialIntrinsicExactReturnType (#87263)
Egor Bogatov [Thu, 8 Jun 2023 12:51:45 +0000 (14:51 +0200)]
don't use GetEarlyNode in impGetSpecialIntrinsicExactReturnType (#87263)

14 months ago[mono][arm64] Handle sysctlbyname failing to find system options. (#87189)
Rolf Bjarne Kvinge [Thu, 8 Jun 2023 12:15:18 +0000 (14:15 +0200)]
[mono][arm64] Handle sysctlbyname failing to find system options. (#87189)

This fixes a startup crash on Big Sur:

> error: * Assertion at /Users/runner/work/1/s/src/mono/mono/utils/mono-hwcap-arm64.c:35, condition `res == 0' not met

Because sysctl can't find some of these options:

    $ sysctl hw.optional.armv8_crc32
    hw.optional.armv8_crc32: 1
    $ sysctl hw.optional.arm.FEAT_RDM
    sysctl: unknown oid 'hw.optional.arm.FEAT_RDM'
    $ sysctl hw.optional.arm.FEAT_DotProd
    sysctl: unknown oid 'hw.optional.arm.FEAT_DotProd'
    $ sysctl hw.optional.arm.FEAT_SHA1
    sysctl: unknown oid 'hw.optional.arm.FEAT_SHA1'
    $ sysctl hw.optional.arm.FEAT_SHA256
    sysctl: unknown oid 'hw.optional.arm.FEAT_SHA256'
    $ sysctl hw.optional.arm.FEAT_AES
    sysctl: unknown oid 'hw.optional.arm.FEAT_AES'

Full stack trace:

* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
  * frame #0: 0x0000010ef37560 libmonosgen-2.0.dylib`monoeg_assertion_message
    frame #1: 0x0000010ef375cc libmonosgen-2.0.dylib`mono_assertion_message + 32
    frame #2: 0x0000010ef40d6c libmonosgen-2.0.dylib`mono_hwcap_arch_init + 544
    frame #3: 0x0000010ef54bd8 libmonosgen-2.0.dylib`mono_hwcap_init + 72
    frame #4: 0x0000010ee14dc0 libmonosgen-2.0.dylib`parse_optimizations + 52
    frame #5: 0x0000010edbed48 libmonosgen-2.0.dylib`mono_init
    frame #6: 0x0000010ee18968 libmonosgen-2.0.dylib`mono_jit_init_version
    frame #7: 0x0000010f48a300 libxamarin-dotnet-debug.dylib`xamarin_bridge_initialize + 216
    frame #8: 0x0000010f4900a4 libxamarin-dotnet-debug.dylib`xamarin_main + 376

14 months ago[browser] Fix fingerprinting of relinked dotnet.js - follow up (#87051)
Marek Fišera [Thu, 8 Jun 2023 11:33:44 +0000 (13:33 +0200)]
[browser] Fix fingerprinting of relinked dotnet.js - follow up (#87051)

Address comments from #86048

14 months ago[NativeAOT] Improving HelloiOS sample for NativeAOT to be testable with runtime packs...
Ivan Povazan [Thu, 8 Jun 2023 11:15:31 +0000 (13:15 +0200)]
[NativeAOT] Improving HelloiOS sample for NativeAOT to be testable with runtime packs (#86652)

- Enabled end-to-end testing of HelloiOS with NativeAOT runtime packs
- Update ILCompiler paths to handle PublishAotUsingRuntimePack=true
Fixes https://github.com/dotnet/runtime/issues/80911
---------
Co-authored-by: Filip Navara <navara@emclient.com>
14 months ago[wasm][debugging] Enable debugging when Device Toolbar is enabled and Iphone is selec...
Thays Grazia [Thu, 8 Jun 2023 10:20:21 +0000 (07:20 -0300)]
[wasm][debugging] Enable debugging when Device Toolbar is enabled and Iphone is selected (#86920)

* Enable debugging when Device Toolbar is enabled and Iphone is selected
* unify browser detection
Co-authored-by: pavelsavara <pavel.savara@gmail.com>
14 months agoFix inline decision reporting + noinline propagation (#87115)
Egor Bogatov [Thu, 8 Jun 2023 09:27:53 +0000 (11:27 +0200)]
Fix inline decision reporting + noinline propagation (#87115)

14 months agoIfdef out DynamicDependencies that are not necessary (#87209)
Michal Strehovský [Thu, 8 Jun 2023 09:14:36 +0000 (18:14 +0900)]
Ifdef out DynamicDependencies that are not necessary (#87209)

These create unnecessary reflection targets. Trimming done by NativeAOT will do the right thing and it is redundant on CoreCLR.

14 months agoSetup for runs with physical promotion. (#87227)
Jiri Cincura ↹ [Thu, 8 Jun 2023 08:02:22 +0000 (10:02 +0200)]
Setup for runs with physical promotion. (#87227)

14 months agoOptimize MethodTable on both sides of `==` (#87238)
Michal Strehovský [Thu, 8 Jun 2023 06:19:01 +0000 (15:19 +0900)]
Optimize MethodTable on both sides of `==` (#87238)

Optimizes `typeof(Foo) == typeof(Bar)` for both sides. This is necessary to get `System.Double` MethodTable from hello world again.

I tried to write a test for this but I wasn't able to come up with something in 10 minutes so I gave up. It seems to require interactions of several things to actually trigger the size bloat without this extra optimization. But this does fix the `Double` case.

14 months agoDelete some dead code (#87249)
Michal Strehovský [Thu, 8 Jun 2023 05:31:08 +0000 (14:31 +0900)]
Delete some dead code (#87249)

I went through RuntimeImports looking for things that looked unnecessary. The rest of this PR is basically "stuff that came out after pulling on a loose thread of a sweater".

14 months agoHandle diagnostic port configuration in NativeAOT (#87088)
Elinor Fung [Thu, 8 Jun 2023 04:43:43 +0000 (21:43 -0700)]
Handle diagnostic port configuration in NativeAOT (#87088)

14 months ago[wasm] Fix running debugger tests on windows (#87228)
Ankit Jain [Thu, 8 Jun 2023 03:25:18 +0000 (23:25 -0400)]
[wasm] Fix running debugger tests on windows (#87228)

* [wasm] Fix running debugger tests on windows

.. by making sure to escape `&` in the command line. This was introduced
in:

```
commit e96321db982c3add192381f6ea4ff0a999ee1410
Author: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
Date:   Tue Jun 6 05:59:43 2023 +0200

    [wasm][debugger] Disable failing multithreading debugger tests (#86501)
```

.. but missed CI due to the helix outage.

* Fix escaping ! on windows

14 months agoWIP (#86512)
Andy Gocke [Thu, 8 Jun 2023 03:23:25 +0000 (20:23 -0700)]
WIP (#86512)

14 months agoFix FreeBSD build break (#87242)
Jan Kotas [Thu, 8 Jun 2023 02:41:32 +0000 (19:41 -0700)]
Fix FreeBSD build break (#87242)

14 months agoUpdate ClaimsIdentity debug display (#87159)
James Newton-King [Thu, 8 Jun 2023 02:23:29 +0000 (10:23 +0800)]
Update ClaimsIdentity debug display (#87159)

* Update ClaimsIdentity.cs

* Update src/libraries/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs

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

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
14 months agoSimplify Random for ulong (#87219)
Michał Petryka [Thu, 8 Jun 2023 02:22:36 +0000 (04:22 +0200)]
Simplify Random for ulong (#87219)

Use Math.BigMul instead of UInt128 since both values are always ulongs.

14 months agoImplement `FlipBit` (#83400)
xtqqczze [Thu, 8 Jun 2023 02:22:02 +0000 (03:22 +0100)]
Implement `FlipBit` (#83400)

* Implement `ToggleBit`

* Rename to `ToggleBit`

* Minor improvement to documentation comments

14 months ago[NativeAOT] Don't link Swift/CryptoKit on iOS-like platforms (#87216)
Filip Navara [Thu, 8 Jun 2023 02:10:07 +0000 (04:10 +0200)]
[NativeAOT] Don't link Swift/CryptoKit on iOS-like platforms (#87216)

14 months agoFix reading runtime settings early in startup (#87205)
Michal Strehovský [Wed, 7 Jun 2023 23:32:10 +0000 (08:32 +0900)]
Fix reading runtime settings early in startup (#87205)

* Since runtime settings are read before we had a chance to run dehydration, they cannot go to the dehydrated section. This is a 48-byte penalty per setting on Linux. Hopefully we won't have too many of these.
* Fix the repro project to enable dehydration. When testing the original change, I used repro project where this worked because of no dehydration. We should mirror the shipping configuration.
* Add a regression test. Picked a random test as a "victim" so that we don't unnecessarily regress testing time.

14 months agoImplement JsonStringEnumConverter<TEnum> (#87224)
Eirik Tsarpalis [Wed, 7 Jun 2023 23:20:34 +0000 (00:20 +0100)]
Implement JsonStringEnumConverter<TEnum> (#87224)

* Fix NativeAOT support for JsonStringEnumConverter.

* Fix merge issue.

* Implement JsonStringEnumConverter<TEnum>.

* Remove leftover comments.

* Revert unnecessary suppression.

* Update compatibility suppressions.

* Add missing XML docs

* Fix capitalization.

* add local project compatibility suppressions

* apply suggestion in all location

* Fix failing test.

* Ensure both converter factories throw an appropriate exception when passed invalid inputs.

14 months agoImprove codegen for AVX-512 comparisons and general handling of `TYP_MASK` (#87089)
Tanner Gooding [Wed, 7 Jun 2023 23:01:59 +0000 (16:01 -0700)]
Improve codegen for AVX-512 comparisons and general handling of `TYP_MASK` (#87089)

* Add the various base kmask instructions

* Updating lowering to better handle the AVX512 comparisons that produce a mask

* Remove INS_Flags_IsMskSrcSrcEvexInstruction as its the same as INS_Flags_IsDstDstSrcAVXInstruction

* Save 1-byte on the encoding for CompareEqualMask and signed CompareGreaterThanMask

* Apply formatting patch

* Ensure kmovd is encoded correctly and kmov is disassembled correctly

* Ensure vpcmpgtq is actually handled

* Fix the definition of a couple kmask instructions

* Ensure gtNewSimdCmpOpAll node creates correct IR for simdSize == 64

* Add , that were dropped when resolving merge

* Ensure that the new hwintrinsiclistxarch entries don't assert ValueNum

14 months agoApply source build patch (#87226)
Jan Kotas [Wed, 7 Jun 2023 22:32:37 +0000 (15:32 -0700)]
Apply source build patch (#87226)

Fixes #83695

14 months agoUse Unsafe.BitCast for Interlocked.{Compare}Exchange of float/double (#87166)
Huo Yaoyuan [Wed, 7 Jun 2023 22:28:01 +0000 (06:28 +0800)]
Use Unsafe.BitCast for Interlocked.{Compare}Exchange of float/double (#87166)

* Update {Compare}Exchange in coreclr to use Unsafe.As

* Remove corresponding FCalls

* Share with mono

* Remove Mono icalls

* Add AggressiveInlining

* Remove unused union type in mono

14 months ago[VM] Fix potential undefined behavior (#87119)
Trung Nguyen [Wed, 7 Jun 2023 22:26:37 +0000 (08:26 +1000)]
[VM] Fix potential undefined behavior (#87119)

Use pointer arithmetic instead of direct array access to avoid
compilers, specifically GCC, to discover undefined behavior and
generate unintended code when optimization is turned on.

The array involved is `pSeries->val_serie`, which is declared as
a fixed sized array of size 1. However, `index` is always a
non-negative integer, and we want to access the memory at
`-index`, which is either zero or negative.

14 months agoEnsure the CPUID tests cover a couple hwintrinsic disablement edge cases (#87127)
Tanner Gooding [Wed, 7 Jun 2023 21:56:11 +0000 (14:56 -0700)]
Ensure the CPUID tests cover a couple hwintrinsic disablement edge cases (#87127)

* Ensure CPUID tests have BMI1/BMI2 use the AVX hierarchy checks, not AVX2

* Ensure CPUID tests check the DOTNET_EnableSSE3_4 environment variable

* Fix a build failure in X86Base/CpuId.cs

* Ensure that BMI1/BMI2 are checking the right bits

14 months agoAllow duplicate feature switch settings (#87207)
Michal Strehovský [Wed, 7 Jun 2023 20:50:18 +0000 (05:50 +0900)]
Allow duplicate feature switch settings (#87207)

Fixes #86186.

14 months agoTweak assert in AsyncTaskMethodBuilder (#87215)
Stephen Toub [Wed, 7 Jun 2023 19:43:49 +0000 (15:43 -0400)]
Tweak assert in AsyncTaskMethodBuilder (#87215)

14 months agoAdd timestamps to XUnitLogChecker output (#86737)
Mark Plesko [Wed, 7 Jun 2023 18:08:59 +0000 (11:08 -0700)]
Add timestamps to XUnitLogChecker output (#86737)

* Add timestamps to XUnitLogChecker output

* format

* Handle $ strings

* Combine two Writes into one

14 months agoFix handling of CreateScalarUnsafe for embedded broadcast (#87134)
Tanner Gooding [Wed, 7 Jun 2023 18:05:27 +0000 (11:05 -0700)]
Fix handling of CreateScalarUnsafe for embedded broadcast (#87134)

* Adding a regression test for dotnet/runtime#87116

* Ensure IsContainableHWIntrinsicOp takes into account whether CreateScalarUnsafe is coming from memory for embedded broadcast

14 months ago[wasm] Add workaround `NuGet-Migrations` issue for a missed case (#87041)
Ankit Jain [Wed, 7 Jun 2023 15:37:38 +0000 (11:37 -0400)]
[wasm] Add workaround `NuGet-Migrations` issue for a missed case (#87041)

One case was missed in the earlier attempt at this, which caused some of
the tests in wasm runtime tests to not get the workaround script.

One such example - `JIT.PGO`

The other cases had:
```sh
export WasmTestAppArgs="$WasmTestAppArgs --exclusion-list=TestExclusionList.txt"
chmod +x ./RunTests.sh
(CONSOLE_TEMP_DIR="$(mktemp -d)" ; "$DOTNET_ROOT/dotnet" new console -o "$CONSOLE_TEMP_DIR" ; rm -rf "$CONSOLE_TEMP_DIR") || true
./RunTests.sh
```

.. and the broken one has:

```sh
dotnet $CORE_ROOT/xunit/xunit.console.dll profiler/unittest/profiler.unittest.XUnitWrapper.dll -parallel collections -nocolor -noshadow -xml testResults.xml -trait TestGroup=profiler.unittest
```

.. no workaround with `dotnet new ..`.

14 months agoMove the CreateCastingConverter<T>() method to the base JsonConverter type. (#87211)
Eirik Tsarpalis [Wed, 7 Jun 2023 14:16:19 +0000 (15:16 +0100)]
Move the CreateCastingConverter<T>() method to the base JsonConverter type. (#87211)

14 months agoMake LocalizedApp test stop requiring UTF8 output encoding (#87176)
Elinor Fung [Wed, 7 Jun 2023 14:09:21 +0000 (07:09 -0700)]
Make LocalizedApp test stop requiring UTF8 output encoding (#87176)

14 months agoSet ApiCompatIgnoreTargetPlatformMoniker for packable projects (#87212)
Viktor Hofer [Wed, 7 Jun 2023 13:41:42 +0000 (15:41 +0200)]
Set ApiCompatIgnoreTargetPlatformMoniker for packable projects (#87212)

Follow-up change on a bugfix/feature in APICompat: https://github.com/dotnet/sdk/commit/b8c07fee1b150d46e5c4229cf1f0d81da20393a5

14 months agoAdd back fixed xunit decimal, IntPtr and UIntPtr commented test cases (#87084)
João Nuno Mota [Wed, 7 Jun 2023 12:43:16 +0000 (13:43 +0100)]
Add back fixed xunit decimal, IntPtr and UIntPtr commented test cases (#87084)

14 months agoDisable S.T.Json tests on NativeAOT (#87203)
Michal Strehovský [Wed, 7 Jun 2023 08:31:22 +0000 (17:31 +0900)]
Disable S.T.Json tests on NativeAOT (#87203)

We're getting OOM-killed in the CI. See #87078.

I'm also changing how we do warning suppressions. We still need to suppress most of AOT warnings because xUnit/tests are not warning clean, but the warning about generic recursion is critical for the product and should fail the build.

14 months ago[wasm] Disable System.Text.Json/AOT tests (#87157)
Ankit Jain [Wed, 7 Jun 2023 03:48:32 +0000 (23:48 -0400)]
[wasm] Disable System.Text.Json/AOT tests (#87157)

- this was disabled earlier from highresource_aot builds, but that had a
  side-effect of enabling them for regular aot builds.

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

14 months agoJIT: Clean up BB successor iteration (#86839)
Jakob Botsch Nielsen [Tue, 6 Jun 2023 17:17:50 +0000 (19:17 +0200)]
JIT: Clean up BB successor iteration (#86839)

* Remove old code
* Use visitor with an array as part of AllSuccessorEnumerator

14 months agoCleanup scripts for PGO cleanup (dotnet/performance#3067). (#87163)
Jiri Cincura ↹ [Tue, 6 Jun 2023 16:54:54 +0000 (18:54 +0200)]
Cleanup scripts for PGO cleanup (dotnet/performance#3067). (#87163)

14 months agoFix creating cultures with extensions in the name (#87114)
Tarek Mahmoud Sayed [Tue, 6 Jun 2023 16:05:41 +0000 (09:05 -0700)]
Fix creating cultures with extensions in the name (#87114)

14 months agoEnable EventPipe support in MacOS (#86766)
Lakshan Fernando [Tue, 6 Jun 2023 15:27:56 +0000 (08:27 -0700)]
Enable EventPipe support in MacOS (#86766)

* Enable EventPipe support in MacOS

* Fix FreeBSD build break

* FB

14 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 219474...
dotnet bot [Tue, 6 Jun 2023 15:27:33 +0000 (08:27 -0700)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2194745 (#87168)

14 months ago[fabricbot] Do not add needs-further-triage to issues still marked as untriaged ...
Jeff Handley [Tue, 6 Jun 2023 15:15:13 +0000 (08:15 -0700)]
[fabricbot] Do not add needs-further-triage to issues still marked as untriaged (#87160)

14 months agoupdate QuicConnection.ConnectAsync exceptions (#87048)
Tomas Weinfurt [Tue, 6 Jun 2023 15:02:23 +0000 (17:02 +0200)]
update QuicConnection.ConnectAsync exceptions (#87048)

* update QuicConnection.ConnectAsync exceptions

* feedback from review

14 months agoReenabled k-nucleotide-9 test. (#87058)
Jan Dupej [Tue, 6 Jun 2023 10:58:48 +0000 (12:58 +0200)]
Reenabled k-nucleotide-9 test. (#87058)

14 months agoUpdate area-owners.json to reflect change in area-owners.md (#87144)
Jeff Handley [Tue, 6 Jun 2023 08:14:04 +0000 (01:14 -0700)]
Update area-owners.json to reflect change in area-owners.md (#87144)

14 months ago[RISC-V][JIT] Fix arithmetics (#86996)
Dong-Heon Jung [Tue, 6 Jun 2023 08:10:04 +0000 (17:10 +0900)]
[RISC-V][JIT] Fix arithmetics (#86996)

* [RISC-V][JIT] Fix multiplication instruction

* [RISC-V][JIT] Fix a test failure

- value_numbering_checked_arithmetic_with_constants_ro

14 months ago[wasm][debugger] Disable failing multithreading debugger tests (#86501)
Ilona Tomkowicz [Tue, 6 Jun 2023 03:59:43 +0000 (05:59 +0200)]
[wasm][debugger] Disable failing multithreading debugger tests (#86501)

* Block for multithreading.

* Another failing test.

* category - case matters.

* Cleanup.

* "Result reported for unknown test case" fix. Cannot be lazy.

* Debugger has its own treading feature discovery.

* Prevent trait filter from being overwritten.

* Applied @radical's review, reverted `TEST_FILTER` removal with changes fixing the issue.

* Makefiles - full revert, fix should be in msbuild.

* Failing frequently.

* Fleaky tests.

* Now this one failed - block.

* 10 min still timeouts, set to 15.

* Revert "10 min still timeouts, set to 15."

This reverts commit 2e008d40b3006e464f3c70030e0de637d17dc426.

14 months ago[fabricbot] Area pods: Exclude arch- and os- issues/prs with owners (#87040)
Jeff Handley [Tue, 6 Jun 2023 03:38:59 +0000 (20:38 -0700)]
[fabricbot] Area pods: Exclude arch- and os- issues/prs with owners (#87040)

* [fabricbot] Area pods: Exclude arch- and os- issues/prs with owners

* Do not exclude arch-wasm from the michael/tanner pod

14 months ago[wasm] Perf blazor scenarios: Use the correct wasm sdk pack (#87075)
Ankit Jain [Tue, 6 Jun 2023 02:35:39 +0000 (22:35 -0400)]
[wasm] Perf blazor scenarios: Use the correct wasm sdk pack (#87075)

- Make the built nuget for wasm sdk pack available when running the
  blazor scenarios.

```
/home/helixbot/work/B975098B/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.Client/BlazingPizza.Client.csproj
: warning NU1603: BlazingPizza.Client depends on Microsoft.NET.Sdk.WebAssembly.Pack (>= 8.0.0-ci) but Microsoft.NET.Sdk.WebAssembly.Pack 8.0.0-ci was not found. An approximate best match of Microsoft.NET.Sdk.WebAssembly.Pack 8.0.0-preview.4.23213.11 was resolved.
```

.. otherwise it resolves to an older package from the published sources.

14 months agoSuperpmi collection for real-world benchmarks (#87104)
Kunal Pathak [Tue, 6 Jun 2023 02:01:19 +0000 (19:01 -0700)]
Superpmi collection for real-world benchmarks (#87104)

* add support to collect spmi for real-world

* rename some script names

* Do not pass partition_index for non-microbenchmarks

* fix the project names

* fix physics engine benchmarks:

* adjust physics benchmarks:

14 months agoFix IDE0001 / IDE0002 (simplify names) in corelib (#87106)
Stephen Toub [Mon, 5 Jun 2023 22:09:45 +0000 (18:09 -0400)]
Fix IDE0001 / IDE0002 (simplify names) in corelib (#87106)

14 months agoAllow the user to control the MaxVectorTBitWidth (#85551)
Tanner Gooding [Mon, 5 Jun 2023 21:58:28 +0000 (14:58 -0700)]
Allow the user to control the MaxVectorTBitWidth (#85551)

* Expose DOTNET_MaxVectorTBitWidth and an undocumented DOTNET_PreferredVectorBitWidth

* Ensure SPMI keeps a getMaxVectorTBitWidth implementation

* Fix the non-xarch vm build

* Remove getMaxVectorTBitWidth from the JIT/EE interface, it's no longer needed

* Move SetCpuInfo down into the EEJitManager constructor

* Remove getXarchCpuInfo in favor of passing `JIT_FLAG_VECTOR512_THROTTLING`

* Make sure CORINFO_XARCH_CPU is fully removed

* Have ENCODE_VERIFY_TYPE_LAYOUT not fail-fast for Vector<T> size differences

* Only encode types containing Vector<T> as check, not verify

* Remove changes that were extracted to separate PRs

* Ensure that the optimistic flags are a strict superset of the supported flags

* Make VectorT128/256/512 proper instruction sets and only allow one to be active at a time

* Don't allow avxvnni to be "optimistic" since that brings in avx2

* Ensure we handle HWIntrinsics being disabled

* Ensure that the Vector<T> size ISAs are covered by FromInstructionSet

* Ensure that `getMaxVectorByteLength` being 0 is handled

* Ensure NAOT startup can correctly check for the VectorT size bits

* Have BlkOpKindUnroll account for SIMD being disabled

* Ensure InstructionSet_VectorT128 is set in the fallback path for PAL_GetJitCpuCapabilityFlags

14 months agoFix a number of accessibility resolution issues in the source generator. (#87136)
Eirik Tsarpalis [Mon, 5 Jun 2023 21:41:49 +0000 (22:41 +0100)]
Fix a number of accessibility resolution issues in the source generator. (#87136)

14 months agoDocumentation for the HotColdMap section (#87023)
Andrew Au [Mon, 5 Jun 2023 20:45:51 +0000 (13:45 -0700)]
Documentation for the HotColdMap section (#87023)

14 months ago[nativeaot][tests] Update bundle zip path for NativeAOT sample app (#87049)
Milos Kotlar [Mon, 5 Jun 2023 20:43:21 +0000 (22:43 +0200)]
[nativeaot][tests] Update bundle zip path for NativeAOT sample app (#87049)

* Update bundle zip path for NativeAOT sample app

* Add shared path for Mono and Native AOT

14 months agoDisable mark list optimization if we hit a per region mark list overflow (#86508)
Andrew Au [Mon, 5 Jun 2023 18:46:17 +0000 (11:46 -0700)]
Disable mark list optimization if we hit a per region mark list overflow (#86508)

14 months agoTest passing struct on a border of 12bit offset (#86914)
t-mustafin [Mon, 5 Jun 2023 18:44:49 +0000 (21:44 +0300)]
Test passing struct on a border of 12bit offset (#86914)

14 months agoRemove unnecessary suppressions in APICompat files (#87094)
Viktor Hofer [Mon, 5 Jun 2023 16:58:50 +0000 (18:58 +0200)]
Remove unnecessary suppressions in APICompat files (#87094)

* Remove unnecessary suppressions in APICompat files

- Remove unnecessary suppressions in APICompat files. This is in
  preparation for https://github.com/dotnet/sdk/pull/32964 which will
  validate the existing suppressions going forward.
- Set the required APICompat properties for the future tooling support.

* Add suppressions back for two CoreLib flavors

* Fix CoreLib suppression because of API attribute difference

14 months agoSet .env variables in corerun prior to CLR init (#85220)
Lumi Bytyçi [Mon, 5 Jun 2023 16:27:01 +0000 (18:27 +0200)]
Set .env variables in corerun prior to CLR init (#85220)

14 months agoFold obj.GetType to a constant (#87101)
Egor Bogatov [Mon, 5 Jun 2023 15:58:21 +0000 (17:58 +0200)]
Fold obj.GetType to a constant (#87101)

14 months ago[VM] Fix potential double free (#86207)
Trung Nguyen [Mon, 5 Jun 2023 14:39:48 +0000 (00:39 +1000)]
[VM] Fix potential double free (#86207)

Use a raw char `NewArrayHolder` instead of a `NewHolder` to store
the `StackingAllocator` to prevent its destructor from being
called twice since `StackingAllocatorHolder` has already taken
care of the destruction.

14 months agoAvoid bloom filter checks for IndexOfAnyExcept in ProbabilisticMap (#85203)
Miha Zupan [Mon, 5 Jun 2023 14:07:12 +0000 (16:07 +0200)]
Avoid bloom filter checks for IndexOfAnyExcept in ProbabilisticMap (#85203)

14 months ago[browser][non-icu] `HybridGlobalization` set flag in SDK (#85245)
Ilona Tomkowicz [Mon, 5 Jun 2023 14:02:32 +0000 (16:02 +0200)]
[browser][non-icu] `HybridGlobalization` set flag in SDK (#85245)

* Initial change.

* Filename update.

* WBT for WASM.

* Updated docs.

* Run Hybrid wbt on CI.

* Feedback + hierarchy compatible with #86255.

* Feedback. Test program code to assets.

14 months agoEnsure JsonSerializerOptions always returns a JsonTypeInfo for `object`. (#87093)
Eirik Tsarpalis [Mon, 5 Jun 2023 13:21:45 +0000 (14:21 +0100)]
Ensure JsonSerializerOptions always returns a JsonTypeInfo for `object`. (#87093)

* Ensure JsonSerializerOptions always returns a JsonTypeInfo for `object`.

* Address feedback.

14 months agofix(76268): Fix invalid behavior for ignored properties with "new" modifier of derive...
Maksim Golev [Mon, 5 Jun 2023 12:12:39 +0000 (15:12 +0300)]
fix(76268): Fix invalid behavior for ignored properties with "new" modifier of derived class. (#84756)

Co-authored-by: Maksim Golev <mgolev@htc-cs.ru>
14 months ago[main] Update dependencies from dotnet/arcade dotnet/sdk (#87091)
dotnet-maestro[bot] [Mon, 5 Jun 2023 11:49:54 +0000 (07:49 -0400)]
[main] Update dependencies from dotnet/arcade dotnet/sdk (#87091)

* Update dependencies from https://github.com/dotnet/arcade build 20230602.3

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23281.3 -> To Version 8.0.0-beta.23302.3

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

Microsoft.DotNet.ApiCompat.Task
 From Version 8.0.100-preview.6.23302.2 -> To Version 8.0.100-preview.6.23302.9

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

Microsoft.DotNet.ApiCompat.Task
 From Version 8.0.100-preview.6.23302.2 -> To Version 8.0.100-preview.6.23303.2

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months ago[main] Update dependencies from dnceng/internal/dotnet-optimization (#87090)
dotnet-maestro[bot] [Mon, 5 Jun 2023 11:48:52 +0000 (07:48 -0400)]
[main] Update dependencies from dnceng/internal/dotnet-optimization (#87090)

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

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

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

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

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months agoFix a few Parse uses to be TryParse (#87105)
Stephen Toub [Mon, 5 Jun 2023 11:48:10 +0000 (07:48 -0400)]
Fix a few Parse uses to be TryParse (#87105)