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

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

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

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

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

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

* Disable hanging RE test

* feedback

* Oops

* Apply suggestions from code review

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

---------

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

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

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

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

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

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

Thanks

Tomas

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

* Upgrading Shuffle()

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

* Review Changes

* Another review fix.

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

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

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

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

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

Fix #87393

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

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

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

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

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

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

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

Remove unused usings and simplify access to CodeAnalysis.Location.

Cache the attributes searched for in incremental stub calculations.

Add warning if unsafe blocks are not allowed.

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

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

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

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

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

Fixes #87139

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

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

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

This replaces the syntax-based logic with:

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

- IOperation-based logic that looks at invocations

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

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

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

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

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

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

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

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

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

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

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

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

* Add HelloiOS sample on iossimulator

* Enable AOT compilation and JustInterp mode on iossimulator

* Remove custom tasks from the sample app

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

---------

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

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

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

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

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

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

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

* [RISC-V] Fix JUMP block size

* [RISC-V] Update constant values

* [RISC-V] Fix decodeJump

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

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

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

- `isJump` and `isBackToBackJump`

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

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

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

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

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

Fix register saving before passing generic instantiation parameter.

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

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

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

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

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

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

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

Also deletes the --inherit-timestamp logic.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #86410

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

Not needed after build is complete when PostBuildSign != true

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

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

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

Related #87275

15 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.

15 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)

15 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.

15 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)

15 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.

15 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

15 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

15 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)

15 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>
15 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]

```

15 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

15 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

15 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)

15 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>
15 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

15 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)

15 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)

15 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.

15 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.

15 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)

15 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)

15 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

15 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

15 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>
15 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>
15 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)

15 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.

15 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)

15 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.

15 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".

15 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)

15 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

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

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

15 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>
15 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.

15 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

15 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)

15 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.

15 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.

15 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

15 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

15 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

15 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.

15 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