platform/upstream/dotnet/runtime.git
17 months agoUpdate version of Microsoft.DotNet.ApiCompat.Task (#81772)
Viktor Hofer [Wed, 8 Feb 2023 10:48:55 +0000 (11:48 +0100)]
Update version of Microsoft.DotNet.ApiCompat.Task (#81772)

* Update version of Microsoft.DotNet.ApiCompat.Task

* Update Version.Details.xml

17 months agoSPMI: Warn when comparing throughput of JITs compiled with native PGO (#81716)
Jakob Botsch Nielsen [Wed, 8 Feb 2023 10:39:03 +0000 (11:39 +0100)]
SPMI: Warn when comparing throughput of JITs compiled with native PGO (#81716)

Fix #81690

17 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 210773...
dotnet bot [Wed, 8 Feb 2023 08:07:32 +0000 (00:07 -0800)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2107735 (#81700)

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

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

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

17 months agoFix handling of the generic byreflike constraint (#81684)
Michal Strehovský [Wed, 8 Feb 2023 06:34:39 +0000 (15:34 +0900)]
Fix handling of the generic byreflike constraint (#81684)

Some support for NativeAOT was written in #67783 but the test didn't actually pass because of these missing pieces.

17 months ago[wasm] Pin the version of chrome used for tests - `109.0.5414.119` (#81814)
Ankit Jain [Wed, 8 Feb 2023 06:12:15 +0000 (01:12 -0500)]
[wasm] Pin the version of chrome used for tests - `109.0.5414.119` (#81814)

* [wasm] Pin the version of chrome used for tests

Related: https://github.com/dotnet/runtime/issues/81792

The debugger tests are breaking with the latest stable chrome version
`110.0.5481.77`. As a temporary workaround to keep the CI green, pin the
version to the previous working one.

* fix windows url

17 months ago[mono][aot] Optimize constrained calls made from gsharedvt methods. (#79339)
Zoltan Varga [Wed, 8 Feb 2023 04:01:29 +0000 (23:01 -0500)]
[mono][aot] Optimize constrained calls made from gsharedvt methods. (#79339)

The calls are of the form:
.constrained T_GSHAREDVT
callvirt <method>

Whenever T_GSHAREDVT is a reference or value type is only known at runtime.

Previously these were handled by passing the arguments to a JIT icall which
computed the target method and did a runtime invoke.

Added 2 optimizations:
* Precompute the data which depends only on the type and the method,
  store it in an rgctx slot and pass it to the JIT icall.
* Add a fastpath for simpler cases which makes an indirect call
  from generated code.

17 months agoAdd an optimized C implementation of STFLD_O that uses the correct kind of write...
Katelyn Gadd [Wed, 8 Feb 2023 03:54:38 +0000 (19:54 -0800)]
Add an optimized C implementation of STFLD_O that uses the correct kind of write barrier (#81806)

This PR moves most of the jiterpreter's STFLD_O implementation into a C function that is responsible for also doing the null check. As a bonus that function is able to use the correct kind of write barrier (though it's not clear to me whether the previous one was broken in any way).

17 months ago[main] Update dependencies from dotnet/cecil (#81756)
dotnet-maestro[bot] [Wed, 8 Feb 2023 01:43:43 +0000 (17:43 -0800)]
[main] Update dependencies from dotnet/cecil (#81756)

* Update dependencies from https://github.com/dotnet/cecil build 20230206.4

Microsoft.DotNet.Cecil
 From Version 0.11.4-alpha.23080.1 -> To Version 0.11.4-alpha.23106.4

* Remove Microsoft.DotNet.Cecil.Pdb from being referenced since it now is part of Microsoft.DotNet.Cecil package

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Tlakollo <tlcejava@microsoft.com>
17 months agoPrevent unwinding through stack bottom (#81770)
Jan Vorlicek [Wed, 8 Feb 2023 00:47:32 +0000 (01:47 +0100)]
Prevent unwinding through stack bottom (#81770)

When processing unhandled exception on the most recent Alpine 3.17,
the libunwind doesn't stop at the bottom
frame of the main thread (the caller of `main`) and tries to unwind
further. The reason is that the method is missing dwarf unwind
information, so the libunwind falls back to using RBP chain, but the RBP
points to a garbage and so it ends up crashing with SIGSEGV.

While the missing DWARF unwind info seems to be a bug in the Alpine 3.17
(older ones work fine), we can prevent issues like this by stopping at
the hosting API boundary and not trying to unwind past that. This is
what this PR does.

17 months ago[Jiterpreter] Add support for TryGetHashCode intrinsic (#81644)
Austin Wise [Tue, 7 Feb 2023 23:50:01 +0000 (15:50 -0800)]
[Jiterpreter] Add support for TryGetHashCode intrinsic (#81644)

#80520 added support in the Jiterpreter for the intrinsic that underlies RuntimeHelpers.GetHashCode. This PR adds similar support for the intrinsic that underlies RuntimeHelpers.TryGetHashCode.

For reference RuntimeHelpers.TryGetHashCode was added in #80059. It is currently only used in ConditionalWeakTable.TryGetValue.

17 months agoBaseline most of the Pri0 test suite (#81685)
Michal Strehovský [Tue, 7 Feb 2023 23:48:09 +0000 (08:48 +0900)]
Baseline most of the Pri0 test suite (#81685)

I made a pass over all Pri0 tests except the JIT directory.

17 months agoRevert "Fix generic parameter data flow validation in NativeAOT (#81532)" (#81783)
Vitek Karas [Tue, 7 Feb 2023 23:23:05 +0000 (15:23 -0800)]
Revert "Fix generic parameter data flow validation in NativeAOT (#81532)" (#81783)

This reverts commit e71a4fb10d7ea6b502dd5efe7a8fcefa2b9c1550.

17 months agoFix condition for module registration export (#81765)
Adeel Mujahid [Tue, 7 Feb 2023 23:14:12 +0000 (01:14 +0200)]
Fix condition for module registration export (#81765)

* FIx condition for module registration export

* Typo

17 months agoFix two compilation constants for .NET 8 (#81775)
Stephen Toub [Tue, 7 Feb 2023 22:47:28 +0000 (17:47 -0500)]
Fix two compilation constants for .NET 8 (#81775)

17 months agoEnableAotAnalyzer for System.Diagnostics.EventLog (#81724)
Eric Erhardt [Tue, 7 Feb 2023 22:28:15 +0000 (16:28 -0600)]
EnableAotAnalyzer for System.Diagnostics.EventLog (#81724)

* EnableAotAnalyzer for System.Diagnostics.EventLog

Contributes to #75480

* EnableAotAnalyzer for System.Diagnostics.PerformanceCounters

* Avoid boxing T.

17 months agoFix EncodingExtensions.Convert for sliced single segment ROSequence (#81665)
devsko [Tue, 7 Feb 2023 21:39:47 +0000 (22:39 +0100)]
Fix EncodingExtensions.Convert for sliced single segment ROSequence (#81665)

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

17 months agoUse MiniDumpWriteDump to create dumps on Windows (#81509)
Jeremy Koritzinsky [Tue, 7 Feb 2023 21:19:13 +0000 (13:19 -0800)]
Use MiniDumpWriteDump to create dumps on Windows (#81509)

17 months agoImprove CI path-changes-based-triggers to work better (#79127)
Ankit Jain [Tue, 7 Feb 2023 20:49:22 +0000 (15:49 -0500)]
Improve CI path-changes-based-triggers to work better (#79127)

 ## Background:

`eng/pipelines/common/evaluate-default-paths.yml` is used to specify named subsets of paths, and `evaluate-changed-paths.sh` decides which subsets have "changed files". And these subsets are used in conditions for the various jobs to determine when they should be run.

---
`evaluate-changed-paths.sh: Add support for include+exclude combined`

 ## Problem

This script currently supports `--include`, and `--exclude`
parameters to determine if we have any changed paths.

```
Scenarios:
1. exclude paths are specified
    Will include all paths except the ones in the exclude list.
2. include paths are specified
    Will only include paths specified in the list.
1st we evaluate changes for all paths except ones in excluded list. If we can not find
any applicable changes like that, then we evaluate changes for included paths
if any of these two finds changes, then a variable will be set to true.
```

As described above, these two are evaluated exclusively.
For example:

```
include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
```

- This would return true if there are changes:
  - `[ '/a/b/c.txt' ]` - caught by `include`
  - or `[ '/r/s.txt' ]` - caught by `exclude`

- but it would also return true for `[ '/a/b/d.txt' ]` because `include`
does not consider the `exclude` list.

 ## Solution:

- This commit adds a new `--combined` parameter which essentially supports
`$include - $exclude`. Thus allowing exact more constrained path
specification.

- It is passed in addition to `include`, and `exclude`.

Given:
```
include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
```

- For the following path changes:
  - `[ '/a/b/c.txt' ]` - `true`
  - `[ '/r/s.txt' ]` - `false` because this does not fall in
    `$include - $exclude`
  - `[ '/a/b/d.txt' ]` - `false` - excluded in `$include - $exclude`

The implementation is trivially implemented by passing both the lists to
`git diff` which supports this already.

---

- Track subset name changes in the ymls
- Update `wasm` jobs to have tighter trigger conditions

- This results in wasm specific changes only triggering relevant wasm jobs. For example, if there are wasm debugger changes then only the wasm debugger jobs will be triggered. Or if there are only workload manifest[1] changes then Wasm.Build.Tests will be triggered only.

17 months ago[wasm][debug] Avoid pausing on breakpoint while invoking methods. (#81162)
Thays Grazia [Tue, 7 Feb 2023 20:17:02 +0000 (17:17 -0300)]
[wasm][debug] Avoid pausing on breakpoint while invoking methods. (#81162)

* Trying to avoid pausing on breakpoint while invoking methods.

* Adding test case for it as discussed with @radical offline.

* Creating new tests and fixing its behavior.

* Addressing @radical comments offline.

* same behavior for stepping, disable global_stepping while evaluating expression.

* Renaming function as suggested by @radical

17 months agolibnuma-dev (#81764)
Marie Píchová [Tue, 7 Feb 2023 19:52:36 +0000 (20:52 +0100)]
libnuma-dev (#81764)

Fix #81706

17 months ago[wasm][debugger] Skip generated wrappers when trying to step into/out with JustMyCode...
Thays Grazia [Tue, 7 Feb 2023 19:48:36 +0000 (16:48 -0300)]
[wasm][debugger] Skip generated wrappers when trying to step into/out with JustMyCode enabled (#81715)

* Skip generated wrappers when trying to step.

* Changing to use  System.Diagnostics.DebuggerNonUserCode

17 months ago[main] Update dependencies from dotnet/icu dotnet/xharness dotnet/runtime-assets...
dotnet-maestro[bot] [Tue, 7 Feb 2023 19:10:39 +0000 (13:10 -0600)]
[main] Update dependencies from dotnet/icu dotnet/xharness dotnet/runtime-assets dotnet/emsdk dotnet/msquic dotnet/hotreload-utils (#81755)

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.2.23103.1 -> To Version 8.0.0-preview.2.23106.1

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

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

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

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.Formats.Tar.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 8.0.0-beta.23103.1 -> To Version 8.0.0-beta.23107.1

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

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100-preview.2
 From Version 8.0.0-preview.2.23081.3 -> To Version 8.0.0-preview.2.23107.1

* Update dependencies from https://github.com/dotnet/msquic build 20230206.6

System.Net.MsQuic.Transport
 From Version 7.0.0-alpha.1.22406.1 -> To Version 8.0.0-alpha.1.23106.6

* Update dependencies from https://github.com/dotnet/hotreload-utils build 20230207.1

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.1.0-alpha.0.23080.1 -> To Version 1.1.0-alpha.0.23107.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoPGO: Reduce number of block counters (#81731)
Egor Bogatov [Tue, 7 Feb 2023 18:36:14 +0000 (19:36 +0100)]
PGO: Reduce number of block counters (#81731)

17 months agoEnable AppleAppBuilder to bundle iOS applications built for NativeAOT runtime (#81711)
Ivan Povazan [Tue, 7 Feb 2023 18:14:50 +0000 (19:14 +0100)]
Enable AppleAppBuilder to bundle iOS applications built for NativeAOT runtime (#81711)

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

17 months agoupdate owner for are:System.Transactions (#81640)
Hong Li [Tue, 7 Feb 2023 17:41:35 +0000 (09:41 -0800)]
update owner for are:System.Transactions (#81640)

17 months agoHarden and re-enable DualMode socket tests (#80715)
Anton Firszov [Tue, 7 Feb 2023 17:28:13 +0000 (18:28 +0100)]
Harden and re-enable DualMode socket tests (#80715)

- UDP tests are moved to a non-parallel collection, since there is no way to prevent parallel UDP tests from intercepting each other's packets. This only increases the execution time by ~2 seconds.
- TCP interferences are prevented by a utility PortBlocker, which creates and binds a "shadow" socket of the opposite address family to prevent sockets in parallel tests to bind to the same port.
- Accept and SendTo tests are refactored to use SocketTestHelperBase<T>, reducing duplicate code.

17 months agoAdd support for SP800-108 CTR Key Derivation Function
Kevin Jones [Tue, 7 Feb 2023 17:25:31 +0000 (12:25 -0500)]
Add support for SP800-108 CTR Key Derivation Function

This introduces a class for producing values per the "KDF in Counter Mode" section in NIST Special Publication 800-108r1 (Recommendation for Key Derivation Using Pseudorandom Functions).

The `SP800108HmacCounterKdf` class is part of the inbox cryptography library on .NET 8.  Based on demonstrated need for older TFMs, the type is also being exposed via a NuGet package: Microsoft.Bcl.Cryptography.  This package may, in the future, contain other types that belong as part of inbox cryptography but have a demonstrated need to be available to older TFMs.

17 months agoFix a bug around Vector4.Distance and Sse41.Insert lowering (#81725)
Tanner Gooding [Tue, 7 Feb 2023 15:56:56 +0000 (07:56 -0800)]
Fix a bug around Vector4.Distance and Sse41.Insert lowering (#81725)

* Adding a regression test for dotnet/runtime#81585

* Fixing a bug around Sse41.Insert lowering

* Ensure that Distance/DistanceSquared are correctly imported

* Account for another case around Sse41.Insert chain folding

17 months agoMove all of the ref-pack generators to use the "LatestVS" Roslyn build so they don...
Jeremy Koritzinsky [Tue, 7 Feb 2023 13:12:06 +0000 (05:12 -0800)]
Move all of the ref-pack generators to use the "LatestVS" Roslyn build so they don't pull in prebuilts in source-build (#81561)

17 months agoFix warnings found with new analyzer CA1860: Prefer Length/Count/IsEmpty property...
Buyaa Namnan [Tue, 7 Feb 2023 12:59:20 +0000 (04:59 -0800)]
Fix warnings found with new analyzer CA1860: Prefer Length/Count/IsEmpty property check over Any() (#81583)

Co-authored-by: Marek Safar <marek.safar@gmail.com>
17 months agoFix generic parameter data flow validation in NativeAOT (#81532)
Vitek Karas [Tue, 7 Feb 2023 09:07:33 +0000 (01:07 -0800)]
Fix generic parameter data flow validation in NativeAOT (#81532)

[This is a revert of a revert of #80956 with additional fixes for #81358)

This reworks how generic parameter data flow validation is done in the NativeAOT compiler.

Previously generic data flow was done from generic dictionary nodes. Problem with that approach is that there's no origin information at that point. The warnings can't point to the place where the problematic instantiation is in the code - we only know that it exists.
Aside from it being unfriendly for the users, it means any RUC or suppressions don't work on these warnings the same way they do in linker/analyzer.

This change modifies the logic to tag the method as "needs data flow" whenever we spot an instantiation of an annotated generic in it somewhere.
Then the actual validation/marking is done from data flow using the trim analysis patterns.

The only exception to this is generic data flow for base types and interface implementations, that one is done on the EEType nodes.

Note that AOT implements a much more precise version of the generic data flow validation as compared to linker/analyzer. See the big comment at the beginning of `GenericParameterWarningLocation.cs` for how that works.

Due to an issue with DependencyInjection, this change also implements a behavior where if a method or field is reflection accessible, the compiler will perform generic argument data flow on all types in the signature of the method/field (which it normally wouldn't do). See #81358 for details about the issue and discussions on the fix approach.

Test changes:
Adds the two tests from linker which cover this functionality.

Change the test infra to use token to compare message origins for expected warnings. Consistently converting generic types/methods into strings across two type systems is just very difficult - the tokens are simple and reliable.

Changes the tests to avoid expecting specific generic types/methods formatting in the messages - again, it's too hard to make this consistent without lot of effort. And the tests don't really need it.

Adds a smoke test which has a simplified version of the DI problem from https://github.com/dotnet/runtime/issues/81358.

17 months ago[main] Update dependencies from 7 repositories (#81536)
dotnet-maestro[bot] [Tue, 7 Feb 2023 08:22:47 +0000 (09:22 +0100)]
[main] Update dependencies from 7 repositories (#81536)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Marek Safar <marek.safar@gmail.com>
Co-authored-by: tlakollo <tlakaelel_axayakatl@outlook.com>
Co-authored-by: Buyaa Namnan <bunamnan@microsoft.com>
17 months agoAdd a simple size test (#81517)
Michal Strehovský [Tue, 7 Feb 2023 02:48:42 +0000 (11:48 +0900)]
Add a simple size test (#81517)

The size of Hello World is currently 1.8 MB. This is achieved by avoiding any non-field reflection in the codepaths that are part of a hello world. If reflection comes into picture, the size jumps by several 100 kB because suddenly we need a lot of code to support that. This is a smoke test to detect those situations. We're getting proper size testing in the dotnet/performance repo with trend histories, etc., but the invariant for Hello World is easy to check for and nice to gate commits on.

17 months agoAvoid using `file` in generated regexes pre-C# 11 (#81726)
Stephen Toub [Tue, 7 Feb 2023 01:28:31 +0000 (20:28 -0500)]
Avoid using `file` in generated regexes pre-C# 11 (#81726)

17 months ago[wasm] Migrate jiterpreter hit counting to C (#81729)
Katelyn Gadd [Tue, 7 Feb 2023 01:09:47 +0000 (17:09 -0800)]
[wasm] Migrate jiterpreter hit counting to C (#81729)

* Move jiterpreter trace hit counting to C for better performance

17 months agoFix contract violations. (#81727)
Aaron Robinson [Tue, 7 Feb 2023 00:22:33 +0000 (16:22 -0800)]
Fix contract violations. (#81727)

Removes GC_TRIGGERS contract for functions that
do not trigger a GC. The removed contract definition
appears to be out of date.

Fallout from #81571

17 months agoMatch ILScanner with CorInfoImpl (#81683)
Michal Strehovský [Tue, 7 Feb 2023 00:03:30 +0000 (09:03 +0900)]
Match ILScanner with CorInfoImpl (#81683)

ILScanner and the JitInterface have to be in sync wrt exceptions throw or there are problems. Fixes one of the Pri0 tests.

17 months agoJIT: rename flowList to FlowEdge and encapsulate all fields (#81621)
Andy Ayers [Tue, 7 Feb 2023 00:00:07 +0000 (16:00 -0800)]
JIT: rename flowList to FlowEdge and encapsulate all fields (#81621)

Restructure this type in anticipation of modifying how it represents data.
Rename some of the fields (and now related accessor methods) because subsequent
changes may do things like add the target block or successor edge links.

Also, remove some stray references to fgComputePreds

17 months agoAdjust workaround for event source resource stripping (#81528)
Michal Strehovský [Mon, 6 Feb 2023 23:54:55 +0000 (08:54 +0900)]
Adjust workaround for event source resource stripping (#81528)

The used approach only worked in debug builds. `InlineableStringResource` is not one of the nodes that survives from scanning phase to compilation phase. Make the compiler think `GetResourceString` was reflected on instead.

17 months agoRun nativeaot tests in helix (#81439)
Sven Boemer [Mon, 6 Feb 2023 22:49:12 +0000 (14:49 -0800)]
Run nativeaot tests in helix (#81439)

This changes the existing NativeAot smoke test runs to run in
helix. The multi-module test run (only supported on windows)
now runs only in the checked configuration, to avoid
having to add a separate windows build script invocation inside
one of the yaml templates.

17 months agoFix order of parameters in exception message formatter. (#81718)
Eirik Tsarpalis [Mon, 6 Feb 2023 22:25:44 +0000 (22:25 +0000)]
Fix order of parameters in exception message formatter. (#81718)

17 months agoUpdate icu version and uncomment wasi icu libc (#81694)
Meri Khamoyan [Mon, 6 Feb 2023 21:02:07 +0000 (01:02 +0400)]
Update icu version and uncomment wasi icu libc (#81694)

Fix #81560

17 months ago[wasm][debugger]Adding stack info to the exception details when evaluating expression...
Thays Grazia [Mon, 6 Feb 2023 20:52:52 +0000 (17:52 -0300)]
[wasm][debugger]Adding stack info to the exception details when evaluating expressions (#81440)

* Adding stack info to the exception details when evaluating expressions.

* passing only one parameter.

* Fixing CI.

* Fixing format.

* Added a new test: Evaluate on a callframe different of the first and check if the callstack is correct.
And fix it.

* Addressing @radical comments.

* addressing @radical comments.

17 months agoSimplify language version check in Regex generator (#81678)
Youssef Victor [Mon, 6 Feb 2023 20:23:54 +0000 (22:23 +0200)]
Simplify language version check in Regex generator (#81678)

* Simplify language version check in Regex generator

* Fix build

17 months ago[wasm] jiterpreter cleanup and performance improvements (#81707)
Katelyn Gadd [Mon, 6 Feb 2023 20:18:35 +0000 (12:18 -0800)]
[wasm] jiterpreter cleanup and performance improvements (#81707)

* Improves the jiterpreter's code gen performance slightly by removing some redundant work from the compilation hot path and moving it to one-time initialization instead.
* Split the jiterpreter trace generation code into its own file
* Stop using opname.startsWith in trace generation
* Minor logging cleanup
* Remove dead code

17 months agoEnableAotAnalyzer by default for src libraries (#81608)
Eric Erhardt [Mon, 6 Feb 2023 19:43:45 +0000 (13:43 -0600)]
EnableAotAnalyzer by default for src libraries (#81608)

* EnableAotAnalyzer by default for src libraries

This flips the default of EnableAotAnalyzer to true so all new libraries are analyzed by default. It also allows us to easily see which libraries haven't been annotated yet.

I also fixed the warnings in 2 libraries that were really quick: System.Memory.Data and System.ComponentModel.TypeConverter.

Contributes to #75480

17 months agoprevent use of null when processing alpn list (#81629)
Tomas Weinfurt [Mon, 6 Feb 2023 19:32:59 +0000 (11:32 -0800)]
prevent use of null when processing alpn list (#81629)

17 months agoSplit Mono manifest creation into a separate subset (#81598)
Jo Shields [Mon, 6 Feb 2023 19:26:55 +0000 (14:26 -0500)]
Split Mono manifest creation into a separate subset (#81598)

* Split manifest building from mono-packages.proj into a standalone subset, in order to fix up #80920 so building manifests works when the runtime is CoreCLR (as is typically the case on source-build)

17 months agoLSG: removing unnecessary null forgiven operators and refactor other minor nullabilit...
Allan Targino [Mon, 6 Feb 2023 18:50:50 +0000 (15:50 -0300)]
LSG: removing unnecessary null forgiven operators and refactor other minor nullability issues (#81662)

17 months ago[Mono] Enable AOT to print out the list of compiled methods (#81567)
Fan Yang [Mon, 6 Feb 2023 18:38:07 +0000 (13:38 -0500)]
[Mono] Enable AOT to print out the list of compiled methods (#81567)

* Initial setup

* Exclude generics and update variable names

* Review feedbacks and error handling

17 months agoSPMI: Display TP diffs as a range in the header (#81661)
Jakob Botsch Nielsen [Mon, 6 Feb 2023 18:37:53 +0000 (19:37 +0100)]
SPMI: Display TP diffs as a range in the header (#81661)

The current approach of averaging all collections does not make sense.

17 months agoUse initialCapacity in ASN.1 templates for default int/bool
Kevin Jones [Mon, 6 Feb 2023 18:07:54 +0000 (13:07 -0500)]
Use initialCapacity in ASN.1 templates for default int/bool

17 months ago[wasi] Support builds with no relinking (#81648)
Ankit Jain [Mon, 6 Feb 2023 18:04:51 +0000 (13:04 -0500)]
[wasi] Support builds with no relinking (#81648)

* [wasi] support builds with no relinking

* wasi: update main() to work for no relinking

* wasi: fix command line for tests

* Bring back the workaround for xharness, as the fix hasn't been merged in runtime yet

* [wasi] Ignore test failures for runtime, and runtime-extra-platforms pipelineso

.. as the wasi library tests are unstable right now, and would block
mainline work.

- But when run as part of a wasm specific pipeline like `runtime-wasm`,
  then don't ignore the test failures

17 months agoDelete leftover reflection eventsource handling (#81686)
Michal Strehovský [Mon, 6 Feb 2023 17:22:27 +0000 (02:22 +0900)]
Delete leftover reflection eventsource handling (#81686)

This is annotated in the CoreLib now.

17 months agoFix handling of postponed messages in TargetCore (#81011)
Stephen Toub [Mon, 6 Feb 2023 16:57:06 +0000 (11:57 -0500)]
Fix handling of postponed messages in TargetCore (#81011)

The TargetCore type represents the bulk of the logic used in dataflow blocks for receiving messages pushed to it.  If a block is bounded and the block reaches its bound, subsequent pushes to the block may be postponed, and then when room is available, that TargetCore implementation needs to try to consume messages it previously postponed.  That's handled by the TryConsumePostponedMessage method.

Inside this method, it pops an element from its postponed messages queue.  The first time it does so, it does two or three things, depending on the reason the method is being called.  It optimistically increments the bounding count, meaning the number of items it claims to hold, under the assumption it's going to successfully consume a previously postponed message and thus have one more message to count against the established bound.  It also optimistically assigns the next available message ID, again assuming it'll successfully consume one.  And if the method is being called in order to transfer a postponed message into its input queue (as opposed to processing it immediately), it also tracks that a transfer is in process (in order to then prevent other incoming messages from concurrently going straight into the input messages and violating ordering).

Those optimistically changed values need to be undone if the assumption fails.  If, for example, we fail to consume any message, we need to decrement the bounding count and note that a transfer is no longer in progress.  We also need to burn the message ID that was assigned, in particular if there's a reordering buffer: that reordering buffer may have been waiting for that particular ID in order to release messages it's already stored with higher IDs, and it needs to be told that ID will never arrive.

We had two bugs here:
1. When we decremented the outstanding transfers counter, we were doing so without holding the appropriate lock.  That could lead to, for example, losing one of the decrements and ending up in a situation where all future messages are forced to be postponed.
2. We were only correctly tracking transfers for the first postponed message we'd try to consume.  If there were multiple, we'd end up tracking the first but then not tracking subsequent ones in that batch, leading to other messages arriving concurrently potentially ending up out of order.
3. When this method was being called not for postponement, we might end up not burning the message ID with the reordering buffer.  That would result in the reordering buffer not releasing any more messages, and could do so without incurring any exceptions or other indication of data loss.

17 months agoWrap exceptions in reflection virtual method resolution (#81682)
Michal Strehovský [Mon, 6 Feb 2023 16:55:51 +0000 (01:55 +0900)]
Wrap exceptions in reflection virtual method resolution (#81682)

* Wrap exceptions in reflection virtual method resolution

Fixes the reflection\DefaultInterfaceMethods\InvokeConsumer.cs test that expects EntryPointNotFound to be wrapped.

* Update VirtualMethodInvoker.cs

17 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 210567...
dotnet bot [Mon, 6 Feb 2023 14:51:54 +0000 (06:51 -0800)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2105677 (#81359)

17 months ago[mono][interp] Align simd types to 16 bytes by default (#81219)
Vlad Brezae [Mon, 6 Feb 2023 14:23:37 +0000 (16:23 +0200)]
[mono][interp] Align simd types to 16 bytes by default (#81219)

* [mono][interp] Remove unused method

* [mono][interp] Optimize code just in case

* [mono][interp] Align simd types to 16 bytes by default

All interp vars (args, il locals and other allocated vars) are now aligned to 16 byte offsets.

* [mono][interp] Add svar arg to MINT_NEWOBJ_SLOW_UNOPT

Assumption that return offset is identical to location of param offset for this opcode is no longer true. Set the param_offset explicitly, separate from the return, similar to #81017

* [mono][interp] Disable assertion on hot path

* [mono][interp] Remove some duplicate code

17 months agoNativeAOT Fully implements warning suppressions logic (#81266)
Vitek Karas [Mon, 6 Feb 2023 12:35:23 +0000 (04:35 -0800)]
NativeAOT Fully implements warning suppressions logic (#81266)

Ports the warning suppression logic from linker. The only unsupported feature is reading the suppressions from attribute XML. This also doesn't port the "redundant suppression detection" logic from linker.

Other changes:
* Extracts some helpers for attribute handling into CustomAttributeExtensions (mostly around properties and events)
* Implements equality and hashcode on property and event descriptors - so that they can be used as keys in a dictionary
* Implements passing along the "--singlewarn" command line option in the test infra.

Also ports over all of the warning suppression tests from linker:
* Modified all of the "redundant suppressions" tests to be "trimmer-only" as that feature is only implemented there.
* Removed the "suppressions from XML" tests

Per discussion with @MichalStrehovsky I will rename `PropertyPseudoDesc` and `EventPseudoDesc` to `EcmaProperty` and `EcmaEvent`. But I'll do that in a separate PR as it would add a lot of noise to this one.

17 months agoOptimize IND<SIMD>(RVA) (#81651)
Egor Bogatov [Mon, 6 Feb 2023 11:23:26 +0000 (12:23 +0100)]
Optimize IND<SIMD>(RVA) (#81651)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
17 months agoAdjust impNormStructVal to not wrap in GT_OBJ (#81636)
Tanner Gooding [Mon, 6 Feb 2023 04:11:28 +0000 (20:11 -0800)]
Adjust impNormStructVal to not wrap in GT_OBJ (#81636)

* Adjust impNormStructVal to not wrap in GT_OBJ

* Ensure UpdateEarlyRefCount handles CALL(LCL_VAR)

17 months agoJIT: fix issue with partial comp pred list maintenance (#81605)
Andy Ayers [Mon, 6 Feb 2023 02:52:08 +0000 (18:52 -0800)]
JIT: fix issue with partial comp pred list maintenance (#81605)

We may have degenerate flow out of a partial compilation block, so make
sure to fully remove the block from all successor pred lists.

Fixes issue seen in #80635.

17 months ago[NativeAOT] correctly initalize CONTEXT before failing fast (#81010)
Austin Wise [Mon, 6 Feb 2023 02:51:48 +0000 (18:51 -0800)]
[NativeAOT] correctly initalize CONTEXT before failing fast (#81010)

* [NativeAOT] correctly initalize CONTEXT before failing fast

* Switch from using GetThreadContext to RtlCaptureContext.

* Add a better explination of why the function is unimplmented on Unix.

* Update src/coreclr/nativeaot/Runtime/PalRedhawk.h

Co-authored-by: Vladimir Sadov <vsadov@microsoft.com>
* Respond to feedback: unconditionally set CONTEXT_CONTROL

* Respond to feedback: consolidate setting of ContextFlags.

* On second thought, don't add a second layer of ifdef nesting.

---------

Co-authored-by: Vladimir Sadov <vsadov@microsoft.com>
17 months agoFix spmi jit flag dumper for new flag (#81667)
Andy Ayers [Mon, 6 Feb 2023 02:51:12 +0000 (18:51 -0800)]
Fix spmi jit flag dumper for new flag (#81667)

Also remove SIMD flag (didn't cause build breaks because it was specified
by value, not name).

17 months ago[wasm] CI: add wasi jobs to runtime-wasm (#81647)
Ankit Jain [Mon, 6 Feb 2023 02:31:22 +0000 (21:31 -0500)]
[wasm] CI: add wasi jobs to runtime-wasm (#81647)

- And run all the library tests with wasi, on optional pipeline

17 months agoSet UseLLVMLinker=true when targeting FreeBSD by default (#81642)
Szczepan Ćwikliński [Mon, 6 Feb 2023 02:18:55 +0000 (03:18 +0100)]
Set UseLLVMLinker=true when targeting FreeBSD by default (#81642)

17 months agoSuppress unobserved task exceptions for channel Completion tasks (#81652)
Stephen Toub [Sun, 5 Feb 2023 23:24:06 +0000 (18:24 -0500)]
Suppress unobserved task exceptions for channel Completion tasks (#81652)

17 months agodiagnostic to detect malformed format strings in lsg template message (#81503)
Allan Targino [Sun, 5 Feb 2023 19:19:43 +0000 (16:19 -0300)]
diagnostic to detect malformed format strings in lsg template message (#81503)

fix https://github.com/dotnet/runtime/issues/52226

17 months agoVectorize Guid.ToString (#81650)
Egor Bogatov [Sun, 5 Feb 2023 18:55:37 +0000 (19:55 +0100)]
Vectorize Guid.ToString (#81650)

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
17 months agoSPMI: Fix SpmiRecordsHelper::RestoreCORINFO_RUNTIME_LOOKUP (#81657)
Jakob Botsch Nielsen [Sun, 5 Feb 2023 16:54:05 +0000 (17:54 +0100)]
SPMI: Fix SpmiRecordsHelper::RestoreCORINFO_RUNTIME_LOOKUP (#81657)

Fix #81637

17 months ago[wasm] wasi: Enable library tests on CI (#81052)
Ankit Jain [Sat, 4 Feb 2023 22:21:07 +0000 (17:21 -0500)]
[wasm] wasi: Enable library tests on CI (#81052)

17 months agoUse MemoryExtensions.Count in a few places (#81325)
Stephen Toub [Sat, 4 Feb 2023 22:12:39 +0000 (17:12 -0500)]
Use MemoryExtensions.Count in a few places (#81325)

* Use MemoryExtensions.Count in a few places

* Update src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.cs

17 months agoUpstream a few changes from the NativeAOT-LLVM branch (#81616)
SingleAccretion [Sat, 4 Feb 2023 20:14:26 +0000 (23:14 +0300)]
Upstream a few changes from the NativeAOT-LLVM branch (#81616)

* Use pointer type for generic context

...in the shadow method signature for the special unboxing thunks.

The shadow method acts as an alias to the instance method
it represents and so must have the exact same signature.

* Support direct pointers in VSD cells

* Add INTERFACE_DISPATCH_CACHE_HAS_CELL_BACKPOINTER

17 months agoSuppress clang-16 warnings (#81573)
Adeel Mujahid [Sat, 4 Feb 2023 20:08:12 +0000 (22:08 +0200)]
Suppress clang-16 warnings (#81573)

* Suppress clang-16 warnings

* Remove a strange (one-of-a-kind) workaround

* Add thunk for PAL_{Unr,R}egisterModule

17 months ago[wasm] Jiterpreter field op refactorings; fixes #81558 (#81620)
Katelyn Gadd [Sat, 4 Feb 2023 11:37:33 +0000 (03:37 -0800)]
[wasm] Jiterpreter field op refactorings; fixes #81558 (#81620)

* Refactor jiterpreter field op implementation into separate static and nonstatic field implementations
* Add more diagnostic infrastructure
* fixes issue #81558 (dictionary.findvalue bug)

17 months agoPromote Tier0 methods with loops to InstrumentedTier0 (#81051)
Egor Bogatov [Sat, 4 Feb 2023 08:57:42 +0000 (09:57 +0100)]
Promote Tier0 methods with loops to InstrumentedTier0 (#81051)

17 months agoPrep for new diagnostic work and tests (#81571)
Aaron Robinson [Sat, 4 Feb 2023 06:42:31 +0000 (22:42 -0800)]
Prep for new diagnostic work and tests (#81571)

* Fix asserts fired during diag testing

* EnC flag is now applied to MethodDesc instead of
Instantiated MethodDesc.

* Renamed ambiguous method and updated some logging.

17 months agoFix -Wformat violations (#81618)
Adeel Mujahid [Sat, 4 Feb 2023 06:09:39 +0000 (08:09 +0200)]
Fix -Wformat violations (#81618)

17 months agoGenerate StandardOptimizationData uncompressed (#81623)
Juan Hoyos [Sat, 4 Feb 2023 04:58:40 +0000 (20:58 -0800)]
Generate StandardOptimizationData uncompressed (#81623)

17 months agoMake FrozenHashTable non-generic (#81603)
Stephen Toub [Sat, 4 Feb 2023 03:18:53 +0000 (22:18 -0500)]
Make FrozenHashTable non-generic (#81603)

With some tweaks to how it's defined, we can avoid making it generic at all, which helps to reduce native aot compilation size when ToFrozenDictionary/Set is used with multiple generic instantiations.

17 months agoSystem.DirectoryServices.Protocols.LdapConnection has wrong argument check (#78459...
Geert van Horrik [Fri, 3 Feb 2023 23:23:05 +0000 (00:23 +0100)]
System.DirectoryServices.Protocols.LdapConnection has wrong argument check (#78459) (#80636)

* #78459 System.DirectoryServices.Protocols.LdapConnection has wrong argument check for anonymous authentication

* Add unit tests for ldap-anonymous-auth-fix

17 months agoRespect HostApplicationBuilderSettings.Args when DisableDefaults=true (#81568)
Eric Erhardt [Fri, 3 Feb 2023 22:29:12 +0000 (16:29 -0600)]
Respect HostApplicationBuilderSettings.Args when DisableDefaults=true (#81568)

If the Args was specified, always add it to the Configuration.

Fix #81445

17 months agoUpdate the assert to correctly check if a tree with value has non-zero destination...
Kunal Pathak [Fri, 3 Feb 2023 19:50:38 +0000 (11:50 -0800)]
Update the assert to correctly check if a tree with value has non-zero destination registers (#81412)

* Fix the assert

* add test cases

* Remove the unused node

* Revert "Remove the unused node"

This reverts commit 32a8c9c598925133592cb2093cda95c989cc278b.

* fix the test case

* fix the arm64 and arm cases too

17 months agoFix OOM edge case in interleaved LoaderHeap (#81602)
Jan Vorlicek [Fri, 3 Feb 2023 19:20:55 +0000 (20:20 +0100)]
Fix OOM edge case in interleaved LoaderHeap (#81602)

When the `CommitPages` in `GetMoreCommittedPages` fails, which can
happen due to OOM, the `m_pPtrToEndOfCommittedRegion` was already
updated from the end of the code page to the end of the data page.
So if another allocation request comes to the heap, we think there is
one extra page of space left and end up allocating region that crosses
the code / data page boundary. And later we crash when initializing
precodes that were allocated by this request.

This issue was discovered by a Roslyn CI test that loaded assemblies
into non-collectible AssemblyLoadContext instances and ended up jitting
so many methods that the maximum number of mappings on Linux (65535 by
default) got exceeded and mmap failed.

This change fixes it by moving the `m_pPtrToEndOfCommittedRegion` only
in the success case.

17 months agopal_ssl: include missing code for non-portable OpenSSL 3.0 build. (#81596)
Tom Deseyn [Fri, 3 Feb 2023 19:11:22 +0000 (20:11 +0100)]
pal_ssl: include missing code for non-portable OpenSSL 3.0 build. (#81596)

17 months agoJIT: revise checking for computed preds (#81582)
Andy Ayers [Fri, 3 Feb 2023 16:47:55 +0000 (08:47 -0800)]
JIT: revise checking for computed preds (#81582)

Since pred lists now exist pervasively, change most methods that had
conditional pred list updates to assert preds exist and always update.

To make sure I got all uses, I renamed `fgComputePredsDone` to
`fgPredsComputed`.

Remove the ability to drop EH, as it doesn't update pred lists properly
and so has been broken for quite a while now.

Remove some of the logic for fixing up finally targets, since we now
always have pred lists around and so don't need the blanket invaliation.

Closes #80193.

17 months agoRemove AggressiveInlining from XxHash3 and XxHash128 HashLength0To16 (#81565)
Egor Bogatov [Fri, 3 Feb 2023 16:02:34 +0000 (17:02 +0100)]
Remove AggressiveInlining from XxHash3 and XxHash128 HashLength0To16 (#81565)

17 months agoUse eager evaluation when configuring the JsonTypeInfo type graph. (#81576)
Eirik Tsarpalis [Fri, 3 Feb 2023 15:45:30 +0000 (15:45 +0000)]
Use eager evaluation when configuring the JsonTypeInfo type graph. (#81576)

* Use eager evaluation when configuring the JsonTypeInfo type graph.

* Use enums to model JsonTypeInfo configuration state.

17 months agoRemove JsonMetadataServices dependency from DeserializeAsyncEnumerable (#81579)
Eirik Tsarpalis [Fri, 3 Feb 2023 15:42:32 +0000 (15:42 +0000)]
Remove JsonMetadataServices dependency from DeserializeAsyncEnumerable (#81579)

17 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230202.4 (#81591)
dotnet-maestro[bot] [Fri, 3 Feb 2023 15:35:07 +0000 (16:35 +0100)]
Update dependencies from https://github.com/dotnet/arcade build 20230202.4 (#81591)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoSupport targeting iOS platforms with ILCompiler (#81476)
Ivan Povazan [Fri, 3 Feb 2023 08:13:11 +0000 (09:13 +0100)]
Support targeting iOS platforms with ILCompiler (#81476)

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

17 months agoDo not print stack trace if error reading crashReportJsonFile (#81467)
Kunal Pathak [Fri, 3 Feb 2023 05:30:07 +0000 (21:30 -0800)]
Do not print stack trace if error reading crashReportJsonFile (#81467)

17 months agoDo not expect quic to work on single file deployments (#81581)
Michal Strehovský [Fri, 3 Feb 2023 04:23:17 +0000 (13:23 +0900)]
Do not expect quic to work on single file deployments (#81581)

This new test is breaking runtime-extra-platforms CI legs.

17 months ago[wasm] Implement more opcodes in the jiterpreter (#81575)
Katelyn Gadd [Fri, 3 Feb 2023 02:46:32 +0000 (18:46 -0800)]
[wasm] Implement more opcodes in the jiterpreter (#81575)

* Implement the new add_mul_imm interpreter opcodes
* Implement MINT_LDFTN and MINT_INTRINS_ENUM_HASFLAG
* Implement MINT_ARRAY_RANK

17 months agoJIT: remove cheap preds (#81562)
Andy Ayers [Fri, 3 Feb 2023 02:28:20 +0000 (18:28 -0800)]
JIT: remove cheap preds (#81562)

We no longer need cheap preds. We always have full preds available.

Also, remove the ability to drop and recompute full preds, as we now compute
full preds incrementally while building the flow graph, and never drop or need
to rebuild them.

Contributes to #80193.

17 months agoCI: Update darc dependency to track emsdk manifest name change (#81556)
Ankit Jain [Fri, 3 Feb 2023 01:33:16 +0000 (20:33 -0500)]
CI: Update darc dependency to track emsdk manifest name change (#81556)

17 months agoAllow inlining for ldsfld + value-type (#78736)
Egor Bogatov [Thu, 2 Feb 2023 22:11:15 +0000 (23:11 +0100)]
Allow inlining for ldsfld + value-type (#78736)

17 months agoJIT: build pred lists when we first build the flow graph (#81524)
Andy Ayers [Thu, 2 Feb 2023 20:11:01 +0000 (12:11 -0800)]
JIT: build pred lists when we first build the flow graph (#81524)

This is the last in a (long) series. We now build the pred lists at the same
time we are initially connecting up the flow graph. Pred lists are now always
valid and need to be maintained by all phases.

There are some changes needed in EH normalization, and one special case we
need to handle in debug codegen where we create the scratch BB very early on.
This was the last client for the cheap pred lists.

Note some of the pred list info can't be added right away, in particular
the "return" edges from finallies do not appear until we've made it through
the importer.

I have deferred cleaning up dead code; will do it in follow-up changes.

Contributes to #80193.

17 months ago[wasm] Allow users to control behavior of undefined symbols (#80495)
Marek Fišera [Thu, 2 Feb 2023 19:55:31 +0000 (20:55 +0100)]
[wasm] Allow users to control behavior of undefined symbols (#80495)

17 months ago[mono][ios] Introduce non-global symbol stripping in MonoAOTCompiler msbuild task...
Milos Kotlar [Thu, 2 Feb 2023 19:03:17 +0000 (20:03 +0100)]
[mono][ios] Introduce non-global symbol stripping in MonoAOTCompiler msbuild task (#81361)

* Add non-global symbol stripping in AppleAppBuilder task.

* Strip symbols when measuring SOD via build-appbundle make target