platform/upstream/dotnet/runtime.git
2 years agoMerge feature/use-dllimport-generator to main #59579
Santiago Fernandez Madero [Mon, 18 Oct 2021 23:12:39 +0000 (16:12 -0700)]
Merge feature/use-dllimport-generator to main #59579

2 years agoFix for #60532 (#60572)
Tomáš Rylek [Mon, 18 Oct 2021 20:51:09 +0000 (22:51 +0200)]
Fix for #60532 (#60572)

In stable package mode we should be setting CoreLib informational
version to the ProductVersion according to the discussion on the
issue thread. I have verified locally that this fixes the processinfo2
test for me that was previously failing in the StabilizePackageVersion
mode. Please let me know how to proceed with the fix, whether you
want me to just merge it into dotnet/runtime main, whether I should
pursue its backport into 6.0 release and / or whether Matt considers
cherry-picking my change to his stabilization PR.

Thanks

Tomas

2 years ago[mono] Fix more usages of MonoType:byref (#60551)
Alexander Köplinger [Mon, 18 Oct 2021 18:12:41 +0000 (20:12 +0200)]
[mono] Fix more usages of MonoType:byref (#60551)

Those were missed in https://github.com/dotnet/runtime/pull/60313 and caused a build break on s390x.
I fixed all other occurences I could find too.

2 years ago[metadata] Cleanup some uses of m_class_get_this_arg (#60557)
Aleksey Kliger (λgeek) [Mon, 18 Oct 2021 18:03:30 +0000 (14:03 -0400)]
[metadata] Cleanup some uses of m_class_get_this_arg (#60557)

* Change m_class_get_this_arg->mono_class_get_byref_type when it creates byrefs

In cases where it's evident the intent is to create a byref type around a known
type, use mono_class_get_byref_type instead of the this_arg getter.

No functional change, but sets the stage.

* [jit] Remove unneeded call to m_class_get_this_arg

type_check_context_used for  this_arg will be the same as for byval_arg

2 years agoAvoid a small int[] allocation in StringBuilder.Replace (#60406)
Stephen Toub [Mon, 18 Oct 2021 16:39:08 +0000 (12:39 -0400)]
Avoid a small int[] allocation in StringBuilder.Replace (#60406)

2 years agoDisable PerformanceCounter_NextValue_ProcessorCounter on Windows ARM64 (#60553)
Krzysztof Wicher [Mon, 18 Oct 2021 15:04:25 +0000 (17:04 +0200)]
Disable PerformanceCounter_NextValue_ProcessorCounter on Windows ARM64 (#60553)

2 years agoRemove FlakyAppHostTests category in installer tests (#60354)
Alexander Köplinger [Mon, 18 Oct 2021 13:56:00 +0000 (15:56 +0200)]
Remove FlakyAppHostTests category in installer tests (#60354)

The underlying issue was fixed: https://github.com/dotnet/runtime/issues/53587

2 years agoImplement IAsyncEnumerable<T>.ToBlockingEnumerable (#60363)
Eirik Tsarpalis [Mon, 18 Oct 2021 13:35:41 +0000 (14:35 +0100)]
Implement IAsyncEnumerable<T>.ToBlockingEnumerable (#60363)

* Implement IAsyncEnumerable<T>.ToBlockingEnumerable

* address feedback

* update test assertion

* Add UnsupportedOSPlatform annotation to internal helper class

* restrict tests to platforms that support threading

2 years agoFixed outerloop tests after #60181 (#60465)
Marie Píchová [Mon, 18 Oct 2021 12:13:47 +0000 (14:13 +0200)]
Fixed outerloop tests after #60181 (#60465)

2 years ago[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade...
dotnet-maestro[bot] [Mon, 18 Oct 2021 10:40:06 +0000 (10:40 +0000)]
[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade dotnet/runtime-assets dotnet/msquic (#60503)

[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade dotnet/runtime-assets dotnet/msquic

2 years ago[interp] Fix sufficient stack check when using interpreter (#60514)
Vlad Brezae [Sun, 17 Oct 2021 15:48:39 +0000 (18:48 +0300)]
[interp] Fix sufficient stack check when using interpreter (#60514)

The icall was only checking the real stack pointer of the thread. The interpreter uses its own execution stack in addition, so we also need to check for overflow there.

2 years agoReflection Invoke share more coreclr/mono (#60270)
Aaron Robinson [Sat, 16 Oct 2021 16:18:44 +0000 (09:18 -0700)]
Reflection Invoke share more coreclr/mono (#60270)

* Remove ActiveIssues from some mono tests.

* Convert INVOCATION_FLAGS enum to repo style casing.

* Rename various files to match partial class style.

2 years agoFix of https://github.com/dotnet/runtime/issues/60480 issue (#60502)
Alexander Radchenko [Sat, 16 Oct 2021 13:30:38 +0000 (20:30 +0700)]
Fix of https://github.com/dotnet/runtime/issues/60480 issue (#60502)

2 years agostring interpolation instead of concatenation (#60490)
Pavel Savara [Sat, 16 Oct 2021 07:22:31 +0000 (09:22 +0200)]
string interpolation instead of concatenation (#60490)

2 years agoFix Int32 overflow bug in buffering logic (#60459)
Adam Sitnik [Fri, 15 Oct 2021 21:19:59 +0000 (23:19 +0200)]
Fix Int32 overflow bug in buffering logic (#60459)

* add a failing test

* fix the bug in BufferedFileStreamStrategy

* extend the test and fix it in the BufferedStream as well

* large files are currently not supported on WASM

* Apply suggestions from code review

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
2 years agoMerge branch 'main' into feature/use-dllimport-generator
Elinor Fung [Fri, 15 Oct 2021 21:16:34 +0000 (14:16 -0700)]
Merge branch 'main' into feature/use-dllimport-generator

2 years agodisable flaky ReadAllBytes_NonSeekableFileStream_InWindows (#60471)
Adam Sitnik [Fri, 15 Oct 2021 19:43:36 +0000 (21:43 +0200)]
disable flaky ReadAllBytes_NonSeekableFileStream_InWindows (#60471)

* shorten the timeout

* try to reorder the operations

* Revert "try to reorder the operations"

This reverts commit 413ee9b14f114246fc5659d4a1515e6fefc21cd2.

* disable the test for now

2 years agoUpdate dependencies from https://github.com/dotnet/linker build 20211013.1 (#60397)
dotnet-maestro[bot] [Fri, 15 Oct 2021 19:34:00 +0000 (21:34 +0200)]
Update dependencies from https://github.com/dotnet/linker build 20211013.1 (#60397)

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21511.1 -> To Version 7.0.100-1.21513.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade...
dotnet-maestro[bot] [Fri, 15 Oct 2021 19:32:54 +0000 (21:32 +0200)]
[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade dotnet/msquic (#60396)

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

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.21512.6 -> To Version 1.0.0-prerelease.21513.6

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Build.Tasks.Templating , 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 7.0.0-beta.21512.3 -> To Version 7.0.0-beta.21513.5

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

System.Net.MsQuic.Transport
 From Version 6.0.0-preview.7.21512.1 -> To Version 6.0.0-preview.7.21514.1

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

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.21512.6 -> To Version 1.0.0-prerelease.21514.8

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Build.Tasks.Templating , 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 7.0.0-beta.21512.3 -> To Version 7.0.0-beta.21514.3

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

System.Net.MsQuic.Transport
 From Version 6.0.0-preview.7.21512.1 -> To Version 6.0.0-preview.7.21514.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix null being passed to g_path_get_dirname when probing in wasm (#60445)
Katelyn Gadd [Fri, 15 Oct 2021 19:25:45 +0000 (12:25 -0700)]
Fix null being passed to g_path_get_dirname when probing in wasm (#60445)

Fix null being passed to g_path_get_dirname when probing in wasm

2 years ago[mono/win] Increase stack size (reserve) to 8MB (#60265)
Radek Doulik [Fri, 15 Oct 2021 18:40:29 +0000 (20:40 +0200)]
[mono/win] Increase stack size (reserve) to 8MB (#60265)

Fix https://github.com/dotnet/runtime/issues/57141 in windows build.

Set the stack size (reserve) to 8MB, which is usually a default
on linux. This way we should get similar behavior on windows.

    > dumpbin.exe /headers artifacts\bin\mono\Browser.wasm.Debug\cross\browser-wasm\mono-aot-cross.exe|Select-String -Pattern stack

          800000 size of stack reserve
            1000 size of stack commit

2 years agoEliminate pre-built assets during source-build (#60370)
Eric Erhardt [Fri, 15 Oct 2021 18:20:38 +0000 (13:20 -0500)]
Eliminate pre-built assets during source-build (#60370)

* Remove RefOnly dependency versions

This allows for source-build to replace these versions with source-built versions.

* Eliminate usages of pre-built packages during source-build

* Don't build MSBuild tasks for netfx during source-build
* Don't build Microsoft.Windows.Compatibility during source-build
* Don't build test projects during source-build
* Don't restore Microsoft.DiaSymReader.Native
* Don't build source generators that target older Roslyn versions
* Don't build ILStripTask since it uses a Mono.Cecil "sources" NuGet package that isn't part of source-build

2 years agoUndo solution and config changes from DllImportGenerator (#60481)
Elinor Fung [Fri, 15 Oct 2021 18:06:12 +0000 (11:06 -0700)]
Undo solution and config changes from DllImportGenerator (#60481)

* Remove dotnet-experimental feed from NuGet.config
* Revert changes to solution files and restore configs

2 years agoApply custom Message and Url to all [RequiresPreviewFeatures] attributes (#60379)
Buyaa Namnan [Fri, 15 Oct 2021 17:05:43 +0000 (10:05 -0700)]
Apply custom Message and Url to all [RequiresPreviewFeatures] attributes (#60379)

2 years agoImprove value numbering for casts (#59841)
SingleAccretion [Fri, 15 Oct 2021 15:37:23 +0000 (18:37 +0300)]
Improve value numbering for casts (#59841)

* Refactor how casts are VNed, part 1

Remove duplication between VNPairForCast
and VNForCast, route the former through
the latter.

Also change the debug output for casts.

No diffs for this commit.

* Refactor how casts are VNed, part 2

VN cast helpers just like casts.
This allows them to be folded.

In the past, this was dangerous because some of
the pessimization protected us from undefined
behavior in cases of out-of-bounds conversions,
but now we do not fold such cases anymore.

* Enable VN-based constant propagation for calls

This solves some of the regressions seen due to
now-missing CSEs of these helper calls evaluated
as constants by VN.

* Fix VNFuncs for MUL_OVF helpers

This fixes the test failures revealed by
the more aggressive constant propagation.

This is very similar to a bug that was recently
fixed where checked casts were treated as non-checked
and could be observed without the assertion propagation
changes as well, with the redundant branches optimization.

3 years agoUnify set-reg-to-imm functions and optimize with LEA at runtime on x64 (#60228)
Jakob Botsch Nielsen [Fri, 15 Oct 2021 08:43:07 +0000 (10:43 +0200)]
Unify set-reg-to-imm functions and optimize with LEA at runtime on x64 (#60228)

This change
* Unifies the genSetRegToImm and instGen_Set_Reg_To_Imm functions,
  removing the former. genSetRegToImm seems to be a variant that did not
  support relocations/handles, while the latter supported both. We now
  exclusively use the emitAttr to determine this. This was only a change
  in xarch since on ARM architectures the former function just forwarded
  to the latter.
* Generates lea more often for handle GT_CNS_INT nodes on x64.
  Previously the logic generated only lea when a relocation was
  *required*, which is only the case for prejit. In particular, all VSD
  calls load an indirection cell that can use lea instead of the longer
  mov encoding during runtime JIT, which results in a nice code size
  decrease.
* Changes ARM64 and ARM to handle byref-typed GT_CNS_INT nodes. This was
  fixed for xarch a few years back in
  52a8890da45ce320ce84fdc3975d887ff814c678 but that change was not made
  to ARM architectures.

3 years agoOptimize indirection cell call sequences more generally (#59602)
Jakob Botsch Nielsen [Fri, 15 Oct 2021 08:02:10 +0000 (10:02 +0200)]
Optimize indirection cell call sequences more generally (#59602)

Currently we apply an optimization for ARM architectures where we make
sure we do not duplicate instructions to compute the target address for
calls that involve indirection cells, instead loading it from the
indirection cell directly. We can apply this optimization for x64 VSD
and tailcalls that also use indirection cells. This decreases the size
of these calls.

I have also included a bug fix for ARM/ARM64: the optimization was only
enabled under FEATURE_READYTORUN which is not always defined (e.g. in
single-file scenarios).

3 years ago[mono][interp] Add a missing else to the delegate init code. (#60433)
Zoltan Varga [Fri, 15 Oct 2021 06:13:58 +0000 (08:13 +0200)]
[mono][interp] Add a missing else to the delegate init code. (#60433)

This caused the if (del->method) slowpath to be always taken.

3 years agoRemove duplicate entries from dotnet --info (#60376)
Eric StJohn [Thu, 14 Oct 2021 23:41:39 +0000 (16:41 -0700)]
Remove duplicate entries from dotnet --info (#60376)

* Remove duplicate entries from dotnet --info

* Remove trailing slashes from globally registered locations as well

* PR feedback

Co-authored-by: vitek-karas <vitek.karas@microsoft.com>
3 years agoFinish SuperPMI collect testing (#60432)
Bruce Forstall [Thu, 14 Oct 2021 23:33:12 +0000 (16:33 -0700)]
Finish SuperPMI collect testing (#60432)

1. Remove testing workaround to upload to "test_collect" special
JIT-EE version number.
2. Fix one YML bug
3. Reduce superpmi replay pipeline timeout

3 years agoSystem.Drawing.Common.Tests fail ToLogFont_Invoke tests on non English Windows (...
Alexander Radchenko [Thu, 14 Oct 2021 22:17:57 +0000 (05:17 +0700)]
System.Drawing.Common.Tests fail ToLogFont_Invoke tests on non English Windows (#59328)

3 years ago[wasm][test] BrowserHttpHandler stream large responses with SetBrowserResponseStreami...
Pavel Savara [Thu, 14 Oct 2021 21:27:03 +0000 (23:27 +0200)]
[wasm][test] BrowserHttpHandler stream large responses with SetBrowserResponseStreamingEnabled (#60339)

testing for https://github.com/dotnet/runtime/issues/60287

3 years agoAdd section with design alternatives (#60426)
Immo Landwerth [Thu, 14 Oct 2021 21:05:18 +0000 (14:05 -0700)]
Add section with design alternatives (#60426)

3 years agoRemove extra call to PropertyInfo.GetValue(object) (#60415)
Daniel Petrov [Thu, 14 Oct 2021 20:28:29 +0000 (22:28 +0200)]
Remove extra call to PropertyInfo.GetValue(object) (#60415)

Fix #52905

3 years agoUpdate SuperPMI CI automation (#60375)
Bruce Forstall [Thu, 14 Oct 2021 19:31:08 +0000 (12:31 -0700)]
Update SuperPMI CI automation (#60375)

* Update SuperPMI CI automation

A number of changes:
1. Move the SuperPMI replay pipeline to the public instance, so it can be
triggered by GitHub PRs.
2. Rename SuperPMI collection scripts to contain "collect" in their names,
to distinguish them from the "replay" scripts.
3. Remove a lot of unused copy/paste cruft
4. Create a new azdo_pipelines_util.py script for all the CI scripts to depend
on, so they don't import the superpmi.py script, or each other.
5. Some changes to simplify the Python imports and be more consistent in imported
API usage.

* Fix python

* Fix python names

* For testing, upload spmi collection to "test_collect" location

Don't overwrite the existing collection

3 years agoDon't error out from GetOrCreateLayout in the DAC if no layout creation is needed...
Juan Hoyos [Thu, 14 Oct 2021 18:42:39 +0000 (11:42 -0700)]
Don't error out from GetOrCreateLayout in the DAC if no layout creation is needed (#60401)

3 years agoRemove RC2 EffectiveKeyLength plumbing
Kevin Jones [Thu, 14 Oct 2021 18:37:01 +0000 (14:37 -0400)]
Remove RC2 EffectiveKeyLength plumbing

All shipped implementations of RC2 require the EffectiveKeyLength to equal
the key length, so stop plumbing it through and use the key length as appropriate.

3 years agoSod pre command fix (#60413)
Parker Bibus [Thu, 14 Oct 2021 18:01:17 +0000 (13:01 -0500)]
Sod pre command fix (#60413)

Updated the blazor_scenarios.proj helix precommand to use ';;' instead of '%3b'

3 years ago[docs] Add LLDB debugging instructions for Mono running a runtime test (#60410)
Aleksey Kliger (λgeek) [Thu, 14 Oct 2021 16:54:31 +0000 (12:54 -0400)]
[docs] Add LLDB debugging instructions for Mono running a runtime test (#60410)

* [docs] Add LLDB debugging instructions for Mono running a runtime test

* Also add a note about building a single test

3 years agoFile.*AllText* optimizations (#58167)
Adam Sitnik [Thu, 14 Oct 2021 14:39:59 +0000 (16:39 +0200)]
File.*AllText* optimizations (#58167)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: David Cantú <dacantu@microsoft.com>
3 years agoFix HTTP/3 loopback server WaitForCancellationAsync and aborting on finalization...
Natalia Kondratyeva [Thu, 14 Oct 2021 14:27:31 +0000 (16:27 +0200)]
Fix HTTP/3 loopback server WaitForCancellationAsync and aborting on finalization (#60395)

Fixed WaitForCancellationAsync to take into account both read and write cancellations. Fixed not aborting on finalization.

Fixes #58234
Fixes #60141

3 years ago[reflection] Initialize default ALC gchandle in GetLoadContext (#60350)
Aleksey Kliger (λgeek) [Thu, 14 Oct 2021 14:25:37 +0000 (10:25 -0400)]
[reflection] Initialize default ALC gchandle in GetLoadContext (#60350)

If we try to get the ALC of an assembly from the default context before the
managed default ALC object has been created, the native gchandle has a null
target.
Ensure it is not null by explicitly referencing the Default ALC.

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

3 years agofix TestOnStartWithArgsThenStop (#60386)
Dan Moseley [Thu, 14 Oct 2021 14:20:53 +0000 (08:20 -0600)]
fix TestOnStartWithArgsThenStop (#60386)

3 years agoDisabled NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds test (#60394)
Natalia Kondratyeva [Thu, 14 Oct 2021 13:55:59 +0000 (15:55 +0200)]
Disabled NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds test (#60394)

Put NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds under active issue #60190 due to spike in failures

3 years agoFollow up on Scatter/Gather API changes (#58447)
Theodore Tsirpanis [Thu, 14 Oct 2021 13:22:13 +0000 (16:22 +0300)]
Follow up on Scatter/Gather API changes (#58447)

* Allocate an array of memory handles only if needed.

* Remove an unnecessary variable in the multiple-syscall write gather.

* Actually verify the content read by the read scatter operation.

* Delay allocating native memory.

* Verify that the whole file was read in the scatter/gather test.

* Test the case when the scatter/gather buffers are acceptable by the Windows API.

* Avoid null pointer dereferences when passing an empty segment array.

* Test performing scatter/gather I/O with an empty segment array.

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years ago[metadata] Replace uses of MonoType:byref by a getter (#60313)
Aleksey Kliger (λgeek) [Thu, 14 Oct 2021 12:46:35 +0000 (08:46 -0400)]
[metadata] Replace uses of MonoType:byref by a getter (#60313)

* [metadata] Replace uses of MonoType:byref by a getter

Call `mono_type_is_byref_internal` instead of accessing the byref bit directly.

No functional change. (I hope).

This is in preparation for exploring alternative representations of ref types.

* Change mono_type_is_byref_internal to take a const argument

* Missed a couple byref reads

* rename mono_type_is_byref_internal -> m_type_is_byref [NFC]

* more missed byrefs

* revert unintended change

3 years agoRun on both Win and Linux, but in OuterLoop with longer timeout. (#60149)
Carlos Sanchez [Thu, 14 Oct 2021 12:36:56 +0000 (07:36 -0500)]
Run on both Win and Linux, but in OuterLoop with longer timeout. (#60149)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
3 years agoFix PerformanceCounter tests (#60372)
Dan Moseley [Thu, 14 Oct 2021 04:44:19 +0000 (22:44 -0600)]
Fix PerformanceCounter tests (#60372)

* Fix PC tests

* Fix https://github.com/dotnet/runtime/issues/29753

3 years ago[wasm] rationalize internal exports (#60075)
Pavel Savara [Thu, 14 Oct 2021 04:00:56 +0000 (06:00 +0200)]
[wasm] rationalize internal exports (#60075)

- introduce globalThis.INTERNAL and move all exported methods which we only use internally or for testing
- reduce BINDING and MONO exports to minimal scope necessary - as used by Blazor
- fix all internal usages in tests
- produce dotnet.d.ts and include it in the workload
- moved Module.config to MONO.config
- added mono_load_runtime_and_bcl_args into MONO export
- removed obsolete debugger test InvalidScopeId
- introduced INTERNAL.mono_wasm_set_main_args
- add mono_wasm_new_root_buffer, mono_wasm_new_root, mono_wasm_release_roots to the MONO interface

3 years agoFix StartTLS in DirectoryService.Protocols in 6.0 and backport changes from 5.0 relea...
Juan Hoyos [Thu, 14 Oct 2021 02:05:02 +0000 (19:05 -0700)]
Fix StartTLS in DirectoryService.Protocols in 6.0 and backport changes from 5.0 release. (#60359)

3 years agoAdd design details regarding dynamic buffers in struct marshalling (#60374)
Aaron Robinson [Thu, 14 Oct 2021 00:59:51 +0000 (17:59 -0700)]
Add design details regarding dynamic buffers in struct marshalling (#60374)

* Update StructMarshalling.md with details

Co-authored-by: Elinor Fung <elfung@microsoft.com>
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
3 years agoJIT: Remove DIV(NEG(a), C) => DIV(a, NEG(C)) opt (#60312)
Egor Bogatov [Wed, 13 Oct 2021 22:57:37 +0000 (01:57 +0300)]
JIT: Remove DIV(NEG(a), C) => DIV(a, NEG(C)) opt (#60312)

3 years agoAdjust SkipOnCoreClr for Match_ExcessPrefix test (#59564)
Adeel Mujahid [Wed, 13 Oct 2021 21:15:07 +0000 (00:15 +0300)]
Adjust SkipOnCoreClr for Match_ExcessPrefix test (#59564)

3 years agoFix System.Numerics.Vectors tests on iOS and other FullAOT targets (#60335)
Alexander Köplinger [Wed, 13 Oct 2021 20:01:51 +0000 (22:01 +0200)]
Fix System.Numerics.Vectors tests on iOS and other FullAOT targets (#60335)

* Fix System.Numerics.Vectors tests on iOS and other FullAOT targets

Instead of using dynamic we can use explicit type checks which don't require runtime code generation.
Also fixed running just a subset of xunit tests on Apple targets in tests.mobile.targets.

* Disable tests that fail on x86 due to a Mono runtime asserts

See https://github.com/dotnet/runtime/issues/60347

3 years agoFix CRC32 encoding (#60329)
Bruce Forstall [Wed, 13 Oct 2021 19:07:09 +0000 (12:07 -0700)]
Fix CRC32 encoding (#60329)

On x64, when the crc32 instruction 2nd operand is a memory address
(such as for a static field), and that address is containable
(which normally doesn't happen, because the address will be above
the 4GB lower address space), then the instruction was being
improperly encoded.

3 years agoSupport unseekable filestream when ReadAllBytes[Async] (#58434)
LateApexEarlySpeed [Wed, 13 Oct 2021 18:17:14 +0000 (02:17 +0800)]
Support unseekable filestream when ReadAllBytes[Async] (#58434)

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
3 years agoDon't include s390x in coreclr outerloop runs (#60351)
Alexander Köplinger [Wed, 13 Oct 2021 17:23:00 +0000 (19:23 +0200)]
Don't include s390x in coreclr outerloop runs (#60351)

This was a copy-paste mistake, see https://github.com/dotnet/runtime/pull/60255#issuecomment-942539639

3 years agoAdd tizen armel build CI for pull request (#56281)
Dong-Heon Jung [Wed, 13 Oct 2021 16:29:43 +0000 (01:29 +0900)]
Add tizen armel build CI for pull request (#56281)

* Add tizen amrel build CI

* Fix some errors

* Fix platform-matrix.yml

* Skip tests for tizen-armel

* Fix typo

* Introduce a paramter to skip tests

* Update osGroup to Tizen

* Fix an error

* Update fix

3 years ago[main] Update dependencies from 9 repositories (#60216)
dotnet-maestro[bot] [Wed, 13 Oct 2021 16:26:09 +0000 (18:26 +0200)]
[main] Update dependencies from 9 repositories (#60216)

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

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.21507.4 -> To Version 1.0.0-prerelease.21508.6

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Build.Tasks.Templating , 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 7.0.0-beta.21507.3 -> To Version 7.0.0-beta.21508.1

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

System.Net.MsQuic.Transport
 From Version 6.0.0-preview.7.21480.1 -> To Version 6.0.0-preview.7.21508.1

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

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.21507.4 -> To Version 1.0.0-prerelease.21509.6

* Update dependencies from https://github.com/dotnet/runtime build 20211011.2

Microsoft.NETCore.ILAsm , Microsoft.NETCore.DotNetHostPolicy , Microsoft.NETCore.DotNetHost , Microsoft.NETCore.App.Runtime.win-x64 , System.Runtime.CompilerServices.Unsafe , runtime.native.System.IO.Ports , Microsoft.NET.Sdk.IL , System.Text.Json
 From Version 7.0.0-alpha.1.21501.7 -> To Version 7.0.0-alpha.1.21511.2

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

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.21507.4 -> To Version 1.0.0-prerelease.21511.2

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Build.Tasks.Templating , 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 7.0.0-beta.21507.3 -> To Version 7.0.0-beta.21511.1

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 7.0.0-alpha.1.21477.1 -> To Version 7.0.0-alpha.1.21511.1

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

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21508.1 -> To Version 1.0.0-prerelease.21511.3

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

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Windows.Extensions.TestData
 From Version 7.0.0-beta.21506.1 -> To Version 7.0.0-beta.21511.2

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

System.Net.MsQuic.Transport
 From Version 6.0.0-preview.7.21480.1 -> To Version 6.0.0-preview.7.21511.1

* Update dependencies from https://github.com/dotnet/llvm-project build 20211011.1

runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools
 From Version 11.1.0-alpha.1.21477.1 -> To Version 11.1.0-alpha.1.21511.1

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

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.21507.4 -> To Version 1.0.0-prerelease.21512.6

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Build.Tasks.Templating , 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 7.0.0-beta.21507.3 -> To Version 7.0.0-beta.21512.3

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

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Windows.Extensions.TestData
 From Version 7.0.0-beta.21506.1 -> To Version 7.0.0-beta.21512.1

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

System.Net.MsQuic.Transport
 From Version 6.0.0-preview.7.21480.1 -> To Version 6.0.0-preview.7.21512.1

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

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.0.2-alpha.0.21504.1 -> To Version 1.0.2-alpha.0.21512.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
3 years agoFix build with clang 13 (#60328)
Adeel Mujahid [Wed, 13 Oct 2021 16:25:12 +0000 (19:25 +0300)]
Fix build with clang 13 (#60328)

* Fix build with clang 13
Tested with:
```sh
$ clang --version | head -1
Ubuntu clang version 13.0.0-++20211006103153+fd1d8c2f04dd-1~exp1~20211006223759.3
```

* Fix gcc build

* Unify supressions

* Fix Clang 13 -Wcast-function-type warning

`cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type`

But going through an intermediate `void (*) (void)` function type is allowed.

Co-authored-by: Aleksey Kliger <aleksey@lambdageek.org>
3 years agoImplement RSA-PSS signature for CmsSigner
Kevin Jones [Wed, 13 Oct 2021 15:54:25 +0000 (11:54 -0400)]
Implement RSA-PSS signature for CmsSigner

Adds the ability to indicate an RSA-based signer wants to use PSS instead of PKCS1.

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
3 years agoFix GCC build break (#60333)
Manish Godse [Wed, 13 Oct 2021 13:27:42 +0000 (06:27 -0700)]
Fix GCC build break (#60333)

Notice the unescaped '\' within the comments causing a build break on GCC 11

3 years ago[mono][interp] Change GC state explicitly (#60242)
Vlad Brezae [Wed, 13 Oct 2021 12:49:30 +0000 (15:49 +0300)]
[mono][interp] Change GC state explicitly (#60242)

* [interp] Change GC state explicitly

GC transitions are being called from the m2n wrapper and they expect a LMF to have been pushed. With interpreter however, the LMF is not pushed during the execution of the wrapper but as part of the native CALLI. This means we need to do the GC transitions at a later time, when the LMF is pushed. We detect the GC transition IL code in the wrapper and instead of emitting the actual code we mark a flag. This flag is checked during the CALLI operations.

* [interp] Remove check for gc unsafe state during exception checkpoint

We are always in gc unsafe once returning from pinvokes or icalls.

3 years agoJIT: Optimize redundant memory barriers on arm/arm64 (#60219)
Egor Bogatov [Wed, 13 Oct 2021 08:40:04 +0000 (11:40 +0300)]
JIT: Optimize redundant memory barriers on arm/arm64 (#60219)

3 years agoRemove `Microsoft.IO.Redist`. (#58359)
Theodore Tsirpanis [Wed, 13 Oct 2021 06:26:14 +0000 (09:26 +0300)]
Remove `Microsoft.IO.Redist`. (#58359)

* Remove the Microsoft.IO.Redist package.

* Remove all conditional compilation directives with MS_IO_REDIST.

Co-authored-by: Jeff Handley <jeff.handley@microsoft.com>
3 years agoRemove ObjectDisposedException from the docs of the Task.ContinueWith (#59822)
Roman Marusyk [Wed, 13 Oct 2021 06:09:22 +0000 (09:09 +0300)]
Remove ObjectDisposedException from the docs of the Task.ContinueWith (#59822)

3 years agolateapexearlyspeed-issue-30778 Create method: TryReadExact(). (#57921)
LateApexEarlySpeed [Wed, 13 Oct 2021 05:53:11 +0000 (13:53 +0800)]
lateapexearlyspeed-issue-30778 Create method: TryReadExact(). (#57921)

* lateapexearlyspeed-issue-30778 Create method: TryReadExact().

* issue-30778 Add test for SequenceReader.TryReadExact().

* issue-30778 Fix comment: format return xml doc.

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
3 years agoAdd runtime.osx-arm64.runtime.native.System.IO.Ports proj file for packaging. (#60310)
Sean Mollet [Wed, 13 Oct 2021 05:45:59 +0000 (00:45 -0500)]
Add runtime.osx-arm64.runtime.native.System.IO.Ports proj file for packaging. (#60310)

Tested on actual osx-arm64 hardware, resulting package works correctly.

3 years agoFix license header in a few new files (#59910)
Adeel Mujahid [Wed, 13 Oct 2021 02:39:55 +0000 (05:39 +0300)]
Fix license header in a few new files (#59910)

3 years agoFix typo in comment for UseUtcTimestamp (#60043)
GitHubPang [Wed, 13 Oct 2021 02:39:01 +0000 (10:39 +0800)]
Fix typo in comment for UseUtcTimestamp (#60043)

3 years ago[Group 3] Enable nullable annotations for `Microsoft.Extensions.Configuration` (...
Maksym Koshovyi [Wed, 13 Oct 2021 01:53:51 +0000 (04:53 +0300)]
[Group 3] Enable nullable annotations for `Microsoft.Extensions.Configuration` (#57414)

* Annotate src

* Annotate ref

* Add net6 to Configuration.Abstractions

* Fix tests

* DisableImplicitAssemblyReferences

* TryGet can return null

* new()

* Fix merge error

* InvalidOperationException

* Source.Stream DisallowNull

* Revert unnecessary changes

* More message into resources

* Configuration DisallowNull

* MaybeNullWhen(false)

* Revert "MaybeNullWhen(false)"

This reverts commit 48135287366526c05088507923a9a1a3a50d1974.

* Remove MaybeNullWhen

* NotNullWhen

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoFix: CTS.TryReset() concurrency issue #60182 (#60224)
SRV [Wed, 13 Oct 2021 01:01:04 +0000 (04:01 +0300)]
Fix: CTS.TryReset() concurrency issue #60182 (#60224)

* Quick fix of #60182

* Fixed reset condition when there is no timer

* Simplify branching

3 years agofix for GC.GetGCMemoryInfo (#60309)
Maoni Stephens [Tue, 12 Oct 2021 22:24:58 +0000 (15:24 -0700)]
fix for GC.GetGCMemoryInfo (#60309)

need to re-initialize the generation info each time we fill it in

3 years agoMake upgrade install new host first, then uninstall old (#60307)
Eric StJohn [Tue, 12 Oct 2021 22:06:11 +0000 (15:06 -0700)]
Make upgrade install new host first, then uninstall old (#60307)

This should preserve the ordering of PATH, since the old MSI will never
remove its entry.

3 years agoBetter codegen for `(T)x | (T)y` (#58727)
Benjamin Hodgson [Tue, 12 Oct 2021 21:37:43 +0000 (17:37 -0400)]
Better codegen for `(T)x | (T)y` (#58727)

* Better codegen for `(T)x | (T)y`

I added a morph pass to fold expressions like `(T)x | (T)y`
into `(T)(x | y)`. This results in fewer `movzx` instructions
in the asm.

Fixes #13816

* Code review updates

* Rename function to fgMorphCastedBitwiseOp
* Don't fold checked arithmetic
* Reuse op1 node for return value
* Don't run outside global morphing
* Various code style and comment tweaks

* Don't call gtGetOp2 if tree was folded.

If it was folded, it was folded to a unary (cast) operation
and gtGetOp2() will crash.

I also tweaked fgMorphCastedBitwiseOp to return nullptr
if it didn't do anything (to match behaviour of fgMorphCommutative)

* Code review changes for tests

* Removed all but one csproj
* Added tests for scenarios with overflow, compound exprs, side effects

* Add in some asserts and remove a redundant call

* fix typo

* Code review changes:

* Formatting
* Use getters instead of fields
* set flags on op1

* Fix formatting

3 years agoFix VS4Mac crash report and core dump generation perf problems (#60205)
Mike McLaughlin [Tue, 12 Oct 2021 19:34:05 +0000 (12:34 -0700)]
Fix VS4Mac crash report and core dump generation perf problems (#60205)

Refactor the DAC enumerate memory region phase out of gather crash info

This is so the crash report json is written and available before the core
dump which for VS4Mac currently takes 4 minutes.

Since on both Linux and MacOS all the RW regions have been already added
by createdump itself for heap dumps, then the sometimes slow (4 minutes for
VS4Mac) heap enum memory region is changed to the faster normal one. It adds
necessary DAC globals, etc. without the costly assembly, module, class, type
runtime data structure enumeration.

This fast heap dumps is opt'ed in with COMPlus_DbgEnableFastHeapDumps=1 env var to mitigate the
risk of something missing from these dumps.

Move current_c_gc_state out of !MULTIPLE_HEAPS

3 years agoSome Antigen pipeline fixes (#60284)
Kunal Pathak [Tue, 12 Oct 2021 18:10:56 +0000 (11:10 -0700)]
Some Antigen pipeline fixes (#60284)

* continueOnError for subsequent tasks

* Run based on RunReason

* Capture logs in Antigen.log and upload it

* Remove continueOnError for upload-artifacts step

* Fix .proj to have PropertyGroup

* Fix issue

* wrap TempDir() deletion in try-except

* Review comments

3 years agoImprove SortedSet DeepCopy performance (#56561)
John Call [Tue, 12 Oct 2021 16:51:39 +0000 (09:51 -0700)]
Improve SortedSet DeepCopy performance (#56561)

* SortedSet recursive deep copy

* Make DeepCopy iterative

* Undo accidental delete

3 years agoPrevent runtime prop metadata retrieval when [JsonIgnore] is used (#60024)
Layomi Akinrinade [Tue, 12 Oct 2021 16:02:36 +0000 (12:02 -0400)]
Prevent runtime prop metadata retrieval when [JsonIgnore] is used (#60024)

* Prevent runtime prop metadata retrieval when [JsonIgnore] is used

* Address feedback

* Re-add ctor param default handling tests

* Remove new concurrent dictionary for generic method holders

3 years agoUpdate dependencies from https://github.com/dotnet/linker build 20211011.1 (#60289)
dotnet-maestro[bot] [Tue, 12 Oct 2021 15:28:55 +0000 (17:28 +0200)]
Update dependencies from https://github.com/dotnet/linker build 20211011.1 (#60289)

Microsoft.NET.ILLink.Tasks
 From Version 7.0.100-1.21504.4 -> To Version 7.0.100-1.21511.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years ago[wasm] Fixing compilation on windows using debug mode. (#60260)
Thays Grazia [Tue, 12 Oct 2021 14:13:17 +0000 (11:13 -0300)]
[wasm] Fixing compilation on windows using debug mode. (#60260)

* Fixing compilation on windows using debug mode.

* Fixing as suggested by @radekdoulik

* fix release compilation

3 years ago[mono][interp] Fix short branches (#58806)
Vlad Brezae [Tue, 12 Oct 2021 08:15:54 +0000 (11:15 +0300)]
[mono][interp] Fix short branches (#58806)

* [interp] Fix short branches

In interp, long branches have 4 byte signed offset while short branches have a 2 byte signed offset. Ideally we would want to always emit short branches if possible due to improved performance. The problem is that we emit a short or long branch early in the codegen process, there is no way to know whether a branch is long or short at that time and no further computations were done later to determine whether the branch is really long or short.  Before this commit we arbitrarily decided that all branches in methods with IL size of less than 25000 are short and, in some cases, completely ignored that long branches actually happen in practice.

This commit makes it such that we always emit long opcodes at the beginning of the codegen process, also serving as a simplification since optimizations operating on IR code don't need to care about both short and long versions of branches. Later on, we will end up converting all these long branches to short branches when emitting the final method code. We achieve this by doing a quick preliminary code iteration and computing conservative native offsets (assuming all branches are long). Since the final code will be equal in size or smaller, we have the guarantee that if a branch is short between the conservative offsets, it will surely be short also in the final code. With this approach we guarantee correctness and we can fail to shorten only a negligible amount of branches.

Since the super instruction pass generates some branching instructions that are supported only for the short version, we need to run a computation of conservative offsets beforehand.

* Re-enable test suite

3 years agoAdd C# multi-dimension array versions of the Benchstones tests (#60192)
Bruce Forstall [Tue, 12 Oct 2021 06:15:51 +0000 (23:15 -0700)]
Add C# multi-dimension array versions of the Benchstones tests (#60192)

* Add C# multi-dimension array versions of the Benchstones tests

The Benchstones tests using multi-dimension arrays currently are
implemented using C# "jagged" arrays. Add versions of the tests
that use true C# multi-dimensional arrays. The code is exactly
the same, except for the array creation and indexing.

This will allow us to compare code generated for each, as well as
to verify functionality. I intend to add versions of these to the
microbenchmarks in the https://github.com/dotnet/performance repo as well.

* Fix MDPuzzle build

3 years agoTake write lock in PEImage::LoadFlat/LoadImage (#60277)
Elinor Fung [Tue, 12 Oct 2021 02:43:48 +0000 (19:43 -0700)]
Take write lock in PEImage::LoadFlat/LoadImage (#60277)

3 years agoFix runtime-staging trigger and one bug (#60257)
Alexander Köplinger [Mon, 11 Oct 2021 22:56:23 +0000 (00:56 +0200)]
Fix runtime-staging trigger and one bug (#60257)

We were triggering the runtime-staging jobs for all branches rather than just PRs and the scheduled runs on main.
Fix it to only run for pushes on release branches, like runtime.yml.

I also noticed a small bug where we had `interpreter: true` in the "iOS/tvOS devices - Full AOT + AggressiveTrimming" job, that was probably a copy/paste mistake.

3 years agoDisable ClearPreviousError test on Mono (#60272)
Jeremy Koritzinsky [Mon, 11 Oct 2021 22:32:31 +0000 (15:32 -0700)]
Disable ClearPreviousError test on Mono (#60272)

3 years agoBuild using `build.cmd/sh`, not `bootstrap.cmd/sh` (#60264)
Bruce Forstall [Mon, 11 Oct 2021 22:12:58 +0000 (15:12 -0700)]
Build using `build.cmd/sh`, not `bootstrap.cmd/sh` (#60264)

3 years agoFallback to read/write if pread/pwrite fails (#59846)
David Cantú [Mon, 11 Oct 2021 21:18:22 +0000 (14:18 -0700)]
Fallback to read/write if pread/pwrite fails (#59846)

* Fallback to read/write if pread/pwrite fails

* * Cache whether a handle supports random access
* Keep avoiding pread/pwrite for unseekable files
* Fallback to read/write only for known error ENXIO

* Test more device paths and add tests for WriteAll*

* Fix CI: skip test when device can't be opened

* * Do not use SkipTestException
* Exclude EBADF from assertion

* use NullableBool in _supportsRandomAccess

* Add tests for mkfifo and socketpair

* Rename test file

* Address feedback in src

* Address suggestions

* Address suggestions

* Update src/libraries/System.IO.FileSystem/tests/FileStream/DevicesPipesAndSockets.cs

Use Lazy for thread-safety

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
* Use IEnumerable<string> in Lazy and fix usages

Co-authored-by: David Cantu <jozkee@macbook.lan>
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
3 years ago[wasm][aot] Disable System.Runtime.Serialization.Xml.Tests, till they… (#60258)
Ankit Jain [Mon, 11 Oct 2021 21:16:55 +0000 (21:16 +0000)]
[wasm][aot] Disable System.Runtime.Serialization.Xml.Tests, till they… (#60258)

3 years agoSome more cleanups in Assembly/Binder/Loader area (#59590)
Vladimir Sadov [Mon, 11 Oct 2021 20:52:28 +0000 (13:52 -0700)]
Some more cleanups in Assembly/Binder/Loader area (#59590)

* moved default binder allocation to AppDomain::Create

* allowNativeSkip parameter is unused.

* Removed PEFile::IsResource and PEFile::IsIStream - these do not exist in CoreClr

* make GCC happy

* folded impl

* Folded PEFile into PEAssembly

* renamed pefile files

* reorder PEAssembly members

* removed meaningless LAYOUT_CREATEIFNEEDED - we always require that

* r2r bundled image should Open via cache - no reasons not to.

* Some cleanup in PEImage

* PEAssembly needs only one reference to PEImage

* a few tweaks

* some more

* We never update published hosted assemblies, no need to support the scenario.

* Done with PEAssembly for now

* couple fixes, mostly in comments afected by renames

* more cleanups for  PEImage

* PR review suggestion

Co-authored-by: Elinor Fung <elfung@microsoft.com>
* PR review feedback

* this line should be deleted, not commented.

* Apply suggestions from code review

Co-authored-by: Elinor Fung <elfung@microsoft.com>
* More PR feedback

Co-authored-by: Elinor Fung <elfung@microsoft.com>
3 years agoRe-enable running DllImportGenerator.Tests suite on Mono. (#60259)
Jeremy Koritzinsky [Mon, 11 Oct 2021 18:19:06 +0000 (11:19 -0700)]
Re-enable running DllImportGenerator.Tests suite on Mono. (#60259)

3 years ago[reflection] Return n2m wrapper from RuntimeMethodHandle.GetFunctionPointer (#60200)
Aleksey Kliger (λgeek) [Mon, 11 Oct 2021 17:25:38 +0000 (13:25 -0400)]
[reflection] Return n2m wrapper from RuntimeMethodHandle.GetFunctionPointer (#60200)

for functions marked with UnmanagedCallersOnlyAttribute, return a pointer to
the n2m wrapper for calls to GetFunctionPointer

Contributes to https://github.com/dotnet/runtime/issues/59815

3 years agoAdd runtime-community.yml pipeline and add s390x job (#60255)
Alexander Köplinger [Mon, 11 Oct 2021 16:58:02 +0000 (18:58 +0200)]
Add runtime-community.yml pipeline and add s390x job (#60255)

3 years agoReenable ExportCertificatePems_MultiCert test on Android (#60251)
Alexander Köplinger [Mon, 11 Oct 2021 15:42:23 +0000 (17:42 +0200)]
Reenable ExportCertificatePems_MultiCert test on Android (#60251)

The issue was fixed.

3 years agomake System.Security.Cryptography.Pkcs conform to interop guidelines (#59913)
Badre BSAILA [Mon, 11 Oct 2021 14:44:43 +0000 (16:44 +0200)]
make System.Security.Cryptography.Pkcs conform to interop guidelines (#59913)

3 years agoRemove assert preventing empty PKCS7 exports (#59812)
Kevin Jones [Mon, 11 Oct 2021 13:59:38 +0000 (09:59 -0400)]
Remove assert preventing empty PKCS7 exports (#59812)

An empty PKCS7 collection is valid, so don't require the certHandles count to be greater than 0.

Before:

```
DOTNET  : ((null) warning) Process terminated due to "   at System.Diagnostics.DebugProvider.Fail(String message, String detailMessage)
DOTNET  :    at System.Diagnostics.Debug.Fail(String message, String detailMessage)
DOTNET  :    at System.Diagnostics.Debug.Assert(Boolean condition, String message, String detailMessage)
DOTNET  :    at System.Diagnostics.Debug.Assert(Boolean condition)
```

After:

```
[PASS] System.Security.Cryptography.X509Certificates.Tests.CollectionTests.ExportPkcs7_Empty
```

3 years agoFix test sensitivity to PKCS7 certificate ordering (#59818)
Kevin Jones [Mon, 11 Oct 2021 13:59:07 +0000 (09:59 -0400)]
Fix test sensitivity to PKCS7 certificate ordering (#59818)

Android exports PKCS7 certificates in a different order, and the xunit assertion is sensitive to order. So we sort them first.

Fixes #59777.

3 years agoFixed exception type for ConnectionShutdownInitiatedByTransport (#60181)
Marie Píchová [Mon, 11 Oct 2021 09:01:10 +0000 (11:01 +0200)]
Fixed exception type for ConnectionShutdownInitiatedByTransport (#60181)

3 years agofallocate sets errno on error, posix_fallocate did not (#60185)
Adam Sitnik [Mon, 11 Oct 2021 07:15:24 +0000 (09:15 +0200)]
fallocate sets errno on error, posix_fallocate did not (#60185)

3 years ago[mono][interp] Avoid calls to m_class_get_mem_manager () in get_virtual_method_fast...
Zoltan Varga [Sun, 10 Oct 2021 14:09:37 +0000 (16:09 +0200)]
[mono][interp] Avoid calls to m_class_get_mem_manager () in get_virtual_method_fast () (#60229)

unless needed.