platform/upstream/dotnet/runtime.git
3 years agoAdd profile-use-only mode for MultiCoreJit (#55005)
Gleb Balykov [Tue, 20 Jul 2021 17:40:19 +0000 (20:40 +0300)]
Add profile-use-only mode for MultiCoreJit (#55005)

* Add profile-use-only mode for MultiCoreJit

- memory consumption is reduced if profile is not gathered
- disk/flash life is increased if profile is not saved each time

* Remove non-set m_fAppxMode

3 years agoPrepare for arcade changes that enable testing of meta-packages (#55976)
Eric StJohn [Tue, 20 Jul 2021 17:36:08 +0000 (10:36 -0700)]
Prepare for arcade changes that enable testing of meta-packages (#55976)

3 years ago[QUIC] Fix cancelling shutdown completion source (#55993)
Natalia Kondratyeva [Tue, 20 Jul 2021 17:21:45 +0000 (19:21 +0200)]
[QUIC] Fix cancelling shutdown completion source (#55993)

Fixes #55706

3 years agoremove unnecessary call (#55795)
Tomas Weinfurt [Tue, 20 Jul 2021 17:20:51 +0000 (10:20 -0700)]
remove unnecessary call (#55795)

* remove unnecessary call

* fix typo

3 years agomitigation for quic tests hangs (#55985)
Tomas Weinfurt [Tue, 20 Jul 2021 17:07:20 +0000 (10:07 -0700)]
mitigation for quic tests hangs (#55985)

3 years agoFix #51171: Eager validation of named options (#55922)
Nikita Balabaev [Tue, 20 Jul 2021 16:39:01 +0000 (18:39 +0200)]
Fix #51171: Eager validation of named options (#55922)

3 years agoDisable QuicStreamTests_MsQuicProvider.ReadOutstanding_ReadAborted_Throws (#55997)
Karel Zikmund [Tue, 20 Jul 2021 14:58:59 +0000 (16:58 +0200)]
Disable QuicStreamTests_MsQuicProvider.ReadOutstanding_ReadAborted_Throws (#55997)

Disable test: System.Net.Quic.Tests.QuicStreamTests_MsQuicProvider.ReadOutstanding_ReadAborted_Throws

Tracked by #55948

3 years agoFix x86 Linux build with clang < 10 (#55924)
Jan Vorlicek [Tue, 20 Jul 2021 13:51:45 +0000 (15:51 +0200)]
Fix x86 Linux build with clang < 10 (#55924)

There is a bug in clang that was fixed in version 10 and that causes
the build of the src/coreclr/vm/i386/jithelp.S to fail with
'error: cannot use more than one symbol in memory operand'.
The problem is that it doesn't support the `offset` keyword and
it thinks it is just another symbol.

The fix is to use att syntax for the offending instruction.

3 years agoReplace a few unnecessary uses of Convert.ToString (#55831)
Stephen Toub [Tue, 20 Jul 2021 13:29:20 +0000 (09:29 -0400)]
Replace a few unnecessary uses of Convert.ToString (#55831)

* Replace a few unnecessary uses of Convert.ToString

* Update src/libraries/System.Private.Xml/src/System/Xml/Schema/ContentValidator.cs

Co-authored-by: Christopher Watford <83599748+watfordsuzy@users.noreply.github.com>
Co-authored-by: Christopher Watford <83599748+watfordsuzy@users.noreply.github.com>
3 years agoFix % used in PerCoreLockedStacks (#55959)
Stephen Toub [Tue, 20 Jul 2021 13:28:45 +0000 (09:28 -0400)]
Fix % used in PerCoreLockedStacks (#55959)

* Fix % used in PerCoreLockedStacks

s_lockedStackCount will be a const in tier 1, and the JIT can optimize % by a const to something other than idiv.

* Address PR feedback

3 years agoDisable implicit imports in tools (#55828)
Andrii Kurdiumov [Tue, 20 Jul 2021 13:23:47 +0000 (19:23 +0600)]
Disable implicit imports in tools (#55828)

3 years agoComplete Http2Stream after sending Reset or EndOfStream to server (#55835)
Alexander Nikolaev [Tue, 20 Jul 2021 13:09:01 +0000 (15:09 +0200)]
Complete Http2Stream after sending Reset or EndOfStream to server (#55835)

It changes the order of Complete and Send Reset/Send EndOfStream operations to prevent creation of a new Http2Stream while the old one has not yet written the final frame to wire.

Fixes #1586

3 years agoCleanup iOS/Android samples to use xharness (#55926)
Alexander Köplinger [Tue, 20 Jul 2021 10:14:22 +0000 (12:14 +0200)]
Cleanup iOS/Android samples to use xharness (#55926)

Instead of manually calling adb or simctl.

3 years agoadd RID for Alpine 3.14 (#55857)
Tomas Weinfurt [Tue, 20 Jul 2021 03:42:04 +0000 (20:42 -0700)]
add RID for Alpine 3.14 (#55857)

3 years agoUpdate analyzer rulesets (#55925)
Stephen Toub [Tue, 20 Jul 2021 02:44:43 +0000 (22:44 -0400)]
Update analyzer rulesets (#55925)

3 years agofix discrepancy in STJ test namespaces (#55958)
Eirik Tsarpalis [Tue, 20 Jul 2021 02:44:20 +0000 (05:44 +0300)]
fix discrepancy in STJ test namespaces (#55958)

3 years agoImprove crossgen2 help text (#55977)
David Wrighton [Tue, 20 Jul 2021 02:29:13 +0000 (19:29 -0700)]
Improve crossgen2 help text (#55977)

- Add handling of "-?" and no command line arguments.
- Print out default values for --targetos and --targetarch
- Describe behavior of response files
- Describe the behavior of the -- switch
- Describe in much greater detail the valid values for the --instruction-set switch

Fix #47486

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoDisable ConnectTimeout_PlaintextStreamFilterTimesOut_Throws (#55932)
Karel Zikmund [Tue, 20 Jul 2021 01:44:54 +0000 (03:44 +0200)]
Disable ConnectTimeout_PlaintextStreamFilterTimesOut_Throws (#55932)

Disable test ConnectTimeout_PlaintextStreamFilterTimesOut_Throws

Disabled test tracked by #55931

3 years agoRevert UnicodeDebug.cs to not depend on the Debug.Assert interpolated string handler...
Stephen Toub [Tue, 20 Jul 2021 01:18:52 +0000 (21:18 -0400)]
Revert UnicodeDebug.cs to not depend on the Debug.Assert interpolated string handler (#55954)

Turns out we use this file outside of corelib, in projects that build for pre-.NET 6, and the change was causing lots of string formatting for asserts that pass.

3 years agoLink with EmccCompileOptimizationFlag==-Oz by default in release (#55939)
Larry Ewing [Tue, 20 Jul 2021 00:53:25 +0000 (19:53 -0500)]
Link with EmccCompileOptimizationFlag==-Oz by default in release (#55939)

3 years ago[mono] Split iOS/tvOS/MacCatalyst runtime packs into their own workload (#55851)
Steve Pfister [Mon, 19 Jul 2021 20:15:37 +0000 (16:15 -0400)]
[mono] Split iOS/tvOS/MacCatalyst runtime packs into their own workload (#55851)

The ios/tvos/maccatalyst runtime packs need to be installable on Windows and as a result each need their own workload.

The microsoft-net-runtime-ios/tv/maccatalyst workloads will still function the same by extending the new runtimes-* workloads.

3 years agoAdd an assert concerning branch to BBJ_CALLFINALLY blocks (#55858)
Bruce Forstall [Mon, 19 Jul 2021 20:03:22 +0000 (13:03 -0700)]
Add an assert concerning branch to BBJ_CALLFINALLY blocks (#55858)

In the FEATURE_EH_CALLFINALLY_THUNKS case, BBJ_CALLFINALLY blocks live
in the EH region enclosing the `try` block that needs to call the finally.
However, we need all flow to the BBJ_CALLFINALLY to come from that try block;
we don't want flow optimizations to otherwise branch directly to this
BBJ_CALLFINALLY block. Add an assert to verify this is the case. The assert
also covers the non-FEATURE_EH_CALLFINALLY_THUNKS case.

3 years agoSwitch handwritten test serializer contexts to use source generator (#55844)
Layomi Akinrinade [Mon, 19 Jul 2021 17:22:33 +0000 (10:22 -0700)]
Switch handwritten test serializer contexts to use source generator (#55844)

3 years agoFixes building Host tests from VS (#55917)
Vitek Karas [Mon, 19 Jul 2021 16:54:03 +0000 (18:54 +0200)]
Fixes building Host tests from VS (#55917)

When building the Host tests projects from VS the CrossGen2 related properties are not set (probably because the build type is not set to Core - which doesn't matter for the tests).

Changed the includes to be conditional.

3 years agoJIT: refactor how opaque VNs are represented (#55853)
Andy Ayers [Mon, 19 Jul 2021 15:39:28 +0000 (08:39 -0700)]
JIT: refactor how opaque VNs are represented (#55853)

Use a unary function to capture opaque VN loop dependence, rather than factoring
that out as part of the owning chunk. As a result the VN chunk data no longer
has a per-loop component (no dependence on MAX_LOOP_NUM).

This gives us the flexibility to address #54118 by doing something similar for
`MapUpdate` VNs.

3 years agodisabled test (#55912)
Marie Píchová [Mon, 19 Jul 2021 15:14:34 +0000 (15:14 +0000)]
disabled test (#55912)

3 years agoWait for the request line before cancelling the request in EventSource_UnsuccessfulRe...
Miha Zupan [Mon, 19 Jul 2021 14:41:13 +0000 (07:41 -0700)]
Wait for the request line before cancelling the request in EventSource_UnsuccessfulRequest_LogsStartFailedStop (#55913)

3 years agoDelete IDE dispose analyzer rules (#55920)
xtqqczze [Mon, 19 Jul 2021 14:39:25 +0000 (15:39 +0100)]
Delete IDE dispose analyzer rules (#55920)

The IDE dispose analyzer rules have been deleted from Roslyn:

https://github.com/dotnet/roslyn/commit/eeba499ecf839ec35bca25062d69d2fc5c4885b9

3 years agoComments from code review (#55819)
Marie Píchová [Mon, 19 Jul 2021 14:38:30 +0000 (14:38 +0000)]
Comments from code review (#55819)

* Comments

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

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

Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
Co-authored-by: Natalia Kondratyeva <knatalia@microsoft.com>
3 years agoFix WriteGatherAtOffset IOVector count (#55909)
Stephen Toub [Mon, 19 Jul 2021 14:37:27 +0000 (10:37 -0400)]
Fix WriteGatherAtOffset IOVector count (#55909)

3 years agoAdd --debuginfo to superpmi (#55808)
Jakob Botsch Nielsen [Mon, 19 Jul 2021 08:01:44 +0000 (10:01 +0200)]
Add --debuginfo to superpmi (#55808)

3 years agoFix mono build on illumos (#55897)
Adeel Mujahid [Mon, 19 Jul 2021 07:49:06 +0000 (10:49 +0300)]
Fix mono build on illumos (#55897)

3 years agoDisable some library tests due to failures/crash (#55826)
Maxim Lipnin [Mon, 19 Jul 2021 06:09:35 +0000 (09:09 +0300)]
Disable some library tests due to failures/crash (#55826)

3 years ago[wasm] Use compile rsp instead of link, for compiling native files (#55848)
Ankit Jain [Mon, 19 Jul 2021 05:55:28 +0000 (01:55 -0400)]
[wasm] Use compile rsp instead of link, for compiling native files (#55848)

.. and fix logging that broke recently.

`tasks/Common/Utils.cs`:

TaskLoggingHelper Utils.Logger is a static field, which must be set by
task else any methods in Utils, eg. RunProcess, silently fail to log
any messages. Also, this would be a problem when building multiple
projects in parallel, since the logger is a task-specific one.

Instead, we pass logger as an arg to all the methods.

3 years ago[wasm] Add support for using custom native libraries (#55797)
Ankit Jain [Mon, 19 Jul 2021 05:02:01 +0000 (01:02 -0400)]
[wasm] Add support for using custom native libraries (#55797)

3 years ago[wasm] Run browser tests on helix/windows (#52699)
Radek Doulik [Mon, 19 Jul 2021 03:32:33 +0000 (05:32 +0200)]
[wasm] Run browser tests on helix/windows (#52699)

* [wasm] Run browser tests on helix/windows

* Build just wasm/browsertests on helix/windows

* Use $(ChromiumRevision) in windows links

* Fix conditions

* Set PATH differently

* Use backslash in PATH on windows

* Try different version of chromium

* Pass scenario and browser host to build

And set browser path on windows to be able to start chrome
from xharness

* Try to get more info from the helix workitems

* Fix dir separator, add broser path

* Create WasmBuildSupportDir

* Revert "Try to get more info from the helix workitems"

This reverts commit 8807434a33a09a27f2c21cb321b743f155955cb2.

* Put the dir cmds back, fix mkdir call

* More debug info

* Bump xharness

* Bump xharness again

With darc this time

* StressLogAnalyzer didn't print the number of messages correctly if it exceeded the int range (2 billion). (#54832)

Fix is to just use 64 bit ints instead.

* Found a race condition where the LOH flag on a segment is set too late. This gives another thread the chance to allocate in a fresh LOH region that doesn't have the LOH flag set just yet and trip over an assert in Object::ValidateInner. (#54839)

The fix is simply to set the flag in get_new_region before the region is put on the list for the LOH generation.

* Try to show the chrome logs

* Use different path for chrome logs

* Use newer image with font for chrome

The chrome was crashing, because it didn't find any sans-serif font.

* Increase timeouts

* Disable tests which timeout

* Remove debug calls

* Put back normal scenario

* Do not set scenario in build args

* Add browser sample exclusion

* Restore the platform matrix

* Remove the wasm build test changes

That will be handled in https://github.com/dotnet/runtime/pull/54451

* Remove duplicate exclusion

* Suggested property name change

* Fix last merge

* Simplify condition

We don't pass Scenario anymore

* Include chrome and chromedriver in the payload

Co-authored-by: Peter Sollich <petersol@microsoft.com>
3 years agoDisable array support for the COM variant wrapper classes when built-in COM is disabl...
Jeremy Koritzinsky [Sun, 18 Jul 2021 23:46:19 +0000 (18:46 -0500)]
Disable array support for the COM variant wrapper classes when built-in COM is disabled. (#55756)

* Disable array support for the COM variant wrapper classes when built-in COM is disabled.

Fixes #55600

* Fix config call.

* Fix one more location of wrapper class usage.

* Fix method name.

* Add trimming test.

* Fix AV in IsArrayOfWrappers

* Fix trimming test

* Apply suggestions from code review

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Set Trim=true

Co-authored-by: Elinor Fung <elfung@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoSystem.Text.Json: stackalloc constants + misc PR feedback (#55350)
Mikel Blanchard [Sun, 18 Jul 2021 19:04:17 +0000 (12:04 -0700)]
System.Text.Json: stackalloc constants + misc PR feedback (#55350)

* Follow-up feedback from #54186.

* Code review.

* Code review.

* Dedicated constant for the max number of chars permitted to be allocated on the stack.

3 years agoFix WaitForConnectionAsync when NamedPipeServerStream is disposed (#52825)
Emmanuel André [Sun, 18 Jul 2021 17:30:16 +0000 (19:30 +0200)]
Fix WaitForConnectionAsync when NamedPipeServerStream is disposed (#52825)

* Fix WaitForConnectionAsync when NamedPipeServerStream is disposed

* Align Unix implementation on broken pipe IO exception as on Windows

* Add missing methods to test against ObjectDisposedException

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Rebase and fix suggestions

* Cancel Accept on dispose

* Improve test

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoBugfix: System.Xml.Serialization: Compiler.GetTempAssemblyName is not deterministic...
Tal Aloni [Sun, 18 Jul 2021 14:18:25 +0000 (17:18 +0300)]
Bugfix: System.Xml.Serialization: Compiler.GetTempAssemblyName is not deterministic under .NET Core (#46499)

* Bugfix: System.Xml.Serialization: Compiler.GetTempAssemblyName is not persistent under .NET Core

The implementation of String.GetHashCode() was persistent by default in .NET Framework. allowing to predictably name an XmlSerializers.{HashCode}.dll containing the pre-generated serializers.
In .NET Core / .NET 5, String.GetHashCode() is no longer persistent, so the value of ns.GetHashCode() will change during each run, preventing it from picking up the XmlSerializers dll correctly.

* Remove trailing whitespace

* Use truncated SHA512

* Fixed compilation

* Dispose SHA512 instance

* Fixed compilation

* Update src/libraries/System.Private.Xml/src/System/Xml/Serialization/Compiler.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update src/libraries/System.Private.Xml/src/System/Xml/Serialization/Compiler.cs

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

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoEliminate backtracking in the interpreter for patterns with .* (#51508)
Prashanth Govindarajan [Sun, 18 Jul 2021 13:06:23 +0000 (06:06 -0700)]
Eliminate backtracking in the interpreter for patterns with .*  (#51508)

* First cut of look up table for speeding up Go()

* More efficient .* in RegexInterpreter

* sq

* Get more debug info

* Remove assert and add unit test

* Potential unit test

* temp

* Fix a bug

* sq

* Add extra protection to the backtracking optimization

* Add unit test

* Revert

* RegexCompiler changes

* sq

* Remove debug unit tests

* Add a length to the AsSpan call

* Address RegexCompiler comments and add unit tests

3 years agoset CLOEXEC on diagnostic server FDs (#55850)
John Salem [Sun, 18 Jul 2021 12:45:44 +0000 (05:45 -0700)]
set CLOEXEC on diagnostic server FDs (#55850)

* set CLOEXEC on diagnostic server FDs

* Add assert and comment

* fix compiler warning

* simplify asserts to appease all the different builds

3 years agoReduce the nullability bypasses in CryptoPool.Return (#55782)
Jeremy Barton [Sun, 18 Jul 2021 11:05:25 +0000 (04:05 -0700)]
Reduce the nullability bypasses in CryptoPool.Return (#55782)

* Reduce the nullability bypasses in CryptoPool.Return

This is a walk over src/libraries/.../*.cs to find any calls to
CryptoPool.Return which needed a "!" because of nullability
flow.

A couple of the bypasses were identifying legitimate issues,
and were resolved by moving the Rent to the last thing before
the try.

A couple were because of the use of ArraySegment which
can't structurally promise the array is non-null. But those
were usually preceded by a call to ZeroMemory, and there
is a CryptoPool.Return(ArraySegment) which does that
already, so those "!"s were removed by changing to that
overload.

* Apply feedback

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years ago[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade...
dotnet-maestro[bot] [Sun, 18 Jul 2021 11:03:16 +0000 (07:03 -0400)]
[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade dotnet/icu dotnet/roslyn-analyzers (#55812)

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

optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.21364.4 -> To Version 1.0.0-prerelease.21365.5

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.GenFacades , Microsoft.DotNet.GenAPI , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21364.3 -> To Version 6.0.0-beta.21365.11

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 6.0.0-preview.7.21363.1 -> To Version 6.0.0-rc.1.21366.2

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.GenFacades , Microsoft.DotNet.GenAPI , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21364.3 -> To Version 6.0.0-beta.21366.1

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20210716.2

Microsoft.CodeAnalysis.NetAnalyzers
 From Version 6.0.0-rc1.21362.2 -> To Version 6.0.0-rc1.21366.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoFix strings in ApplicationId.ToString (#55879)
Stephen Toub [Sun, 18 Jul 2021 11:01:36 +0000 (07:01 -0400)]
Fix strings in ApplicationId.ToString (#55879)

In rolling out usage of StringBuilder.Append's support for interpolated strings, I mistook this occurrence as a StringBuilder rather than a ValueStringBuidler.  This reverts the changes to its ToString, but also switches to use EncodeToUtf16 rather than a custom loop.

3 years agoUpdate Roslyn to 4.0.0-3.21367.2 (#55878)
Stephen Toub [Sun, 18 Jul 2021 10:39:34 +0000 (06:39 -0400)]
Update Roslyn to 4.0.0-3.21367.2 (#55878)

3 years agoAdd VersionCheck (#55763)
naminodarie [Sun, 18 Jul 2021 10:31:10 +0000 (19:31 +0900)]
Add VersionCheck (#55763)

3 years agoenable two quic tests (#55880)
Tomas Weinfurt [Sun, 18 Jul 2021 10:12:40 +0000 (03:12 -0700)]
enable two quic tests (#55880)

3 years agoConsider CALLFINALLY block as pred of finally block during assertion props (#55674)
Kunal Pathak [Sun, 18 Jul 2021 06:42:24 +0000 (23:42 -0700)]
Consider CALLFINALLY block as pred of finally block during assertion props (#55674)

* Consider CALLFINALLY block as one of the pred of handler block during assertion prop

* Add test case

* Do not perform jump threading for first block of try-region

* fix bbNum

* revert dataflow changes

3 years agoRefactor runtime-specific logic out of CustomAttributeData (#55870)
Jan Kotas [Sat, 17 Jul 2021 22:32:54 +0000 (15:32 -0700)]
Refactor runtime-specific logic out of CustomAttributeData (#55870)

CustomAttributeData is meant to be abstract base class of reflection object model. Move the runtime-specific part
into a separate RuntimeCustomAttributeData type.

3 years agoFix System.Reflection.Metadata.MetadataUpdater.IsSupported (#55874)
Mike McLaughlin [Sat, 17 Jul 2021 19:15:04 +0000 (12:15 -0700)]
Fix System.Reflection.Metadata.MetadataUpdater.IsSupported (#55874)

Issue: https://github.com/dotnet/aspnetcore/issues/34440

3 years agoUse RetryHelper to improve reliability of revocation tests (#55873)
Kevin Jones [Sat, 17 Jul 2021 19:14:36 +0000 (15:14 -0400)]
Use RetryHelper to improve reliability of revocation tests (#55873)

3 years agoRemove old snow leopard hack (#55825)
Alfonso Gregory [Sat, 17 Jul 2021 04:39:31 +0000 (00:39 -0400)]
Remove old snow leopard hack (#55825)

* Remove old hack

It’s been a long time since snow leopard and the issue should be fixed by now

* Remove declaration

* Remove unnecessary include

3 years agoDon't probe mono aot-cache directory for AOT images (#55832)
Aleksey Kliger (λgeek) [Sat, 17 Jul 2021 04:37:59 +0000 (00:37 -0400)]
Don't probe mono aot-cache directory for AOT images (#55832)

We don't have a global AOT cache directory on any platform

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

3 years agoFix debugger thread context validation after recent change (#55839)
Koundinya Veluri [Sat, 17 Jul 2021 01:37:57 +0000 (18:37 -0700)]
Fix debugger thread context validation after recent change (#55839)

Followup fix to https://github.com/dotnet/runtime/pull/55185

3 years agoReimplement dynamic member access for collection converters correctly (#55846)
Layomi Akinrinade [Fri, 16 Jul 2021 23:14:40 +0000 (16:14 -0700)]
Reimplement dynamic member access for collection converters correctly (#55846)

3 years agoFix nested calls to Assembly Load Start tracing (#55700)
David Wrighton [Fri, 16 Jul 2021 23:04:41 +0000 (16:04 -0700)]
Fix nested calls to Assembly Load Start tracing (#55700)

The name_with_pid test ends up testing the behavior of event tracing in the presence of composite images.

In the presence of a composite image, it might happen attempting to send trace data may force an attempt to load System.Private.CoreLib thus causing an stackoverflow as attempting to report the load of System.Private.CoreLib will trigger a load of System.Private.CoreLib, etc. This fix steps around the issue by using a thread local variable to skip subsequent attempts to report the load of System.Private.CoreLib.

Fixes #55786

3 years agoFix SslServerAuthenticationOptions.ApplicationProtocols empty list error #55447 ...
Chris Ross [Fri, 16 Jul 2021 21:36:53 +0000 (14:36 -0700)]
Fix SslServerAuthenticationOptions.ApplicationProtocols empty list error #55447 (#55772)

3 years agoDisable S.S.C.OpenSSL tests on the platforms that are PNSE.
Jeremy Barton [Fri, 16 Jul 2021 21:34:07 +0000 (14:34 -0700)]
Disable S.S.C.OpenSSL tests on the platforms that are PNSE.

3 years agoRe-enable some netfx tests (#55837)
Jeremy Barton [Fri, 16 Jul 2021 20:32:36 +0000 (13:32 -0700)]
Re-enable some netfx tests (#55837)

The patch states on the test machines should be in sync now...

3 years agoAccess modifier cleanup in Task (#55842)
WizardBrony [Fri, 16 Jul 2021 20:32:23 +0000 (16:32 -0400)]
Access modifier cleanup in Task (#55842)

* Update Task.cs

* Update TaskFactory.cs

3 years ago[mono] Allow overriding GetCustomAttributesData routines (#55726)
Ulrich Weigand [Fri, 16 Jul 2021 19:58:19 +0000 (21:58 +0200)]
[mono] Allow overriding GetCustomAttributesData routines (#55726)

* Merge common bits of Mono and CoreCLR CustomAttributeData implementation

* Have CustomAttributeData.GetCustomAttributes call target.GetCustomAttributesData
  to allow derived classes to override the latter (like in CoreCLR)

* Use Constructor, ConstructorArguments, and NamedArguments in internal
  routines to allow them being overridden (like with CoreCLR).

3 years agoupdate branding to rc1 (#55775)
Anirudh Agnihotry [Fri, 16 Jul 2021 17:35:38 +0000 (10:35 -0700)]
update branding to rc1 (#55775)

3 years agoFix UMEntryThunkCache::GetUMEntryThunk (#55834)
Jan Vorlicek [Fri, 16 Jul 2021 17:35:06 +0000 (19:35 +0200)]
Fix UMEntryThunkCache::GetUMEntryThunk (#55834)

The function was initializing UMThunkMarshInfo allocated from Stub heap
without using the ExecutableWriterHolder. That causes a crash when a
hosting application calls coreclr_create_delegate.
This was discovered in .NET 6 Preview 6 when running a xamarin app that
uses a special host.

This code path is exercised only by coreclr_create_delegate.

3 years agoFix case of DefaultValue using enum backing type. (#55793)
Eric StJohn [Fri, 16 Jul 2021 16:55:43 +0000 (09:55 -0700)]
Fix case of DefaultValue using enum backing type. (#55793)

3 years agoFix string comparison with ordinal casing with Surrogates (#55771)
Tarek Mahmoud Sayed [Fri, 16 Jul 2021 16:26:44 +0000 (09:26 -0700)]
Fix string comparison with ordinal casing with Surrogates (#55771)

* Fix string comparison with ordinal casing with Surrogates

* Address the feedback

3 years agoFix Http2Connection.GetIdleTicks (#55820)
Alexander Nikolaev [Fri, 16 Jul 2021 15:13:03 +0000 (17:13 +0200)]
Fix Http2Connection.GetIdleTicks (#55820)

There is currently a wrong operand order in the subtraction.

Fixes #43877

3 years agoStreamline rent/return on ArrayPool (#55710)
Stephen Toub [Fri, 16 Jul 2021 14:49:42 +0000 (10:49 -0400)]
Streamline rent/return on ArrayPool (#55710)

* Streamline rent/return on ArrayPool

- Stop storing and using a _bucketArraySizes.  It's cheaper to recompute the shift on each use than it is to index into the array (with a bounds check).  Plus less memory.
- The 99% case is renting a positive length for pooled array sizes (especially now that we've bumped the limit up to a gig).  Move the checks for lengths <= 0 to after the check for whether the length is poolable.
- Move arrays into locals to enable the JIT to eliminate some bounds checks.
- Use ThrowHelpers where we already have them
- Move non-generic helpers out of generic class into Utilities
- Consolidate buffer allocation in Rent to a single line
- Reorganize TLS checks to be as early as possible
- Use FastMod instead of % in per-core stacks

* Address PR feedback

3 years agoincrease default timout on RunClientServer methods (#55798)
Tomas Weinfurt [Fri, 16 Jul 2021 14:17:58 +0000 (07:17 -0700)]
increase default timout on RunClientServer methods (#55798)

3 years agoMake Named Pipe Server Stream name fit into allowed length on Android (#55731)
Maxim Lipnin [Fri, 16 Jul 2021 13:56:18 +0000 (16:56 +0300)]
Make Named Pipe Server Stream name fit into allowed length on Android (#55731)

* Make Named Pipe Server Stream name fit into allowed length on Android

* Apply Stephen's suggestion

* Remove redundant parameter

* Take into account possible null terminator

3 years agoRemove unnecessary intrinsics in mono/mini/intrinsics.c (#55806)
Alexander Köplinger [Fri, 16 Jul 2021 13:53:05 +0000 (15:53 +0200)]
Remove unnecessary intrinsics in mono/mini/intrinsics.c (#55806)

- System.Environment.IsRunningOnWindows doesn't exist in the dotnet/runtime corelib
- Microsoft.CodeAnalysis.CompilerServer.MemoryHelper.IsMemoryAvailable was used to workaround a bug that was fixed 2 years ago with https://github.com/dotnet/roslyn/pull/38239 and should no longer be relevant

3 years agoDisable SocketsHttpHandlerTest_Http3_MsQuic.ClientSettingsReceived_Success test ...
Karel Zikmund [Fri, 16 Jul 2021 13:52:52 +0000 (15:52 +0200)]
Disable SocketsHttpHandlerTest_Http3_MsQuic.ClientSettingsReceived_Success test (#55811)

Started failing too frequently - see #55774

3 years agoUpdate dependencies from https://github.com/dotnet/emsdk build 20210715.1 (#55784)
dotnet-maestro[bot] [Fri, 16 Jul 2021 10:49:24 +0000 (10:49 +0000)]
Update dependencies from https://github.com/dotnet/emsdk build 20210715.1 (#55784)

[main] Update dependencies from dotnet/emsdk

3 years agoUse more string interpolation (#55738)
Stephen Toub [Fri, 16 Jul 2021 10:38:51 +0000 (06:38 -0400)]
Use more string interpolation (#55738)

* Use more string interpolation

I previously did a pass looking for opportunities.  Finding a few more, as well as fixing some misuse of existing methods.

* Update src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs

Co-authored-by: halgab <24685886+halgab@users.noreply.github.com>
* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: halgab <24685886+halgab@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoAdd a time-based decay to the linear allocation model. (#55174)
Peter Sollich [Fri, 16 Jul 2021 09:58:27 +0000 (11:58 +0200)]
Add a time-based decay to the linear allocation model. (#55174)

Real world scenario that motivated this allocated a huge amount of data once a day, leading to high gen 0 and gen 1 budgets (several GB).

After this, there was relatively little activity, causing gen 1 budget to take several hours to normalize.

The new logic discounts the previous desired allocation over a period of 5 minutes.

3 years agoAnnotate WebSockets.RegisterPrefixes with [Obsolete] (#55640)
Alexander Nikolaev [Fri, 16 Jul 2021 09:37:04 +0000 (11:37 +0200)]
Annotate WebSockets.RegisterPrefixes with [Obsolete] (#55640)

Fixes #50530

3 years agoMitigate race condition in EventSource_ConnectionPoolAtMaxConnections_LogsRequestLeft...
Alexander Nikolaev [Fri, 16 Jul 2021 09:33:49 +0000 (11:33 +0200)]
Mitigate race condition in EventSource_ConnectionPoolAtMaxConnections_LogsRequestLeftQueue test (#55729)

There is a unavoidable race condition between updating event counters and reading their values in WaitForEventCountersAsync. It waits for at least 2 sets of EventCounter event groups to ensure the last group is captured after any actual work (tests check that counters reset back to 0 if there is nothing happening).
Since it looks for `requests-started` which occurs before `http11-requests-queue-duration` event, what it may see is only the tail of the last group and the start of the second, without waiting for a fresh `http11-requests-queue-duration`. In this, the assert `Assert.Equal(0, http11requestQueueDurations[^1])` on the line 549 will see a non-zero counter value and fail.

This PR changes the condition to `< 3`  to guarantee there is at least one full group of events in the window.

Co-authored by @MihaZupan

Fixes #46073

3 years agoSkip System.IO.IsolatedStorage.Tests.HelperTests.GetDataDirectory(scope: Machine...
Maxim Lipnin [Fri, 16 Jul 2021 08:47:08 +0000 (11:47 +0300)]
Skip System.IO.IsolatedStorage.Tests.HelperTests.GetDataDirectory(scope: Machine) on Android (#55719)

3 years agoDelete dead WinRT code in Activator (#55721)
Michal Strehovský [Fri, 16 Jul 2021 07:51:25 +0000 (09:51 +0200)]
Delete dead WinRT code in Activator (#55721)

3 years agoFix Unicode BiDi Category (#55790)
Tarek Mahmoud Sayed [Fri, 16 Jul 2021 04:01:18 +0000 (21:01 -0700)]
Fix Unicode BiDi Category (#55790)

3 years agoRemove sourceFullPath from Unix FileSystem.MoveDirectory exception (#55658)
Steve Berdy [Fri, 16 Jul 2021 02:32:43 +0000 (22:32 -0400)]
Remove sourceFullPath from Unix FileSystem.MoveDirectory exception (#55658)

* Update Path.Windows.cs

* Change helper method to internal

Switched method from a private protection level to an internal protection level. Also removed trailing whitespace.

* Removed sourceFullPath from Unix FileSystem.MoveDirectory thrown exception

* Undo commit from main fork branch

* Revert FileSystem.Windows.cs changes

3 years agoAdd a System.Runtime.Experimental package so users can still use the generic math...
Tanner Gooding [Fri, 16 Jul 2021 01:23:31 +0000 (18:23 -0700)]
Add a System.Runtime.Experimental package so users can still use the generic math preview (#55678)

* Add a System.Runtime.Experimental package so users can still use the generic math preview

This reverts commit f6eb259db626d563c15ba340feb6f440d1e1c8ee.

* Simplify S.R.Experimental so it only produces a ref and its build version is 100 higher

* Ensure a nuget package is being produced and resolve PR feedback

* Update src/libraries/System.Runtime.Experimental/Directory.Build.props

* Add a reference to System.Runtime.Experimental so mono can build

* Disable System.Runtime.Experimental.Tests on WASM AOT

3 years ago[main] Update dependencies from 8 repositories (#55636)
dotnet-maestro[bot] [Thu, 15 Jul 2021 22:27:46 +0000 (15:27 -0700)]
[main] Update dependencies from 8 repositories (#55636)

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.GenFacades , Microsoft.DotNet.GenAPI , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21359.3 -> To Version 6.0.0-beta.21363.2

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 6.0.0-preview.7.21362.1 -> To Version 6.0.0-preview.7.21363.1

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21357.4 -> To Version 1.0.0-prerelease.21363.1

* Update dependencies from https://github.com/mono/linker build 20210713.1

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21362.3 -> To Version 6.0.100-preview.6.21363.1

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20210712.2

Microsoft.CodeAnalysis.NetAnalyzers
 From Version 6.0.0-rc1.21356.1 -> To Version 6.0.0-rc1.21362.2

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

Microsoft.NET.Workload.Emscripten.Manifest-6.0.100
 From Version 6.0.0-preview.7.21363.1 -> To Version 6.0.0-preview.7.21364.1

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

optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.21362.2 -> To Version 1.0.0-prerelease.21364.4

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.GenFacades , Microsoft.DotNet.GenAPI , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 6.0.0-beta.21359.3 -> To Version 6.0.0-beta.21364.3

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21357.4 -> To Version 1.0.0-prerelease.21364.1

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

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.0.1-alpha.0.21362.1 -> To Version 1.0.1-alpha.0.21364.1

* Revert linker change

* Roll back the version

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Andy Gocke <angocke@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
3 years agoUse pbeWithSHAAnd3-KeyTripleDES-CBC for SignedXml certificate.
Kevin Jones [Thu, 15 Jul 2021 22:09:02 +0000 (18:09 -0400)]
Use pbeWithSHAAnd3-KeyTripleDES-CBC for SignedXml certificate.

This changes the PKCS12 from being using RC2 to 3DES so that the test
passes on Android, which does not support RC2.

3 years ago[wasm] Support mono runtime components (#55680)
Radek Doulik [Thu, 15 Jul 2021 21:40:57 +0000 (23:40 +0200)]
[wasm] Support mono runtime components (#55680)

* [wasm] Support mono runtime components

* Do not use diagnostics_tracing component

* Allow custom @(_MonoComponent)

* Update src/mono/wasm/build/WasmApp.Native.targets

* Select components only with native workload

* Fixing CI when linking with stubs

* Adding what @radical asked for.

* Update sendtohelixhelp.proj

Fix helix work item prefix

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Thays <thaystg@gmail.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
3 years agoStringSegment behavior (#55501)
hrrrrustic [Thu, 15 Jul 2021 20:54:13 +0000 (23:54 +0300)]
StringSegment behavior (#55501)

* Add tests for old issue

* Add test for new issue

* fix behavior for old issue

* fix behavior for new issue

* Update IndexOf checks for consistency

Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
3 years ago[wasm] Misc follow up improvements for workloads testing (#55647)
Ankit Jain [Thu, 15 Jul 2021 20:49:16 +0000 (16:49 -0400)]
[wasm] Misc follow up improvements for workloads testing (#55647)

* [wasm] Move UseMonoRuntime=true to WasmApp.props

* Move workloads installation for testing bits to

.. `src/libraries/workloads-testing.targets`.

* [wasm] EmccCompile: don't log `stderr` messages as warnings

emcc emits some (debug?) messages on stderr too, which are not always
errors. Emitting them as warning can be break the build too, when
running with warningsAsErrors .

* [wasm] Fix helix work item prefix

* improve readability of messages from parallel EmccCompile

* Improve emscripten version mismatch message, and convert to a warning

* Fix typo, so WBT runs can be differentiated correctly

3 years ago[class] Add GC Unsafe transitions to a few more external only functions (#55748)
Aleksey Kliger (λgeek) [Thu, 15 Jul 2021 20:44:40 +0000 (16:44 -0400)]
[class] Add GC Unsafe transitions to a few more external only functions (#55748)

3 years agoAdd option to MonoAOTCompiler msbuild task to generate .so files (#55753)
Alexander Köplinger [Thu, 15 Jul 2021 20:40:54 +0000 (22:40 +0200)]
Add option to MonoAOTCompiler msbuild task to generate .so files (#55753)

3 years agoXmlSerializer dont skip date time offset (#55101)
Steve Molloy [Thu, 15 Jul 2021 20:37:37 +0000 (13:37 -0700)]
XmlSerializer dont skip date time offset (#55101)

* Add DateTimeOffset as a primitive for XmlSerializer.

* Fix DefaultValueAttribute handling for DTO.

* Add tests for DateTimeAttribute and XmlSerializer.

* Missed a 'KnownType' spot.

* Update SGen tests to use current dotnet.exe from build.

* Unbreak runtimeconfig creation for testing.

* Debugging failure to resolve CoreCLR path.

* Test fixup.

* More test cleanup.

* Temporarily disable generator tests.

* Use InitObj instead of constructors for DateTimeOffset and TimeSpan.

3 years agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 124001...
dotnet bot [Thu, 15 Jul 2021 20:07:34 +0000 (13:07 -0700)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 1240010 (#55743)

* Localized file check-in by OneLocBuild Task

* Remove asserts against localized text from Logging generator tests

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
3 years agoUse local assertion prop to omit casts on returns (#55632)
SingleAccretion [Thu, 15 Jul 2021 18:55:09 +0000 (21:55 +0300)]
Use local assertion prop to omit casts on returns (#55632)

When inserting normalizing casts for returns in pre-order
morph, "fgMorphCast" was used, which did not account for
the fact that local assertion propagation could tell us
that the cast is in fact unnecessary. Fix this by calling
"fgMorphTree" instead.

Also some miscellaneous code cleanup.

3 years agoRemove support for deprecated obs-fold in header values (#53505)
Miha Zupan [Thu, 15 Jul 2021 18:47:04 +0000 (11:47 -0700)]
Remove support for deprecated obs-fold in header values (#53505)

* Remove support for deprecated obs-fold in header values

* Add new-line validation to Well-Known header parsing

3 years agoDo abortive connection shutdown in MsQuicConnection.Dispose (#55493)
Geoff Kizer [Thu, 15 Jul 2021 18:42:40 +0000 (11:42 -0700)]
Do abortive connection shutdown in MsQuicConnection.Dispose (#55493)

* do abortive connection shutdown in MsQuicConnection.Dispose, add test for CloseAsync and Dispose, and remove CloseAsync from RunClientServer as it should not be necessary anymore

* CloseAsync is no-op if disposed

* more review feedback

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoSupport more collections in STJ source generator (#55566)
Layomi Akinrinade [Thu, 15 Jul 2021 18:41:56 +0000 (11:41 -0700)]
Support more collections in STJ source generator (#55566)

* Support more collections in STJ source generator

* Fix tests

* Revert redundant MLC change and address feedback

3 years agoImprove `TryTransformStoreObjAsStoreInd` optimization. (#55727)
Sergey Andreenko [Thu, 15 Jul 2021 18:13:15 +0000 (11:13 -0700)]
Improve `TryTransformStoreObjAsStoreInd` optimization. (#55727)

* Fix `TryTransformStoreObjAsStoreInd` optimization.

* Disable the assert.

It was failing on DevDiv_280120 arm32 linux, did not repro with an altjit.

3 years agoIncrease max loops optimized by RyuJIT from 16 to 64. (#55614)
Bruce Forstall [Thu, 15 Jul 2021 17:52:36 +0000 (10:52 -0700)]
Increase max loops optimized by RyuJIT from 16 to 64. (#55614)

16 seems remarkably small. Note that this number is used to allocate the
statically-sized loop table, as well as for memory allocation for value
numbering, so there is some overhead to increasing it.

A few microbenchmarks that have diffs show benefit, including 9% for MulMatrix

| Method |        Job |                                                                         Toolchain |     Mean |   Error |  StdDev |   Median |      Min |      Max | Ratio |
|------- |----------- |---------------------------------------------------------------------------------- |---------:|--------:|--------:|---------:|---------:|---------:|------:|
| LLoops | Job-JXEMSM | \runtime2\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\CoreRun.exe | 559.9 ms | 8.20 ms | 7.67 ms | 556.4 ms | 550.6 ms | 576.0 ms |  1.00 |
| LLoops | Job-MUOLTV |  \runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\CoreRun.exe | 552.3 ms | 5.84 ms | 5.46 ms | 552.0 ms | 542.4 ms | 561.1 ms |  0.99 |
| MulMatrix | Job-JXEMSM | \runtime2\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\CoreRun.exe | 369.7 ms | 4.01 ms | 3.56 ms | 369.9 ms | 364.6 ms | 376.9 ms |  1.00 |
| MulMatrix | Job-MUOLTV |  \runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\CoreRun.exe | 338.1 ms | 2.69 ms | 2.51 ms | 337.7 ms | 332.2 ms | 341.9 ms |  0.91 |
| Puzzle | Job-JXEMSM | \runtime2\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\CoreRun.exe | 403.4 ms | 6.93 ms | 6.48 ms | 402.3 ms | 394.8 ms | 412.5 ms |  1.00 |
| Puzzle | Job-MUOLTV |  \runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\CoreRun.exe | 394.9 ms | 4.16 ms | 3.68 ms | 395.5 ms | 388.2 ms | 401.8 ms |  0.98 |

spmi diffs:

```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 6264
Total bytes of diff: 6285
Total bytes of delta: 21 (0.34% of base)
Total relative delta: 0.00
    diff is a regression.
    relative diff is a regression.
```
<details>

<summary>Detail diffs</summary>

```

Top file regressions (bytes):
          21 : 42451.dasm (0.34% of base)

1 total files with Code Size differences (0 improved, 1 regressed), 0 unchanged.

Top method regressions (bytes):
          21 ( 0.34% of base) : 42451.dasm - RelationalModel:Create(IModel,IRelationalAnnotationProvider):IRelationalModel

Top method regressions (percentages):
          21 ( 0.34% of base) : 42451.dasm - RelationalModel:Create(IModel,IRelationalAnnotationProvider):IRelationalModel

1 total methods with Code Size differences (0 improved, 1 regressed), 0 unchanged.

```

</details>

--------------------------------------------------------------------------------

```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 39243
Total bytes of diff: 39940
Total bytes of delta: 697 (1.78% of base)
Total relative delta: 0.16
    diff is a regression.
    relative diff is a regression.
```
<details>

<summary>Detail diffs</summary>

```

Top file regressions (bytes):
         536 : 25723.dasm (18.29% of base)
         185 : 26877.dasm (2.21% of base)
          66 : 16212.dasm (1.39% of base)
          16 : 16196.dasm (0.36% of base)
          13 : 13322.dasm (0.27% of base)
           9 : 15596.dasm (0.16% of base)

Top file improvements (bytes):
        -125 : 27270.dasm (-6.93% of base)
          -3 : 13993.dasm (-0.05% of base)

8 total files with Code Size differences (2 improved, 6 regressed), 0 unchanged.

Top method regressions (bytes):
         536 (18.29% of base) : 25723.dasm - Benchstone.BenchI.MulMatrix:Inner(System.Int32[][],System.Int32[][],System.Int32[][])
         185 ( 2.21% of base) : 26877.dasm - Benchstone.BenchF.LLoops:Main1(int):this
          66 ( 1.39% of base) : 16212.dasm - Jil.Deserialize.Methods:SkipWithLeadChar(System.IO.TextReader,int)
          16 ( 0.36% of base) : 16196.dasm - DynamicClass:_DynamicMethod9(System.IO.TextReader,int):MicroBenchmarks.Serializers.MyEventsListerViewModel
          13 ( 0.27% of base) : 13322.dasm - DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
           9 ( 0.16% of base) : 15596.dasm - DynamicClass:_DynamicMethod9(byref,int):MicroBenchmarks.Serializers.MyEventsListerViewModel

Top method improvements (bytes):
        -125 (-6.93% of base) : 27270.dasm - Benchstone.BenchI.Puzzle:DoIt():bool:this
          -3 (-0.05% of base) : 13993.dasm - Jil.Deserialize.Methods:SkipWithLeadCharThunkReader(byref,int)

Top method regressions (percentages):
         536 (18.29% of base) : 25723.dasm - Benchstone.BenchI.MulMatrix:Inner(System.Int32[][],System.Int32[][],System.Int32[][])
         185 ( 2.21% of base) : 26877.dasm - Benchstone.BenchF.LLoops:Main1(int):this
          66 ( 1.39% of base) : 16212.dasm - Jil.Deserialize.Methods:SkipWithLeadChar(System.IO.TextReader,int)
          16 ( 0.36% of base) : 16196.dasm - DynamicClass:_DynamicMethod9(System.IO.TextReader,int):MicroBenchmarks.Serializers.MyEventsListerViewModel
          13 ( 0.27% of base) : 13322.dasm - DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
           9 ( 0.16% of base) : 15596.dasm - DynamicClass:_DynamicMethod9(byref,int):MicroBenchmarks.Serializers.MyEventsListerViewModel

Top method improvements (percentages):
        -125 (-6.93% of base) : 27270.dasm - Benchstone.BenchI.Puzzle:DoIt():bool:this
          -3 (-0.05% of base) : 13993.dasm - Jil.Deserialize.Methods:SkipWithLeadCharThunkReader(byref,int)

8 total methods with Code Size differences (2 improved, 6 regressed), 0 unchanged.

```

</details>

--------------------------------------------------------------------------------

```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 142908
Total bytes of diff: 143387
Total bytes of delta: 479 (0.34% of base)
Total relative delta: 0.42
    diff is a regression.
    relative diff is a regression.
```
<details>

<summary>Detail diffs</summary>

```

Top file regressions (bytes):
         536 : 248723.dasm (18.29% of base)
         390 : 220441.dasm (14.45% of base)
         390 : 220391.dasm (14.61% of base)
         150 : 239253.dasm (1.78% of base)
          71 : 234803.dasm (1.72% of base)
          16 : 225588.dasm (1.00% of base)
          16 : 225590.dasm (1.00% of base)
           5 : 225285.dasm (0.26% of base)

Top file improvements (bytes):
        -359 : 215690.dasm (-0.99% of base)
        -320 : 215701.dasm (-1.16% of base)
        -128 : 215723.dasm (-0.73% of base)
        -128 : 215666.dasm (-0.62% of base)
        -125 : 239280.dasm (-6.93% of base)
         -29 : 216754.dasm (-0.33% of base)
          -3 : 225316.dasm (-0.15% of base)
          -3 : 225313.dasm (-0.15% of base)

16 total files with Code Size differences (8 improved, 8 regressed), 0 unchanged.

Top method regressions (bytes):
         536 (18.29% of base) : 248723.dasm - Benchstone.BenchI.MulMatrix:Inner(System.Int32[][],System.Int32[][],System.Int32[][])
         390 (14.45% of base) : 220441.dasm - VectorTest:Main():int
         390 (14.61% of base) : 220391.dasm - VectorTest:Main():int
         150 ( 1.78% of base) : 239253.dasm - Benchstone.BenchF.LLoops:Main1(int):this
          71 ( 1.72% of base) : 234803.dasm - SmallLoop1:Main():int
          16 ( 1.00% of base) : 225588.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
          16 ( 1.00% of base) : 225590.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
           5 ( 0.26% of base) : 225285.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int

Top method improvements (bytes):
        -359 (-0.99% of base) : 215690.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
        -320 (-1.16% of base) : 215701.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
        -128 (-0.73% of base) : 215723.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
        -128 (-0.62% of base) : 215666.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
        -125 (-6.93% of base) : 239280.dasm - Benchstone.BenchI.Puzzle:DoIt():bool:this
         -29 (-0.33% of base) : 216754.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
          -3 (-0.15% of base) : 225316.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
          -3 (-0.15% of base) : 225313.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int

Top method regressions (percentages):
         536 (18.29% of base) : 248723.dasm - Benchstone.BenchI.MulMatrix:Inner(System.Int32[][],System.Int32[][],System.Int32[][])
         390 (14.61% of base) : 220391.dasm - VectorTest:Main():int
         390 (14.45% of base) : 220441.dasm - VectorTest:Main():int
         150 ( 1.78% of base) : 239253.dasm - Benchstone.BenchF.LLoops:Main1(int):this
          71 ( 1.72% of base) : 234803.dasm - SmallLoop1:Main():int
          16 ( 1.00% of base) : 225588.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
          16 ( 1.00% of base) : 225590.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
           5 ( 0.26% of base) : 225285.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int

Top method improvements (percentages):
        -125 (-6.93% of base) : 239280.dasm - Benchstone.BenchI.Puzzle:DoIt():bool:this
        -320 (-1.16% of base) : 215701.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
        -359 (-0.99% of base) : 215690.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
        -128 (-0.73% of base) : 215723.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
        -128 (-0.62% of base) : 215666.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
         -29 (-0.33% of base) : 216754.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
          -3 (-0.15% of base) : 225316.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
          -3 (-0.15% of base) : 225313.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int

16 total methods with Code Size differences (8 improved, 8 regressed), 0 unchanged.

```

</details>

--------------------------------------------------------------------------------

```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 15351
Total bytes of diff: 15448
Total bytes of delta: 97 (0.63% of base)
Total relative delta: 0.08
    diff is a regression.
    relative diff is a regression.
```
<details>

<summary>Detail diffs</summary>

```

Top file regressions (bytes):
          71 : 63973.dasm (7.63% of base)
          26 : 106039.dasm (0.19% of base)

2 total files with Code Size differences (0 improved, 2 regressed), 1 unchanged.

Top method regressions (bytes):
          71 ( 7.63% of base) : 63973.dasm - Microsoft.Diagnostics.Tracing.Parsers.Symbol.FileVersionTraceData:ToXml(System.Text.StringBuilder):System.Text.StringBuilder:this
          26 ( 0.19% of base) : 106039.dasm - Microsoft.VisualBasic.CompilerServices.VBBinder:BindToMethod(int,System.Reflection.MethodBase[],byref,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[],byref):System.Reflection.MethodBase:this

Top method regressions (percentages):
          71 ( 7.63% of base) : 63973.dasm - Microsoft.Diagnostics.Tracing.Parsers.Symbol.FileVersionTraceData:ToXml(System.Text.StringBuilder):System.Text.StringBuilder:this
          26 ( 0.19% of base) : 106039.dasm - Microsoft.VisualBasic.CompilerServices.VBBinder:BindToMethod(int,System.Reflection.MethodBase[],byref,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[],byref):System.Reflection.MethodBase:this

2 total methods with Code Size differences (0 improved, 2 regressed), 1 unchanged.

```

</details>

--------------------------------------------------------------------------------

```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 22540
Total bytes of diff: 22576
Total bytes of delta: 36 (0.16% of base)
Total relative delta: 0.01
    diff is a regression.
    relative diff is a regression.
```
<details>

<summary>Detail diffs</summary>

```

Top file regressions (bytes):
          23 : 104600.dasm (0.15% of base)
          14 : 43143.dasm (0.47% of base)

Top file improvements (bytes):
          -1 : 35267.dasm (-0.03% of base)

3 total files with Code Size differences (1 improved, 2 regressed), 0 unchanged.

Top method regressions (bytes):
          23 ( 0.15% of base) : 104600.dasm - Microsoft.VisualBasic.CompilerServices.VBBinder:BindToMethod(int,System.Reflection.MethodBase[],byref,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[],byref):System.Reflection.MethodBase:this
          14 ( 0.47% of base) : 43143.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:ForceComplete(Microsoft.CodeAnalysis.SourceLocation,System.Threading.CancellationToken):this

Top method improvements (bytes):
          -1 (-0.03% of base) : 35267.dasm - Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser:ParseNamespaceBody(byref,byref,byref,ushort):this

Top method regressions (percentages):
          14 ( 0.47% of base) : 43143.dasm - Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:ForceComplete(Microsoft.CodeAnalysis.SourceLocation,System.Threading.CancellationToken):this
          23 ( 0.15% of base) : 104600.dasm - Microsoft.VisualBasic.CompilerServices.VBBinder:BindToMethod(int,System.Reflection.MethodBase[],byref,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[],byref):System.Reflection.MethodBase:this

Top method improvements (percentages):
          -1 (-0.03% of base) : 35267.dasm - Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser:ParseNamespaceBody(byref,byref,byref,ushort):this

3 total methods with Code Size differences (1 improved, 2 regressed), 0 unchanged.

```

</details>

--------------------------------------------------------------------------------

```

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 53782
Total bytes of diff: 53837
Total bytes of delta: 55 (0.10% of base)
Total relative delta: 0.00
    diff is a regression.
    relative diff is a regression.
```
<details>

<summary>Detail diffs</summary>

```

Top file regressions (bytes):
          28 : 28889.dasm (0.16% of base)
          27 : 28887.dasm (0.15% of base)

2 total files with Code Size differences (0 improved, 2 regressed), 2 unchanged.

Top method regressions (bytes):
          28 ( 0.16% of base) : 28889.dasm - ManagedTests.DynamicCSharp.Conformance.dynamic.statements.freach.freach003.freach003.Test:MainMethod():int
          27 ( 0.15% of base) : 28887.dasm - ManagedTests.DynamicCSharp.Conformance.dynamic.statements.freach.freach004.freach004.Test:MainMethod():int

Top method regressions (percentages):
          28 ( 0.16% of base) : 28889.dasm - ManagedTests.DynamicCSharp.Conformance.dynamic.statements.freach.freach003.freach003.Test:MainMethod():int
          27 ( 0.15% of base) : 28887.dasm - ManagedTests.DynamicCSharp.Conformance.dynamic.statements.freach.freach004.freach004.Test:MainMethod():int

2 total methods with Code Size differences (0 improved, 2 regressed), 2 unchanged.

```

</details>

--------------------------------------------------------------------------------

3 years agoFix crash with unmapped shuffle thunk stub (#55718)
Jan Vorlicek [Thu, 15 Jul 2021 17:45:43 +0000 (19:45 +0200)]
Fix crash with unmapped shuffle thunk stub (#55718)

This change fixes an intermittent issue that was showing up in
the System.Linq.Expressions.Tests suite. When the delegate class
was in a collectible ALC, some of the stubs were being used even
after the underlying loader allocator was deleted, thus the memory
the stubs occupied was already unmapped.

Before my recent W^X change, the stubs were always being allocated
from an executable allocator / executable heap in the global loader
allocator due to a bug in the AssemblyLoaderAllocator::SetCollectible
and AssemblyLoaderAllocator::Init ordering (the SetCollectible
was being called before the Init, so the m_pStubHeap was not yet
set and the ShuffleThunkCache was being passed NULL as the heap
pointer. The cache handles that case as a request to allocate from
global executable heap.

In this fix, I've changed the AssemblyLoaderAllocator::Init to pass
the SystemDomain::GetGlobalLoaderAllocator()->GetExecutableHeap()
as the heap to the ShuffleThunkCache constructor. It is a workaround
until the actual issue with stubs outliving the delegate classes
is understood and fixed.

Besides the fix, this change also fixes two unrelated issues that
would only possibly cause trouble when the W^X is enabled. There
were two places where memory was being reserved by the new
ExecutableAllocator, but cleaned up using the ClrVirtualFree.

3 years agoinFlight ref-counting of strong GCHandle for JSObject, while in flight over the manag...
Pavel Savara [Thu, 15 Jul 2021 17:23:27 +0000 (19:23 +0200)]
inFlight ref-counting of strong GCHandle for JSObject, while in flight over the managed/JS boundary (#54453)

3 years agoRelax LinkTarget so it always returns null when steps on an error (#55668)
David Cantú [Thu, 15 Jul 2021 16:52:42 +0000 (09:52 -0700)]
Relax LinkTarget so it always returns null when steps on an error (#55668)