platform/upstream/dotnet/runtime.git
2 years agoAdd a cleanup job to backport workflow (#68596)
Adeel Mujahid [Fri, 6 May 2022 14:32:30 +0000 (17:32 +0300)]
Add a cleanup job to backport workflow (#68596)

* Add a cleanup job to backport workflow

* Add once a day schedule

* Pass GH token to the job

2 years agoDisabled k-nucleotide test on mono. (#68910)
Nathan Ricci [Fri, 6 May 2022 12:54:42 +0000 (08:54 -0400)]
Disabled k-nucleotide test on mono. (#68910)

2 years agoPhysical value numbering (#68712)
SingleAccretion [Fri, 6 May 2022 10:55:42 +0000 (13:55 +0300)]
Physical value numbering (#68712)

Value numbering supports precise numbering of field accesses using "maps":
where each access is modeled as a selection: "map[indices...]". It has been
the case until this change that said indices were always "precise" - VNs
of field handles.

This system has proven to be problematic for representing struct field access:

 1) The precise model effectively means that each field access represented
    by a unique handle cannot alias access to the same location, but using
    a different handle. This meant that reinterpretation of structs, reasonably
    common both in user code and in the IR compiler creates itself, was UB.
 2) The precise model for struct fields entailed supporting "zero-offset
    field sequences", which were maintained in a side map and caused a good
    number of bugs.

This change solves both of these problems by eliminating the need to use
precise selectors for struct fields, introducing a new kind of selector
(and maps to go with it): "the physical selector": offset plus load/store
size, with "VNForMapSelectWork" enhanced to look through physical store
maps, correctly detecting aliasing.

The precise selection rules are maintained for the maps indexing off of the
heap, where we don't have the same aliasing concerns. Physical maps are now
used exclusively for numbering locals.

This change seeks to preserve previous behavior to avoid diffs: many places
with now-not-needed pessimization are marked with "TODO-PhysicalVN". Similarly,
the field sequence infrastructure supporting the old precise selection scheme
is retained in its full generality. Future changes are expected to remove much
of it.

2 years agoFix double-validation in BoundedChannelOptions (#68938)
Armin Shoeibi [Fri, 6 May 2022 09:54:58 +0000 (14:24 +0430)]
Fix double-validation in BoundedChannelOptions (#68938)

2 years agoFix Regex handling of control characters (#68944)
Stephen Toub [Fri, 6 May 2022 09:54:43 +0000 (05:54 -0400)]
Fix Regex handling of control characters (#68944)

It was using the C category rather than Cc category.  And the test for this was missing the combined categories.

2 years agoRevert "Disable win-arm64 runtime tests on PRs for CoreCLR (#68627)" (#68922)
Jakob Botsch Nielsen [Fri, 6 May 2022 08:43:51 +0000 (10:43 +0200)]
Revert "Disable win-arm64 runtime tests on PRs for CoreCLR (#68627)" (#68922)

Testing capacity is back to a point where we have been told we can try
reenabling our workloads.

2 years agoImprove impPopCallArgs (#68736)
Jakob Botsch Nielsen [Fri, 6 May 2022 08:15:32 +0000 (10:15 +0200)]
Improve impPopCallArgs (#68736)

2 years agoAdd Mac ARM64 coverage to runtime-dev-innerloop (#68886)
Andy Gocke [Fri, 6 May 2022 03:13:45 +0000 (20:13 -0700)]
Add Mac ARM64 coverage to runtime-dev-innerloop (#68886)

* Add Mac ARM64 coverage to runtime-dev-innerloop

* Include global-build.yml

* Remove excludes entirely

2 years agoRevert "[QUIC] Adopted msquic generated interop (#68288)" (#68940)
Jan Kotas [Fri, 6 May 2022 02:20:52 +0000 (19:20 -0700)]
Revert "[QUIC] Adopted msquic generated interop (#68288)" (#68940)

This reverts commit 992b395a72d161bb2346258a726fb93b10f0d7e7.

2 years agoFix System.Collections.Immutable version in ILCompiler.Build.Tasks (#68935)
Logan Bussell [Fri, 6 May 2022 02:18:27 +0000 (19:18 -0700)]
Fix System.Collections.Immutable version in ILCompiler.Build.Tasks (#68935)

* Fix System.Collections.Immutable version in ILCompiler

* Add SystemCollectionsImmutableVersion to Versions.props

2 years agoRename CoreRT to NativeAOT (1/N) (#68888)
Jan Kotas [Fri, 6 May 2022 01:14:28 +0000 (18:14 -0700)]
Rename CoreRT to NativeAOT (1/N) (#68888)

Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
2 years agoEnable dumping of R2R manifest metadata from ildasm (#68920)
David Wrighton [Fri, 6 May 2022 00:42:43 +0000 (17:42 -0700)]
Enable dumping of R2R manifest metadata from ildasm (#68920)

Use the /r2rnativemetadata switch to dump the data. NOTE: this switch is only to be used on non-composite images. composite images can be read using the normal ildasm commands.

2 years agoUpdate ApiCompat to exclude UnsupportedOSPlatform["freebsd"] on Lock/Unlock (#68941)
David Cantú [Fri, 6 May 2022 00:35:37 +0000 (17:35 -0700)]
Update ApiCompat to exclude UnsupportedOSPlatform["freebsd"] on Lock/Unlock (#68941)

2 years agoSystem.Diagnostics.ActivityLink/ActivityEvent: Implement EnumerateTagObjects API...
Mikel Blanchard [Fri, 6 May 2022 00:23:03 +0000 (17:23 -0700)]
System.Diagnostics.ActivityLink/ActivityEvent: Implement EnumerateTagObjects API (#68933)

2 years agoRevert FileSystemEventArgs/RenamedEventArgs FullPath/OldFullPath changes (#68883)
Jeff Handley [Thu, 5 May 2022 23:54:08 +0000 (16:54 -0700)]
Revert FileSystemEventArgs/RenamedEventArgs FullPath/OldFullPath changes (#68883)

* Revert daec9dc (PR #68582)

* Revert 2a1b15d (PR #63051)

* Restore additional tests adapted to match prior behavior

* Remove unnecessary PathInternal inclusion

* PR feedback

* Fix unix tests (copy/paste error)

2 years agoUse more char.Is helpers from RegexCompiler / source generator (#68924)
Stephen Toub [Thu, 5 May 2022 21:52:52 +0000 (17:52 -0400)]
Use more char.Is helpers from RegexCompiler / source generator (#68924)

This PR causes regex to now specially-recognize additional categories that map to sets `char` already has `IsXx` methods for and call them, e.g. `char.IsControl`, `char.IsLetter`, etc.

2 years agoDetect the default locale name during startup on Apple platforms (#68706)
Steve Pfister [Thu, 5 May 2022 21:13:36 +0000 (17:13 -0400)]
Detect the default locale name during startup on Apple platforms (#68706)

This change adds a function to lookup the current NSLocale and extract the language + country code to load into ICU by default. Previously, we would defer to uloc_getDefault in ICU, which would return a value we would ignore (en_US_POSIX) and result in falling back to invariant mode.

Fixes #68321

2 years agoDo not fold relocatable constants into displacements (#68851)
SingleAccretion [Thu, 5 May 2022 19:32:17 +0000 (22:32 +0300)]
Do not fold relocatable constants into displacements (#68851)

The code in "genCreateAddrMode" was performing the equivalent of constant
folding ADDs, but failing to take into account the legality of doing that.

2 years agoFix VSTest and dotnet test broken on .NETFramework (#68863)
Viktor Hofer [Thu, 5 May 2022 19:27:04 +0000 (21:27 +0200)]
Fix VSTest and dotnet test broken on .NETFramework (#68863)

* Fix VSTest and dotnet test broken on .NETFramework

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

For a detailed explanation why updating the xunit.runner.visualstudio fixes .NETFramework dotnet test and VSTest invocation please see the above linked issue.

2 years agoMark FileStream.Lock(Int64, Int64) as unsupported on FreeBSD (#68908)
Tarun047 [Thu, 5 May 2022 18:55:54 +0000 (00:25 +0530)]
Mark FileStream.Lock(Int64, Int64) as unsupported on FreeBSD (#68908)

2 years agoadd RID for Alpine 3.16 (#68505)
Tomas Weinfurt [Thu, 5 May 2022 17:56:13 +0000 (10:56 -0700)]
add RID for Alpine 3.16 (#68505)

2 years agoTweak Regex comparison to improve subsequent bounds check removals (#68846)
Stephen Toub [Thu, 5 May 2022 17:23:06 +0000 (13:23 -0400)]
Tweak Regex comparison to improve subsequent bounds check removals (#68846)

* Tweak Regex comparison to improve subsequent bounds check removals

* Address PR feedback

2 years agoAnnotating System.Text.Json library for aot form factor (#68464)
Lakshan Fernando [Thu, 5 May 2022 16:01:04 +0000 (09:01 -0700)]
Annotating System.Text.Json library for aot form factor (#68464)

* Annotating System.Text.Json library for aot form factor

* FB

* FB2

* FB3

* FB4

* Move annatation to class level where relevant with the fixed analyzer

* using consistent terminology in the annotation

* FB minus the suppression change

* reverting to pre-converter annotation status

2 years agoAdd test for multiple calls of QuicConnection.CloseAsync (#68893)
Radek Zikmund [Thu, 5 May 2022 15:40:01 +0000 (08:40 -0700)]
Add test for multiple calls of QuicConnection.CloseAsync (#68893)

* Add test for multiple calls of QuicConnection.CloseAsync

* Add test case for server as well

2 years agoFix a few more API compat inconsistencies (#68834)
Eric StJohn [Thu, 5 May 2022 15:34:20 +0000 (08:34 -0700)]
Fix a few more API compat inconsistencies (#68834)

2 years agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 175367...
dotnet bot [Thu, 5 May 2022 13:04:22 +0000 (06:04 -0700)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 1753679 (#68870)

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

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

2 years ago[wasm][debugger] Refactor of getProperties mechanism (#68486)
Ilona Tomkowicz [Thu, 5 May 2022 13:01:55 +0000 (15:01 +0200)]
[wasm][debugger] Refactor of getProperties mechanism (#68486)

* Merge main with @radical's refactoring.

* Fixed most tests.

* Added more Browsable tests: null + valuetype.

* Fixed trailing spaces and exposed the test.

* Fixed all GetPropertiesTests.

* Fixing RunOnCFOValueTypeResult.

* Fixed cloning to be deep.

* Reverted comments in test.

* Fixed browsable root hidden tests.

* Extended Browsable tests with a structure.

* Fixed TestSetValueOnObject.

* Add class testcase to browsable root hidden.

* All existing tests are passing.

* Cleanup, removing unused code.

* Added Browsable tests for nonstatic structures.

* Removed unnecessary comment.

* Removed whitespaces.

* Blocked tests failing/timeouting on Firefox.

2 years agoUse Docker images from mcr.microsoft.com in EnterpriseTests (#68875)
Alexander Köplinger [Thu, 5 May 2022 12:58:19 +0000 (14:58 +0200)]
Use Docker images from mcr.microsoft.com in EnterpriseTests (#68875)

We started getting warnings in the build about using images from docker directly, see https://docs.opensource.microsoft.com/tools/nuget_security_analysis/container_registry_analysis/

The image from dotnet-buildtools-prereqs-docker can be used instead.

2 years agoReplace invalid sourcegen debug assertion with runtime check (#68828)
Eirik Tsarpalis [Thu, 5 May 2022 11:08:19 +0000 (14:08 +0300)]
Replace invalid sourcegen debug assertion with runtime check (#68828)

* Replace AttributeConstructor null assertion with runtime exception

* Remove redundand Json.NET package references

* Revert "Remove redundand Json.NET package references"

This reverts commit 5247c1f98313410fc8cff399670f9595155cef9c.

2 years ago[QUIC] Adopted msquic generated interop (#68288)
Marie Píchová [Thu, 5 May 2022 10:32:25 +0000 (12:32 +0200)]
[QUIC] Adopted msquic generated interop (#68288)

* MsQuicApi adjusted

* QuicParamHelper adjusted

* MsQuicConfiguration adjusted

* Added MsQuicException

* MsQuicConnection adjusted

* MsQuicListener adjusted

* MsQuicStream adjusted

* It compiles!

* Some test fixes

* Fixed stream read event handling

* Re-enabled IPv6 tests

* latest greatest

* Update src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicListener.cs

* MsQuic interop enum names

* 3rd Party notice, version check

* SafeHandleType

* Replaced AlpnHelpers with MsQuicBuffers generic QUIC_BUFFER* helper

* Sealed exception class

* Feedback MsQuicBuffers

* NativeMemory use

* Newest msquic interop

* Buffers feedback

* Remove MemoryHandle pooling

* Buffers feedback

* Logging feedback

2 years agoFixed the yp_spin_count_unit to be a factor of the original_spin_count_unit rather...
Mukund Raghav Sharma [Thu, 5 May 2022 09:28:29 +0000 (02:28 -0700)]
Fixed the yp_spin_count_unit to be a factor of the original_spin_count_unit rather than a continually increasing value (#68879)

* Fixed the yp_spin_count_unit to be a factor of the original_spin_count_unit rather than a continually increasing value

* Added upper bounds on the spin count

* Fixed the type of the unit spin counts

2 years agoImproving the 64-bit number formatting to better match the 32-bit algorithm (#68795)
Tanner Gooding [Thu, 5 May 2022 02:36:12 +0000 (19:36 -0700)]
Improving the 64-bit number formatting to better match the 32-bit algorithm (#68795)

* Improving the 64-bit number formatting to better match the 32-bit algorithm

* Fixing a uint cast that should've been a ulong cast

* Ensure digits: 0 is properly passed through

2 years agoUpdate message for unsupported char marshalling (#68865)
Elinor Fung [Thu, 5 May 2022 02:13:51 +0000 (19:13 -0700)]
Update message for unsupported char marshalling (#68865)

2 years agoAdd a four-element AsyncLocalValueMap type (#68790)
Stephen Toub [Thu, 5 May 2022 01:11:18 +0000 (21:11 -0400)]
Add a four-element AsyncLocalValueMap type (#68790)

* Add a four-element AsyncLocalValueMap type

We previously special-cased up to three active AsyncLocals in a given async flow, but it seems four is also very common.  Special-casing four as well results in four using ~20% less allocation and ~10% less CPU overhead.

* Fix downgrading to FourElementAsyncLocalValueMap, and clean up source

2 years agoStop escaping ' and " in generated regex XML comments (#68856)
Stephen Toub [Thu, 5 May 2022 00:13:02 +0000 (20:13 -0400)]
Stop escaping ' and " in generated regex XML comments (#68856)

2 years agoMove `CustomTypeMarshaller` APIs to `System.Runtime.InteropServices.Marshalling`...
Elinor Fung [Thu, 5 May 2022 00:11:47 +0000 (17:11 -0700)]
Move `CustomTypeMarshaller` APIs to `System.Runtime.InteropServices.Marshalling` (#68842)

2 years agoDelete stale IgnoreCaseRelation regex tests (#68857)
Stephen Toub [Thu, 5 May 2022 00:09:31 +0000 (20:09 -0400)]
Delete stale IgnoreCaseRelation regex tests (#68857)

These are from when NonBacktracking maintained its own hardcoded set of IgnoreCase-related tables.  Those no longer exist, making these tests defunct.

2 years agoFix singlefile on OSX ARM64 (#68845)
Vladimir Sadov [Wed, 4 May 2022 21:51:31 +0000 (14:51 -0700)]
Fix singlefile on OSX ARM64 (#68845)

* Same alignment in the bundle on OSX as on Linux

* Extra VA gap between section in casse we run from sf bundle

* Rename prevSectionEnd -> prevSectionEndAligned and make it aligned.

* Suppress assert for now on OSX

2 years agoReenable 4244 (#68615)
Aaron Robinson [Wed, 4 May 2022 20:53:32 +0000 (16:53 -0400)]
Reenable 4244 (#68615)

* Remove disable of 4244 in root compiler settings.

2 years ago[wasm][debugger] Use new image to run debugger tests on firefox (#68859)
Thays Grazia [Wed, 4 May 2022 20:21:54 +0000 (17:21 -0300)]
[wasm][debugger] Use new image to run debugger tests on firefox (#68859)

* test firefox in the docker image

* remove unnecessary comments

2 years agoClean up some Regex error messages (#68861)
Stephen Toub [Wed, 4 May 2022 19:03:44 +0000 (15:03 -0400)]
Clean up some Regex error messages (#68861)

Also delete some related dead code.

2 years agoAlign API surface of immutable collections and their corresponding builder types...
RaymondHuy [Wed, 4 May 2022 18:13:04 +0000 (01:13 +0700)]
Align API surface of immutable collections and their corresponding builder types (#66550)

* Add more ImmutableArray api

* add immutable list builder api

* Add Immutable Array Builder api

* remove unused namespace

* resolve comments

* resolve comment

* resolve comment

* update parameter name

* resolve some comments.

* resolve comments

* resolve comments

* resolve comments.

2 years agoPerf Update framework var name (#68827)
Parker Bibus [Wed, 4 May 2022 17:13:05 +0000 (12:13 -0500)]
Perf Update framework var name (#68827)

Change _Framework variable uses to PERFLAB_Framework.

2 years agoMinor tweaks to host tracing around registered install location (#68843)
Elinor Fung [Wed, 4 May 2022 15:27:51 +0000 (08:27 -0700)]
Minor tweaks to host tracing around registered install location (#68843)

2 years agoUse switch over a span in a few more places (#68831)
Stephen Toub [Wed, 4 May 2022 12:14:43 +0000 (08:14 -0400)]
Use switch over a span in a few more places (#68831)

C# has added the ability to `switch` on a `ReadOnlySpan<char>`, using cascading `SequenceEquals` calls when there are only a few cases, and using the same hash-based jump table when there are enough cases.  Use it in a few more places.

2 years ago[main] Update dependencies from dotnet/linker (#68650)
dotnet-maestro[bot] [Wed, 4 May 2022 07:43:50 +0000 (00:43 -0700)]
[main] Update dependencies from dotnet/linker (#68650)

* Update dependencies from https://github.com/dotnet/linker build 20220427.1

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22226.3 -> To Version 7.0.100-1.22227.1

* Update dependencies from https://github.com/dotnet/linker build 20220428.1

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22226.3 -> To Version 7.0.100-1.22228.1

* Update dependencies from https://github.com/dotnet/linker build 20220429.2

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22226.3 -> To Version 7.0.100-1.22229.2

* Update dependencies from https://github.com/dotnet/linker build 20220502.2

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.22226.3 -> To Version 7.0.100-1.22252.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[PERF][MAUI] Update iOS result and post command (#68788)
Parker Bibus [Wed, 4 May 2022 07:30:33 +0000 (02:30 -0500)]
[PERF][MAUI] Update iOS result and post command (#68788)

Updates the performance test runs for iOS Startup in dotnet-runtime-perf to properly pass the main test exit code so we see errors in azdo instead of failing silently.

2 years agoRemove some unnecessary StringBuilder use (#68768)
Stephen Toub [Wed, 4 May 2022 02:51:28 +0000 (22:51 -0400)]
Remove some unnecessary StringBuilder use (#68768)

* Remove some unnecessary StringBuilder use

* Fix missing using and typos

2 years agoFix DescribeSet test
Stephen Toub [Wed, 4 May 2022 02:15:54 +0000 (22:15 -0400)]
Fix DescribeSet test

Two PRs crossed in CI

2 years agoFix a few TODOs in regex (#68679)
Stephen Toub [Wed, 4 May 2022 00:11:04 +0000 (20:11 -0400)]
Fix a few TODOs in regex (#68679)

- Fix RegexCharClass.DescribeSet to properly handle negated Unicode category pretty-printing (used by the source generator)
- Fix a stale TODO comment in RegexFindOptimizations
- Delete an unused, unimplemented method in the debug-only SymbolicNFA

2 years agoImprove rendering of some negated sets (#68608)
Stephen Toub [Wed, 4 May 2022 00:10:50 +0000 (20:10 -0400)]
Improve rendering of some negated sets (#68608)

In particular when using the DGML writer with NonBacktracking, we end up with sets that are really small negated sets (e.g. `[^ac]`) that instead end up as being hard-to-read inverted sets (e.g. `[\u0000-`bd-\uFFFF]`).  This just improves that case by inverting the sets back.

2 years ago[mono][wasm] Pin corlib exceptions after creation. (#68801)
Zoltan Varga [Wed, 4 May 2022 00:10:13 +0000 (20:10 -0400)]
[mono][wasm] Pin corlib exceptions after creation. (#68801)

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

2 years agoregenerate networking ref assemblies (#68630)
Tomas Weinfurt [Tue, 3 May 2022 23:24:14 +0000 (16:24 -0700)]
regenerate networking ref assemblies (#68630)

* regenerate networking ref assemblies

* roll back http

* add System.Net.Primitives

* update defaults

2 years agoDisable a few tests on mobile (#68830)
Steve Pfister [Tue, 3 May 2022 21:10:11 +0000 (17:10 -0400)]
Disable a few tests on mobile (#68830)

Most of the tests were recently added and came up as failing on CI.

2 years agoEnable PGO with cross compilation (#68813)
Jan Vorlicek [Tue, 3 May 2022 20:26:30 +0000 (22:26 +0200)]
Enable PGO with cross compilation (#68813)

* Enable PGO with cross compilation

This change enables PGO support for cross compilation. The clang
compiler has a quirk that makes it lookup its native libclang_rt.profile-*.a
(where * is the target architecture) library in the host OS instead of the
rootfs. But the package containing that library cannot be installed in
the host as it targets a different architecture.
So we work around the issue by passing clang the `-resource-dir` option
that specifies a location to look for these files. It is a bit fragile as
we need to build a version specific path there, but there seems to be
no other way to enable PGO instrumentation in cross compilation.

* Reflect PR feedback

2 years ago[Infrastructure] Update devcontainer (#67656)
John Salem [Tue, 3 May 2022 18:45:27 +0000 (11:45 -0700)]
[Infrastructure] Update devcontainer (#67656)

* Update devcontainer
* upgrade to 6.0 container and fix to Ubuntu 20.04
* Upgrade llvm/clang package versions

2 years agoEnsure that Arm64 always sets the VectorTableLookup type for shuffle to be `byte...
Tanner Gooding [Tue, 3 May 2022 18:11:35 +0000 (11:11 -0700)]
Ensure that Arm64 always sets the VectorTableLookup type for shuffle to be `byte` or `sbyte` (#68817)

2 years agoJIT: update `NO_WAY` assert, fix issue it was hiding (#68796)
Andy Ayers [Tue, 3 May 2022 18:08:23 +0000 (11:08 -0700)]
JIT: update `NO_WAY` assert, fix issue it was hiding (#68796)

`NO_WAY` asserts differed from `noway_assert` for no good reason I could see,
and the former would silently suppress jit problems, including one that
came up recently in the SPMI aspnet replay.

Update so these macros do the same thing (by default they will cause checked
jits to assert, since `COMPlus_JitEnableNoWayAssert` is on by default for
checked.

Work around the one issue this uncovered: we can do late flow opts (triggered
by GC poll insertion) that try and clone block IR, and cloning of PHIs is not
supported. SSA is dead by this point anyways, but we haven't yet removed the
related IR.

Closes #68781.

2 years agoAdd a document describing how to triage CI test failures (#68682)
Bruce Forstall [Tue, 3 May 2022 17:58:05 +0000 (10:58 -0700)]
Add a document describing how to triage CI test failures (#68682)

* Add a document describing how to triage CI test failures

* Updated for feedback

1. Added a section about "finding the most general failure configuration"
2. Moved Kusto section up, to suggest using that to determine breadth of
failures
3. Added more about GCStress, crossgen2, ilasm round-trip testing modes

2 years agoAdd document describing how to disable tests (#68727)
Bruce Forstall [Tue, 3 May 2022 17:56:34 +0000 (10:56 -0700)]
Add document describing how to disable tests (#68727)

* Add document describing how to disable tests

Update libraries "filtering tests" doc with information and examples for
using `SkipOnCoreClrAttribute`

* Update for feedback

Added SkipOnMonoAttribute, CollectionAttribute, an example
of using multiple SkipOnCoreClrAttribute, and how the xunit
attributes for test disabling apply to the "converted"
src/tests tree.

2 years agoDo not save/restore upper vector for blocks that will always return (#68793)
Kunal Pathak [Tue, 3 May 2022 17:54:32 +0000 (10:54 -0700)]
Do not save/restore upper vector for blocks that will always return (#68793)

2 years agoDisable win-arm64 runtime tests on PRs for CoreCLR (#68627)
Juan Hoyos [Tue, 3 May 2022 17:51:40 +0000 (10:51 -0700)]
Disable win-arm64 runtime tests on PRs for CoreCLR (#68627)

* Disable win-arm64 runtime tests on PRs for CoreCLR
* More comprehensively disable ARM64 windows testing until https://github.com/dotnet/runtime/issues/68626 gets solved

2 years agoFix PeriodicTimer_ActiveOperations_TimerRooted test (#68805)
Jakob Botsch Nielsen [Tue, 3 May 2022 17:47:09 +0000 (19:47 +0200)]
Fix PeriodicTimer_ActiveOperations_TimerRooted test (#68805)

There are two problems with this test
1. `WaitForNextTickAsync` may return a synchronously completed task, in
   which case it does not root the timer, causing our first
   `WaitForTimerToBeCollected` to fail because the timer was collected.
   This problem is easily reproduced by adding a small sleep after
   constructing the `PeriodicTimer` in `Create`, and I believe it is the
   cause of #59542.
2. There is no guarantee that the timer is not still rooted after the
   wait finishes because the returned `ValueTask<bool>` may be keeping
   it alive (although, it seems unlikely Roslyn will extend the lifetime across the await like this).
   Fixed by wrapping in another NoInlining method.

Fix #59542

2 years agoEnsure that InstructionSetFlags are correctly fixed up for unmatched VM (#64158)
Tanner Gooding [Tue, 3 May 2022 17:40:45 +0000 (10:40 -0700)]
Ensure that InstructionSetFlags are correctly fixed up for unmatched VM (#64158)

* Ensure that InstructionSetFlags are correctly fixed up for unmatched VM

* Applying formatting patch

2 years agoAdd support for storing method handle histograms in profiles (#67919)
Jakob Botsch Nielsen [Tue, 3 May 2022 17:19:39 +0000 (19:19 +0200)]
Add support for storing method handle histograms in profiles (#67919)

Allow method handle histograms in .mibc files and in the PGO text
format.

Contributes to #44610.

2 years agoRemove unwrapping of OCTET STRING wrapping in EnvelopedCms.
Kevin Jones [Tue, 3 May 2022 16:52:45 +0000 (12:52 -0400)]
Remove unwrapping of OCTET STRING wrapping in EnvelopedCms.

Prior to .NET Core 3.0, EnvelopedCms would pack and unpack PKCS7 data in an
OCTET STRING when encrypted and decrypted. This turned out to be incorrect.
Other implementations do not do the OCTET STRING wrapping, so when a different
CMS implementation processed a PKCS7 data encrypted by .NET, it would contain
the raw OCTET STRING. So the data would appear to be appended by the byte 0x04,
and then a length indicator.

We removed the wrapping in OCTET STRING. However, we left in the unwrapping of
the OCTET STRING because previously encrypted data by .NET would now contain
the raw data, thus appearing prefixed by 0x04 and a length indicator.

This however still has a problem where if the data to be encrypted started with
0x04 and a reasonable length, it would mistakenly be treated as an OCTET STRING.

This change removes the compatibility and is thus a breaking change. If customers
have CMS data that was encrypted by .NET Core prior to 3.0, they will experience
decrypted data that starts with the byte 0x04 and at least one length byte.

Customers can work around this with AsnDecoder.ReadOctetString to remove the extra
bytes, and optionally re-encrypting it and storing that so the work around is no
longer necessary.

2 years agoReenable SocketsHttpHandlerTest_Http3_MsQuic.SendMoreThanStreamLimitRequestsConcurren...
Radek Zikmund [Tue, 3 May 2022 16:46:51 +0000 (09:46 -0700)]
Reenable SocketsHttpHandlerTest_Http3_MsQuic.SendMoreThanStreamLimitRequestsConcurrently_LastWaits test (#67419)

2 years agoMitigate stress hangs by marking GC-sensitive tests as out-of-proc (#68733)
Tomáš Rylek [Tue, 3 May 2022 15:17:36 +0000 (17:17 +0200)]
Mitigate stress hangs by marking GC-sensitive tests as out-of-proc (#68733)

According to Andrew Au's findings in the issue

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

a few tests explicitly manipulate the GC finalizer queue in a way
that is prone to hangs due to entering an infinite finalization
loop under GC stress. While the primary issue tracks the problem
in its entirety, the fix is non-trivial as it's not yet fully
understood whether we should fix the runtime, the GC stress mode
behavior or the tests themselves; after all, quite a few other
tests use explicit finalization too. To mitigate the problem in
the short term and help cleaning up the pending failures in GC
stress runs I propose marking tests that are known to
regularly cause these issues as requiring process isolation
to run out-of-process as they used to before the test merging.

Thanks

Tomas

2 years agoAvoid StringBuilder-related allocation in ReflectionAwareILGen.GetCSharpString (...
Stephen Toub [Tue, 3 May 2022 14:25:09 +0000 (10:25 -0400)]
Avoid StringBuilder-related allocation in ReflectionAwareILGen.GetCSharpString (#68738)

- If there's nothing to escape, we can just return the original string without creating a StringBuilder
- These strings are typically very short.  We can use ValueStringBuilder and stack space.

2 years ago[System.Native] (wasm) use a temporary buffer if threading is used (#68784)
Aleksey Kliger (λgeek) [Tue, 3 May 2022 12:47:52 +0000 (08:47 -0400)]
[System.Native] (wasm) use a temporary buffer if threading is used (#68784)

* [System.Native] (wasm) use a temporary buffer if threading is used

Chrome doesn't want a SharedArrayBuffer to be passed to crypto.getRandomValues(), so pass a temporary buffer and then copy the bytes into the wasm instance heap

2 years agoUpdate arm/arm64 Linux cross build images (#68561)
Jan Vorlicek [Tue, 3 May 2022 11:42:39 +0000 (13:42 +0200)]
Update arm/arm64 Linux cross build images (#68561)

* Update arm/arm64 Linux cross build images

The images are updated to the latest ones as a preparation for enabling
native PGO for Linux arm64 and potentially Linux arm.

We are moving to targeting glibc 2.27 (the one from Ubuntu 18.04).
Before, we were targeting obsolete Ubuntu 16.04.

* Update the Helix pipeline for running arm64 tests too

* Update GCC path for Mono

Ubuntu 18.04 has version 7 instead of 5

2 years ago[Mono]: Fix static closed delegate fnptr crash. (#68701)
Johan Lorensson [Tue, 3 May 2022 07:02:53 +0000 (09:02 +0200)]
[Mono]: Fix static closed delegate fnptr crash. (#68701)

* Fix static closed delegate fnptr crash.

When accessing a function pointer to a static closed delegate like
done in added test:

GetFunctionPointerForDelegate_MarshalledClosedStaticDelegate

it will trigger a read outside of the allocated mspecs buffer since
invoke_sig and method signature arguments wont match.

There was already logic to adjust this in emit_managed_wrapper_ilgen,
but done after call to emit_managed_wrapper_validate_signature
that will touch memory and depending on its content, trigger a crash.

Fix make sure we do signature adjustments first and then validate
the signature. Fix also adjust a couple of mspecs allocations to use
g_new0 as all others to make sure we get NULL pointers in the mspecs
array.

Since this scenario was not covered on CI, commit also adds a new test
in GetFunctionPointerForDelegateTests.cs covering this scenario.

2 years agoRegenerate fabricbot config to include several new/revised automation tasks (#68728)
Jeff Handley [Tue, 3 May 2022 05:03:35 +0000 (22:03 -0700)]
Regenerate fabricbot config to include several new/revised automation tasks (#68728)

* Regenerate fabricbot config to include several new automation tasks

* Remove tasks that were moved into the fabricbot-config generation

* Update the needs-author-action comment per feedback

* Update the "PR Needs Champion" tasks to address a bug found during testing

2 years agoDelete unmanaged AssemblyName parser (#68737)
Jan Kotas [Tue, 3 May 2022 03:35:43 +0000 (20:35 -0700)]
Delete unmanaged AssemblyName parser  (#68737)

Replaced the few places that need to parse assembly names in the VM with callbacks to CoreLib

2 years agoRemove REGEX_OPTIONS from TextFieldParser.vb (#68766)
Stephen Toub [Tue, 3 May 2022 02:33:59 +0000 (22:33 -0400)]
Remove REGEX_OPTIONS from TextFieldParser.vb (#68766)

RegexOptions.CultureInvariant is a nop unless RegexOptions.IgnoreCase is specified or the inline `(?i)` is used in the pattern, neither of which is done here.

2 years agoRevise OSR docs (#68778)
Andy Ayers [Tue, 3 May 2022 01:30:46 +0000 (18:30 -0700)]
Revise OSR docs (#68778)

Bring the main document up to date with current implementation. Remove
some obsolete sections (EnC, complex epilog).

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
2 years agoUpdate comments and simplify implementation of ResourceManager.IsDefault (#68777)
Jan Kotas [Tue, 3 May 2022 01:10:02 +0000 (18:10 -0700)]
Update comments and simplify implementation of ResourceManager.IsDefault (#68777)

Avoids parsing of AssemblyName that is an overkill for what the method does.

2 years agoClean up some AcriveIssues in regex (#68657)
Stephen Toub [Mon, 2 May 2022 23:50:30 +0000 (19:50 -0400)]
Clean up some AcriveIssues in regex (#68657)

2 years agoRemove GTF_GLOB_REF on a few more addressing nodes (#68741)
Jakob Botsch Nielsen [Mon, 2 May 2022 21:16:24 +0000 (23:16 +0200)]
Remove GTF_GLOB_REF on a few more addressing nodes (#68741)

GTF_GLOB_REF is necessary on a GT_ADDR node only if the child actually
uses a tree with this flag as a value (and not as a location). This
removes the flag in a few more places by using IsLocalAddrExpr.

Fixes #68669

2 years agoMove EventPipe thread buffer allocation outside of lock (#67936)
John Salem [Mon, 2 May 2022 20:32:19 +0000 (13:32 -0700)]
Move EventPipe thread buffer allocation outside of lock (#67936)

2 years agoFix expected number of RequestLeftQueue events in telemetry test. (#68771)
Radek Zikmund [Mon, 2 May 2022 20:31:27 +0000 (13:31 -0700)]
Fix expected number of RequestLeftQueue events in telemetry test. (#68771)

Fixes #67273

2 years agoPass UseStrongCrypto to server-side TLS (#68704)
Radek Zikmund [Mon, 2 May 2022 20:26:59 +0000 (13:26 -0700)]
Pass UseStrongCrypto to server-side TLS (#68704)

2 years agoDelete some unused wrappers for registry operations (#68689)
Elinor Fung [Mon, 2 May 2022 18:38:41 +0000 (11:38 -0700)]
Delete some unused wrappers for registry operations (#68689)

2 years agoBump Intellisense package to Preview3 (#68713)
Carlos Sanchez [Mon, 2 May 2022 18:29:45 +0000 (11:29 -0700)]
Bump Intellisense package to Preview3 (#68713)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
2 years agoUpdate solution files to include missing deps (#68668)
Viktor Hofer [Mon, 2 May 2022 18:14:05 +0000 (20:14 +0200)]
Update solution files to include missing deps (#68668)

2 years agoAdding the 2-parameter xplat shuffle helpers and accelerating them (#68559)
Tanner Gooding [Mon, 2 May 2022 17:11:49 +0000 (10:11 -0700)]
Adding the 2-parameter xplat shuffle helpers and accelerating them (#68559)

* Adding managed definitions for cross-platform shuffle helpers

* Adding basic tests covering the Vector64/128/256 Shuffle APIs

* Adding JIT support to recognize Vector64/128/256.Shuffle as intrinsic but not handle it as an intrinsic

* Adding a helper for determining if a node represents a vector constant

* Adding x86/x64 acceleration for the 2-parameter xplat shuffle helpers

* Adding Arm64 acceleration for the 2-parameter xplat shuffle helpers

* Ensure a switch covers the "default" case

* Applying formatting patch

* Ensure the call to Op uses 1-based indexing

* Ensure TYP_LONG and TYP_ULONG fixup simdBaseJitType and simdBaseType

* Have gtNewSimdShuffle use fgMakeMultiUse

* Don't pass an unecessary compiler instance to `gtNewSimdShuffleNode`

* Don't expose the unused gtNewSimdShuffleNode API

* Allow fgMakeMultiUse to take a structType and pass it down to fgInsertCommaFormTemp

* Pass down the clsHnd to fgMakeMultiUse from gtNewSimdShuffleNode

* Adding some additional tests covering the vector shuffle APIs

* Ensure the Vector256 test is accessing the right index

* Ensure we look up the correct clsHnd

* Applying formatting patch

2 years agofix build for musl 1.2.3 (#67763) (#67772)
Antoine Martin [Mon, 2 May 2022 15:50:48 +0000 (11:50 -0400)]
fix build for musl 1.2.3 (#67763) (#67772)

2 years agoAvoid delegate allocation per LowLevelLock (#68751)
Stephen Toub [Mon, 2 May 2022 10:27:04 +0000 (06:27 -0400)]
Avoid delegate allocation per LowLevelLock (#68751)

2 years agoAvoid unnecessary closure/delegate for new SocketsHttpHandler connections (#68750)
Stephen Toub [Mon, 2 May 2022 10:08:42 +0000 (06:08 -0400)]
Avoid unnecessary closure/delegate for new SocketsHttpHandler connections (#68750)

2 years agoavoid Reflection in Quic (#68189)
Tomas Weinfurt [Mon, 2 May 2022 05:38:23 +0000 (22:38 -0700)]
avoid Reflection in Quic (#68189)

* avoid Reflection in Quic

* add missing file

* update comment

* exclude from ref creation

* feedback from review

2 years agoUse 'unsigned short' instead of 'unsigned'. (#68190)
Will Smith [Mon, 2 May 2022 04:57:30 +0000 (21:57 -0700)]
Use 'unsigned short' instead of 'unsigned'. (#68190)

* Use 'unsigned short' instead of 'unsigned'.

Should resolve work item 1507451.

* Widen

2 years agoAvoid delegate allocation in NamedPipeClientStream.ConnectAsync (#68752)
Stephen Toub [Mon, 2 May 2022 02:32:52 +0000 (22:32 -0400)]
Avoid delegate allocation in NamedPipeClientStream.ConnectAsync (#68752)

We still need to allocate an object for the closed-over state, but we can avoid the per-call delegate allocation.

2 years agoRemove unnecessary throwOnPrematureClosure in ManagedWebSocket. (#68745)
Eric Erhardt [Mon, 2 May 2022 00:53:43 +0000 (19:53 -0500)]
Remove unnecessary throwOnPrematureClosure in ManagedWebSocket. (#68745)

* Remove unnecessary throwOnPrematureClosure in ManagedWebSocket.

This parameter is always true, so it can be removed and simplify the code.

2 years agoJIT: fix loop recognition in OSR PGO methods (#68725)
Andy Ayers [Sun, 1 May 2022 23:17:26 +0000 (16:17 -0700)]
JIT: fix loop recognition in OSR PGO methods (#68725)

When both OSR and PGO are active, we both instrument and optimize methods.

The basic block count updates added by instrumentation were interfering
with loop recognition, leading to missed optimizations like loop cloning.

The fix is to recognize and skip over trees added for instrumentation.

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
2 years agoFix RegexCompiler regression on 32-bit for some set matching (#68655)
Stephen Toub [Sun, 1 May 2022 23:09:00 +0000 (19:09 -0400)]
Fix RegexCompiler regression on 32-bit for some set matching (#68655)

We added an optimization to regex where for sets containing values all within 64 characters of each other (e.g. all hex digits), we use a ulong to represent a bitmap and can implement the check in an entirely branchless manner.  This results in a measurable win on 64-bit, e.g. upwards of 20% for some patterns.  Unfortunately, it also results in a measurable regression on 32-bit.  This PR fixes that for RegexCompiler by special-casing the optimization to only apply when IntPtr.Size == 8.  For the source generator, we don't have the same luxury of knowing that the code is emitted and used on the same bitness, so since it would result in very complicated code to emit multiple implementations and since we generally prefer optimizing for 64-bit, I've left it in for the source generator.

2 years agoClean up some debug-only code in Regex (#68721)
Stephen Toub [Sun, 1 May 2022 18:14:18 +0000 (14:14 -0400)]
Clean up some debug-only code in Regex (#68721)

2 years agoReduce allocation in Process.GetProcessesByName (#68705)
Stephen Toub [Sun, 1 May 2022 17:43:19 +0000 (13:43 -0400)]
Reduce allocation in Process.GetProcessesByName (#68705)

* Reduce allocation in Process.GetProcessesByName

GetProcessesByName is loading all of the information for every process found, even if it'll immediately be thrown away because the name doesn't match.

* Fix a few issues and address PR feedback

2 years agoSimplify AssemblyName marshalling between VM and CoreLib (#68735)
Jan Kotas [Sun, 1 May 2022 14:35:06 +0000 (07:35 -0700)]
Simplify AssemblyName marshalling between VM and CoreLib (#68735)

- Introduce NativeAssemblyNameParts that is unmanaged view for the managed AssemblyNameParts
- Use NativeAssemblyNameParts to convert manually managed code to C#
- Delete unnecessary Version allocation

2 years agoUpdate Microsoft.CodeAnalysis.NetAnalyzers version (#68724)
Stephen Toub [Sun, 1 May 2022 10:22:11 +0000 (06:22 -0400)]
Update Microsoft.CodeAnalysis.NetAnalyzers version (#68724)

- Delete some now unnecessary pragmas
- Enable the new Dictionary.ContainsKey guard rule
- Address on violation of the new rule

2 years ago[MONO] Refactored code into marshal-ilgen and marshal-shared. (#68656)
Nathan Ricci [Sun, 1 May 2022 02:52:05 +0000 (22:52 -0400)]
[MONO] Refactored code into marshal-ilgen and marshal-shared. (#68656)

Refactored marshal code into marshal-ilgen and marshal-shared.