platform/upstream/dotnet/runtime.git
2 years agoMove Serialization/Cache/Transactions/Syndication issues and PR's into the 'Tellurium...
Steve Molloy [Thu, 30 Jun 2022 21:56:20 +0000 (14:56 -0700)]
Move Serialization/Cache/Transactions/Syndication issues and PR's into the 'Tellurium' project for attention. (#68193)

2 years agoImplement new metadata knobs as internal APIs (#71449)
Eirik Tsarpalis [Thu, 30 Jun 2022 21:14:59 +0000 (22:14 +0100)]
Implement new metadata knobs as internal APIs (#71449)

* Implement new metadata knobs as internal APIs

* Update src/libraries/System.Text.Json/Common/JsonHelpers.cs

2 years agoImprove LSRA and other dump output (#71499)
Bruce Forstall [Thu, 30 Jun 2022 20:57:57 +0000 (13:57 -0700)]
Improve LSRA and other dump output (#71499)

E.g.,

Update LSRA "Allocating Registers" table description.

Dump nodes added during resolution, e.g.:
```
   BB29 bottom (BB08->BB08): move V25 from STK to rdi (Critical)
N001 (  1,  1) [001174] ----------z                 t1174 =    LCL_VAR   int    V25 cse4          rdi REG rdi
```

Dump more data in the LSRA block sequence data:
```
-BB03( 16   )
-BB04(  4   )
+BB03 ( 16   ) critical-in critical-out
+BB04 (  4   ) critical-out
```

When dumping various flow bitvectors, annotate the bitvectors better:
```
-BB25 in gen out
-0000000000000000
-0000000000000003 CSE #01.c
-0000000000000003 CSE #01.c
+BB25
+ in: 0000000000000000
+gen: 0000000000000003 CSE #01.c
+out: 0000000000000003 CSE #01.c
```

Dump hoisting bitvectors using the sorting number:
```
-  USEDEF  (5)={V04 V00 V01 V02 V03}
+  USEDEF  (5)={V00 V01 V02 V03 V04}
```

Also, fix various typos and formatting.

2 years ago[API Implementation]: Add `Order` and `OrderDescending` to `Enumerable` and `Queryabl...
Robin Lindner [Thu, 30 Jun 2022 20:32:08 +0000 (22:32 +0200)]
[API Implementation]: Add `Order` and `OrderDescending` to `Enumerable` and `Queryable` (#70525)

* Implement proposal for `System.Linq`

* Implement proposal for `System.Linq.Queryable`

* Add documentation

* Merge branch 'main' into issue-67194

* Add more test cases

* Apply suggestions

Co-Authored-By: Eirik Tsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
* Remove unneccesary keyless stuff

* Add more Queryable test cases

* Eliminate `keySelector` null-check in ctor

* Add null checks to `ThenBy`

* Revert "Eliminate `keySelector` null-check in ctor"

This reverts commit 879421b9a5e6d0fba02f0b50cd253eba16f53259.

* Add tests for CreateOrderedEnumerable

* Apply suggestions

* Fix null checks

* Fix null checks

* Update src/libraries/System.Linq/src/System/Linq/OrderBy.cs

* Update src/libraries/System.Linq/src/System/Linq/OrderBy.cs

Co-authored-by: Eirik Tsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
2 years agoAdjust regions range dynamically based on memory limits (#71164)
Andrew Au [Thu, 30 Jun 2022 20:11:56 +0000 (13:11 -0700)]
Adjust regions range dynamically based on memory limits (#71164)

2 years agoAdd MaybeNullWhen( attribute to IParsable.TryParse / ISpanParsable.TryParse (#71381)
Gérald Barré [Thu, 30 Jun 2022 20:00:57 +0000 (16:00 -0400)]
Add MaybeNullWhen( attribute to IParsable.TryParse / ISpanParsable.TryParse (#71381)

2 years agoExclude root folder's .md files as well from triggering CI (#71404)
Kunal Pathak [Thu, 30 Jun 2022 19:11:37 +0000 (12:11 -0700)]
Exclude root folder's .md files as well from triggering CI (#71404)

* Exclude root folder .md files as well

* Dummy change in .md file

* fix the wildcard

* Revert "Dummy change in .md file"

This reverts commit ca4decb18221db7d0dff7eee22e33e4ad4784411.

2 years agoRelax Socket.EnableBroadcast getter exception behavior (#70728)
Tamás Turnyánszki [Thu, 30 Jun 2022 16:27:12 +0000 (18:27 +0200)]
Relax Socket.EnableBroadcast getter exception behavior (#70728)

Fixes #70555

2 years agoReflection.Metadata.Tests: make tests pass when rsa+sha1 signing is not supported.
Tom Deseyn [Thu, 30 Jun 2022 16:05:48 +0000 (18:05 +0200)]
Reflection.Metadata.Tests: make tests pass when rsa+sha1 signing is not supported.

2 years ago[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/roslyn...
dotnet-maestro[bot] [Thu, 30 Jun 2022 15:55:09 +0000 (15:55 +0000)]
[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/roslyn-analyzers (#71376)

[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/roslyn-analyzers

2 years ago[wasm] Preparation for public API in System.Runtime.InteropServices.JavaScript (...
Pavel Savara [Thu, 30 Jun 2022 14:59:47 +0000 (16:59 +0200)]
[wasm] Preparation for public API in System.Runtime.InteropServices.JavaScript (#71332)

*    new ref assembly System.Runtime.InteropServices.JavaScript - empty
*    new src assembly System.Runtime.InteropServices.JavaScript
        moved all implementation from System.Private.Runtime.InteropServices.JavaScript into it
*    added IMPORTS, EXPORTS to js API
*    refactored setup_managed_proxy and teardown_managed_proxy in JS
*    added more range assert for working with wasm memory in JS

2 years agoMove freeing the dynamic heaps until after freeing the code data (#70609)
David Mason [Thu, 30 Jun 2022 14:02:33 +0000 (07:02 -0700)]
Move freeing the dynamic heaps until after freeing the code data (#70609)

2 years agoUse full path for rd.xml in ilc rsp file (#71480)
Vitek Karas [Thu, 30 Jun 2022 12:21:07 +0000 (05:21 -0700)]
Use full path for rd.xml in ilc rsp file (#71480)

This makes the rsp file work regardless of the current directory and makes it much easier for reproducing issues.

So far all of the other paths in the file are generated as absolute paths, except for the rd.xml file path.

2 years agoImprove interoperability of NTLM encryption/decryption and authentication (#71373)
Filip Navara [Thu, 30 Jun 2022 12:19:42 +0000 (14:19 +0200)]
Improve interoperability of NTLM encryption/decryption and authentication (#71373)

* Implement NTLM quirk in NegotiateStreamPal.Encrypt/Decrypt

NegotiateStream on non-encrypted connections with NTLM sends the
messages in a special `<signature token><plain text message>` format.
That's not something that gss_wrap/gss_unwrap would produce. It can be
produced through gss_get_mic/gss_verify_mic calls though so let's do
that.

* Remove MakeSignature/VerifySignature from SspiCli interop

The method names were misleading since they wrapped the EncryptMessage
and DecryptMessage native APIs and not the MakeSignature/VerifySignature
APIs that also exist.

* Remove unused sequenceNumber parameters in NegotiateStreamPal.Encrypt/Decrypt

The SSPI / GSSAPI providers keep track of the sequence numbers
themselves.

* Replace NTAuthentication.MakeSignature/VerifySignature with Wrap/Unwrap

This maps directly to the semantics of gss_wrap/gss_unwrap methods
that are used in many specifications. It replaces the misleading name
which in SSPI API is an equivalent of gss_get_mic/gss_verify_mic.
It also fixes the declaration to actually decode the buffers both
on Windows and Unix. In NTLM the content of the message is sealed
and needs to be decoded.

Note that previously on Unix the VerifySignature API didn't decode the
content. On Windows it did decode the content inside a buffer that was
passed as ReadOnlySpan<byte> but it didn't communicate back the offset
of the decoded data.

The SMTP GSSAPI authentication code was thus reading incorrect data.
In case the underlying authentication was Kerberos the data were
not encrypted and they were located at the beginning of the buffer
so it was not an issue. In case the underlying authentication was
NTLM it was looking at the NTLM signature token which luckily
happens to always start with the bytes 01 00 00 00. That exactly
matched the expected value by accident.

* Fix processing of last SMTP GSSAPI token

The last token in the GSSAPI SASL authentication mechanism is a bit
mask that specifies the supported security protections offered by the
server and the maximum token size. The client is supposed to choose
one of the protections and reply back. Relax the check to actually
support servers that offer anything but "no protection". As long
as the server also offers no protection we can choose it.

* Update unit test to use the new Wrap/Unwrap APIs

* Reset NTLM keys after successful Negotiate authentication

Updated the managed NTLM implementation and the fake servers to
implement the specification quirk:

MS-SPNG section 3.2.5.1 NTLM RC4 Key State for MechListMIC and First
Signed Message specifies that the RC4 sealing keys are reset back to
the initial state for the first message.

Since the managed implementation doesn't expose encryption yet it
didn't affect any observable behavior. Likewise the fake servers
didn't need this code path yet.

* Add GSSAPI authentication test to the loopback SMTP server

* Workaround for https://github.com/gssapi/gss-ntlmssp/issues/77

* Expose the confidentiality flag from the native gss_wrap/unwrap APIs

* Allow default credentials for NTLM server-side on Linux/macOS

2 years agoFixing a typo in copying pdb files (#71450)
Lakshan Fernando [Thu, 30 Jun 2022 11:07:18 +0000 (04:07 -0700)]
Fixing a typo in copying pdb files (#71450)

* fixing a typo in copying pdb files

* FB

2 years agoImplement HttpProtocolException for HTTP/2 (#71345)
Anton Firszov [Thu, 30 Jun 2022 11:00:22 +0000 (13:00 +0200)]
Implement HttpProtocolException for HTTP/2 (#71345)

Contributes to #70684

2 years ago[wasm] Wasm.Build.Tests - fixes for tests failing on CI (#70704)
Ankit Jain [Thu, 30 Jun 2022 10:13:41 +0000 (06:13 -0400)]
[wasm] Wasm.Build.Tests - fixes for tests failing on CI (#70704)

* [wasm][nodejs] Ensure that stdout/stderr have been flushed out before exiting

When the results xml is large, and we are writing the base64
representation in one line, `node` can exit before all the output gets
flushed out. This results in xharness getting an incomplete
`STARTRESULTXML <len> <base64> ... ` with missing `ENDRESULTXML`, thus
no `testResults.xml` is generated.

This can be seen in the case of `Microsoft.Extensions.Primitives.Tests`
which has xml ~140KB, and `System.Memory.Tests` which has a xml ~13MB.

So, wait for the two streams to be flushed out, with a timeout of 3secs.

* [wasm] Wasm.Build.Tests: improve reading output from processes

- Fix to call `WaitForExit()` once `WaitForExit(int)` returns, which
  ensures that all the async handlers have been run.

- Also, for non-browser xharness runs use the emitted `wasm-console.log`
  as the output, so we don't depend on xharness' stdout.

* Wasm.Build.Tests: Run the crypto test only with browser. Other cases are covered in library tests

* Enable WasmTemplateTests.ConsolePublishAndRun

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

* Wasm.Build.Tests: avoid unncessary copy when building locally

Copy sdk for testing workloads only on CI.

* Address feedback from @kg

* Remove timeout on flushing stdout/stderr streams, for console templates, IOW, user apps

2 years agoJIT: Avoid introducing GT_NULLCHECK in gtTryRemoveBoxUpstreamEffects (#71439)
Jakob Botsch Nielsen [Thu, 30 Jun 2022 09:43:39 +0000 (11:43 +0200)]
JIT: Avoid introducing GT_NULLCHECK in gtTryRemoveBoxUpstreamEffects (#71439)

Adding GT_NULLCHECK nodes requires knowledge of which basic block the
nullcheck will end up in. We do not have this easily available in all
places this method is called, and regardless using GT_NULLCHECK here has
minimal diffs.

Fix #71193

2 years ago#71252 disable Atan2PiTest on Android x86 (#71382)
Meri Khamoyan [Thu, 30 Jun 2022 07:34:52 +0000 (11:34 +0400)]
#71252 disable Atan2PiTest on Android x86 (#71382)

* #71252 disable AtanPiTest on Android x86

2 years ago[wasm] InterpToNativeGenerator: use invariant culture when generating C (#71460)
Ankit Jain [Thu, 30 Jun 2022 06:15:37 +0000 (02:15 -0400)]
[wasm] InterpToNativeGenerator: use invariant culture when generating C (#71460)

* [wasm] InterpToNativeGenerator: use invariant culture when generating C

.. functions.

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

* Add missing file

2 years agoAllow specifying the in/ref/out marshaller scenarios for the generator factory (...
Jeremy Koritzinsky [Thu, 30 Jun 2022 05:25:24 +0000 (22:25 -0700)]
Allow specifying the in/ref/out marshaller scenarios for the generator factory (#71466)

Allow specifying the in/ref/out marshaller scenarios for the generator factory and use the element scenarios types for element scenarios.

Also fix a typo in the CollectionsOfCollectionsStress test that implementing this exposed.

2 years agoImplement NarrowUtf16ToAscii for AArch64 (#70080)
SwapnilGaikwad [Thu, 30 Jun 2022 01:24:06 +0000 (02:24 +0100)]
Implement NarrowUtf16ToAscii for AArch64 (#70080)

* Implement NarrowUtf16ToAscii for AArch64

* Combine x64 and AArch64 implementations of NarrowUtf16ToAscii intrinsic

* Improve comments in VectorContainsNonAsciiChar

2 years agoEnable AES encryption on Browser WASM (#70915)
Eric Erhardt [Thu, 30 Jun 2022 00:52:04 +0000 (19:52 -0500)]
Enable AES encryption on Browser WASM (#70915)

* Copy RijndaelManagedTransform from reference source

Copied from https://github.com/microsoft/referencesource/blob/5697c29004a34d80acdaf5742d7e699022c64ecd/mscorlib/system/security/cryptography/rijndaelmanagedtransform.cs

* Format document

* Clean up RijndaelManagedTransform

1. Add copyright
2. Remove unnecessary attributes
3. Mark class as internal
4. Remove FEATURE_CRYPTO define. Only support CipherMode.CBC and PaddingMode.PKCS7.
5. Remove Contracts and replace with Debug.Assert.

* Get RijndaelManagedTransform to compile successfully.

* Make RijndaelManagedTransform implement ILiteSymmetricCipher

And hook it up to AesImplementation for Browser.

* Enable all the Aes tests on Browser.

Mark Aes APIs as supported on Browser.

* Mark all CipherModes and PaddingModes other than CBC and PKCS7 as unsupported on Browser

* Make fields readonly and rename according to code style.

* Replace RijndaelManagedTransformMode with bool encrypting.

* Throw PNSE for unsupported CipherMode and PaddingMode.

Remove unnecessary parameters and fields that aren't supported.

* Fix DecryptorReuse_LeadsToSameResults test so it works on Browser and passes for all CipherModes on other platforms

* Spanify the input buffer in RijndaelManagedTransform Transform and TransformFinal.

* First round of PR feedback

* Make _Nb constant BlockSizeInts

* Get rid of unnecessary allocations

* Remove unsafe pointers from RijndaelManagedTransform.

* PR feedback

Encrypt and Decrypt index arrays are constant values.
Use CopyTo in more places.

* Rename RijndaelManagedTransform => AesManagedTransform

* Change AesManagedTransform to no longer do padding.

Instead, reuse the UniversalCrypto infrastructure to do padding.

* Remove UnsupportedPlatform for PaddingMode

* PR feedback

- clean up unnecessary changes

* PR feedback

Remove UnsupportedOSPlatform("browser") from CipherMode and the SymmetricAlgorithm base class. These create too many false positives and aren't technically accurate since other implementations may support these on browser.

2 years agoUse llvm-objcopy for regular and cross builds (#71446)
Jan Vorlicek [Thu, 30 Jun 2022 00:42:33 +0000 (02:42 +0200)]
Use llvm-objcopy for regular and cross builds (#71446)

* Use llvm-objcopy for regular and cross builds

This change enables using llvm-objcopy instead of the gnu objcopy for
building runtime. The benefit for cross build is that the host machine
no longer needs to have cross-architecture gnu objcopy installed.

There was an attempt to enable llvm objcopy in the past, but it was
reverted due to a problem with objcopy in llvm 9 that incorrectly
didn't strip debug symbols when `--strip-unneeded` option was specified.
I have fixed that by adding `--strip-debug` in addition to the`--strip-unneeded`.

* Fix OSX build, reflect PR feedback

2 years agoAdd CET pipeline (#71223)
Eduardo Velarde [Thu, 30 Jun 2022 00:24:00 +0000 (17:24 -0700)]
Add CET pipeline (#71223)

2 years agoRecognize the stateful marshaller shape (#71355)
Jeremy Koritzinsky [Wed, 29 Jun 2022 23:50:46 +0000 (16:50 -0700)]
Recognize the stateful marshaller shape (#71355)

2 years agoDelete "fgMorphGetStructAddr" (#71078)
SingleAccretion [Wed, 29 Jun 2022 22:51:10 +0000 (01:51 +0300)]
Delete "fgMorphGetStructAddr" (#71078)

2 years agoEnable hot/cold splitting of EH funclets (#71236)
Aman Khalid [Wed, 29 Jun 2022 22:23:28 +0000 (15:23 -0700)]
Enable hot/cold splitting of EH funclets (#71236)

Currently, EH funclets are placed after the function's main body in memory.
Via the heuristic that EH funclets are infrequently run, this enables a simple splitting implementation:
* If we find a good split point in the function's main body, split there as usual.
* Else if the function has exception handling,
   * Check that all the EH funclets are cold. If any of the funclets are frequently run, don't bother splitting at all.
   * If all of the EH funclets are cold, split at `fgFirstFuncletBB`, so that all EH funclets are placed in the cold section.

2 years agoDelete dead code (#71351)
SingleAccretion [Wed, 29 Jun 2022 22:20:13 +0000 (01:20 +0300)]
Delete dead code (#71351)

2 years agoCheck layout compatibility before morphing `OBJ(ADDR(LCL_VAR))` into a list of promot...
SingleAccretion [Wed, 29 Jun 2022 22:19:25 +0000 (01:19 +0300)]
Check layout compatibility before morphing `OBJ(ADDR(LCL_VAR))` into a list of promoted fields (#71348)

* Fix non-x86 targets

* Fix x86

* Add tests

2 years agoEnable `TYP_STRUCT` `LCL_VAR/LCL_FLD` call args on ARM64 (#71328)
SingleAccretion [Wed, 29 Jun 2022 22:16:04 +0000 (01:16 +0300)]
Enable `TYP_STRUCT` `LCL_VAR/LCL_FLD` call args on ARM64 (#71328)

* Arm64: local morph

* Arm64: morph

* Fix MultiregStructArgs up

2 years agoSpill non-morphable split args on non-ARM targets (#71380)
SingleAccretion [Wed, 29 Jun 2022 22:13:03 +0000 (01:13 +0300)]
Spill non-morphable split args on non-ARM targets (#71380)

* Spill split args on non-ARM targets

* Add a test

* Work around vectors in varargs being broken

2 years agoAdding AllBitsSet to IBinaryNumber Interface (#71356)
Drew Kersnar [Wed, 29 Jun 2022 19:47:51 +0000 (14:47 -0500)]
Adding AllBitsSet to IBinaryNumber Interface (#71356)

* WIP: add AllBitsSet to BigInteger with the wrong DIM, add test case.

* Implement AllBitsSet for every type inheriting from IBinaryNumber. Remove DIM for now. Adjust ref files.

* Add tests for AllBitsSet on all types.

* Apply suggestions from code review

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Apply suggestions from code review

* Update src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/NFloatTests.GenericMath.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Change byte's implementation, remove unneeded casts

* Adjust AllBitsSet tests to check that the ones compliment is 0

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
2 years agoMonoAOTCompilerTask: Don't check for temp file if cache is disabled (#71411)
Ankit Jain [Wed, 29 Jun 2022 18:44:52 +0000 (14:44 -0400)]
MonoAOTCompilerTask: Don't check for temp file if cache is disabled (#71411)

* MonoAOTCompilerTask: Don't check for temp file if cache is disabled

Prompted by https://github.com/dotnet/runtime/pull/70851#discussion_r909061233

* Emit a message when deleting tmp files

2 years agoOptimize `HashCode.AddBytes` for inputs larger than 16 bytes. (#70095)
Theodore Tsirpanis [Wed, 29 Jun 2022 18:41:29 +0000 (21:41 +0300)]
Optimize `HashCode.AddBytes` for inputs larger than 16 bytes. (#70095)

* Optimize `HashCode.AddBytes` for inputs larger than 16 bytes.

* Address PR feedback, refactor control flow and inline UnsafeAddMany.

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Add more asserts before memory reads and move one inside the main loop.

* Address PR feedback.

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoDisable failing graphics tests on windows 7 (#71151)
Viktor Hofer [Wed, 29 Jun 2022 18:25:31 +0000 (20:25 +0200)]
Disable failing graphics tests on windows 7 (#71151)

* Disable failing graphics tests on windows 7

Related: https://github.com/dotnet/runtime/issues/51097. Disables the failing tests on Windows 7 as well.

2 years agoAdd ProcessorCount Event to RuntimeEventSource (#65581)
mikelle-rogers [Wed, 29 Jun 2022 18:25:07 +0000 (12:25 -0600)]
Add ProcessorCount Event to RuntimeEventSource (#65581)

* adding ProcessorCount Event to RuntimeEventSource

* firing the event

* Adding test for ProcessorCount event

2 years ago[Mono] Remove unused field in Exception.Mono (#71202)
Steve Pfister [Wed, 29 Jun 2022 17:07:24 +0000 (13:07 -0400)]
[Mono] Remove unused field in Exception.Mono (#71202)

https://github.com/dotnet/runtime/pull/70970 was merged with a field that was unused.  This PR removes it.

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
2 years agoAdd `System.Drawing.Imaging.ImageFormat.Heif` and `Webp`. (#71227)
Theodore Tsirpanis [Wed, 29 Jun 2022 16:56:23 +0000 (19:56 +0300)]
Add `System.Drawing.Imaging.ImageFormat.Heif` and `Webp`. (#71227)

* Add `System.Drawing.Imaging.ImageFormat.Heif` and `Webp`.

* Add these formats in the ImageConverterTests.

2 years agoFix -cmakeargs options to build.sh (#70901)
Omair Majid [Wed, 29 Jun 2022 15:37:25 +0000 (11:37 -0400)]
Fix -cmakeargs options to build.sh (#70901)

PR #67108 (commit 7d562f9d2a4285881ae1c412aecb164dc9370013) tried to
unify how -cmakeargs is passed to build.sh and build.cmd. That commit
has modified src/coreclr/runtime.proj to always include an additional
-cmakeargs argument. However, on Linux, the main ./build.sh command
already includes one. That results in an additional -cmakeargs argument,
which makes the build fail.

Fix that by making build.sh do what build.cmd does: not add the additional
-cmakeargs argument.

Without this change:

    $ ./build.sh -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE
    ...
      Commencing CoreCLR Repo build
      __DistroRid: linux-x64
      Setting up directories for build
      Checking prerequisites...
      Commencing build of "install" target in "CoreCLR component" for Linux.x64.Debug in runtime/artifacts/obj/coreclr/Linux.x64.Debug
      Invoking "runtime/eng/native/gen-buildsys.sh" "runtime/src/coreclr" "runtime/artifacts/obj/coreclr/Linux.x64.Debug" x64 clang Debug ""  -DCLR_CMAKE_PGO_INSTRUMENT=0 -DCLR_CMAKE_OPTDATA_PATH= -DCLR_CMAKE_PGO_OPTIMIZE=0 -DFEATURE_DISTRO_AGNOSTIC_SSL=1  -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE
      ~/devel/dotnet/runtime/artifacts/obj/coreclr/Linux.x64.Debug ~/devel/dotnet/runtime/src/coreclr
      Not searching for unused variables given on the command line.
      CMake Error: Unknown argument -cmakeargs
      CMake Error: Run 'cmake --help' for all supported options.
      ~/devel/dotnet/runtime/src/coreclr
      Unable to find generated build files for "CoreCLR component" project!

Now:

    $ ./build.sh -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE
    ...
      __DistroRid: linux-x64
      Setting up directories for build
      Checking prerequisites...
      Commencing build of "install" target in "CoreCLR component" for Linux.x64.Debug in runtime/artifacts/obj/coreclr/Linux.x64.Debug
      Invoking "runtime/eng/native/gen-buildsys.sh" "runtime/src/coreclr" "runtime/artifacts/obj/coreclr/Linux.x64.Debug" x64 clang Debug ""  -DCLR_CMAKE_PGO_INSTRUMENT=0 -DCLR_CMAKE_OPTDATA_PATH= -DCLR_CMAKE_PGO_OPTIMIZE=0 -DFEATURE_DISTRO_AGNOSTIC_SSL=1  -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE
      runtime/artifacts/obj/coreclr/Linux.x64.Debug runtime/src/coreclr
      Not searching for unused variables given on the command line.
    ...

2 years agoRemove stale CA1419 suppressions (#71406)
Stephen Toub [Wed, 29 Jun 2022 12:27:57 +0000 (08:27 -0400)]
Remove stale CA1419 suppressions (#71406)

2 years ago#36836 enable test on android (#71371)
Meri Khamoyan [Wed, 29 Jun 2022 11:17:52 +0000 (15:17 +0400)]
#36836 enable test on android (#71371)

2 years ago[wasm] Drop active issue on already fixed NodeJS test (#71421)
Marek Fišera [Wed, 29 Jun 2022 10:44:01 +0000 (12:44 +0200)]
[wasm] Drop active issue on already fixed NodeJS test (#71421)

2 years agoFix OSX thread_set_state calls in CONTEXT_SetThreadContextOnPort (#71410)
Jan Vorlicek [Wed, 29 Jun 2022 10:28:34 +0000 (12:28 +0200)]
Fix OSX thread_set_state calls in CONTEXT_SetThreadContextOnPort (#71410)

While testing an issue, I've found that if signals are delivered on the
thread that is a target of the `thread_set_state`, the thread_set_state
sometimes fails with `KERN_ABORTED`. This happens due to the signal
interrupting the `thread_set_state`. Retrying the `thread_set_state`
succeeds and everything works correctly.

This change adds retry loop over the `thread_set_state` calls in the
CONTEXT_SetThreadContextOnPort. There are other usages of `thread_set_state`
in the hardware exception handling code, but those are not subject to
the issue.

I have verified the fix using a testing script that fires a signal
to the corerun process in a loop and ran coreclr pri 1 tests on
the same machine at the same time. Before my change, I was getting an assert
very quickly.

2 years agoFix leaking mach ports & memory after task_threads() (#70338)
Ilia [Wed, 29 Jun 2022 10:26:09 +0000 (12:26 +0200)]
Fix leaking mach ports & memory after task_threads() (#70338)

2 years agoFix SmtpClient reuse with SendAsync (#70046)
Nikita Kazmin [Wed, 29 Jun 2022 10:25:45 +0000 (13:25 +0300)]
Fix SmtpClient reuse with SendAsync (#70046)

2 years agoImprove allocations in NegotiateStreamPal (#71280)
Filip Navara [Wed, 29 Jun 2022 09:52:24 +0000 (11:52 +0200)]
Improve allocations in NegotiateStreamPal (#71280)

* Reduce buffer allocations during NTLM/Negotiate authentication

* Update ReadWriteAdapter.WriteAsync prototype to use Memory<byte> instead of explicit offset/count

* Spanify NTAuthentication.Decrypt and avoid couple of offset/count checks

* Spanify NegotiateStreamPal.VerifySignature/MakeSignature.
Remove indirect Encrypt/Decrypt layer from SSPIWrapper, it is unnecessarily cumbersome to use and SslStreamPal already migrated away from it.

* Update src/libraries/Common/src/System/Net/NTAuthentication.Common.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoDisable ConnectWithRevocation_StapledOcsp on RHEL and CentOS 7 (#71397)
Kevin Jones [Wed, 29 Jun 2022 09:51:14 +0000 (05:51 -0400)]
Disable ConnectWithRevocation_StapledOcsp on RHEL and CentOS 7 (#71397)

* Disable ConnectWithRevocation_StapledOcsp on RHEL and CentOS 7

* Only skip test when not an offline context

2 years ago[main] Update dependencies from dotnet/arcade (#71129)
dotnet-maestro[bot] [Wed, 29 Jun 2022 08:38:45 +0000 (10:38 +0200)]
[main] Update dependencies from dotnet/arcade (#71129)

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

Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 7.0.0-beta.22316.2 -> To Version 7.0.0-beta.22320.8

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

Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 7.0.0-beta.22316.2 -> To Version 7.0.0-beta.22322.3

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

Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 7.0.0-beta.22316.2 -> To Version 7.0.0-beta.22323.2

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

Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 7.0.0-beta.22316.2 -> To Version 7.0.0-beta.22324.1

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

Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 7.0.0-beta.22316.2 -> To Version 7.0.0-beta.22327.1

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

Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 7.0.0-beta.22316.2 -> To Version 7.0.0-beta.22327.2

* Upgrade paths with TFMs to net7.0

Arcade upgraded to 7.0 in https://github.com/dotnet/arcade/pull/9127

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Premek Vysoky <premek.vysoky@microsoft.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2 years ago[PERF][MAUI] Update rollback link for Maui workload install (#71403)
Parker Bibus [Wed, 29 Jun 2022 08:31:00 +0000 (03:31 -0500)]
[PERF][MAUI] Update rollback link for Maui workload install (#71403)

* Update the Maui rollback link to keep getting the latest Maui versions.

* Try running with 6.0.4 installed instead of 6.0.3 to hopefully fix versioning errors.

* Removed testing changes.

2 years ago[wasm] Fix loading NPM packages on NodeJS tests (#71377)
Marek Fišera [Wed, 29 Jun 2022 07:39:25 +0000 (09:39 +0200)]
[wasm] Fix loading NPM packages on NodeJS tests (#71377)

* Fix package type in HTTP and WebSocket tests.
* Move loading of tests npm packages to onConfigLoaded.

2 years agoDisable HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION (#71273)
Aman Khalid [Wed, 29 Jun 2022 06:16:13 +0000 (23:16 -0700)]
Disable HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION (#71273)

The HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION macro was hard-coded to 1, preventing handler entry blocks from being cold (despite the EE supporting cold handler entries). This commit disables the macro and moves logic for setting handler entry weights to fgComputeMissingBlockWeights(); to minimize asmdiffs for now, handler entry weights are modified only when hot/cold-splitting.

2 years agoMove macOS remote unwinding to libunwind directory (#69720)
Adeel Mujahid [Wed, 29 Jun 2022 04:06:39 +0000 (07:06 +0300)]
Move macOS remote unwinding to libunwind directory (#69720)

2 years agoRe-enable automatic gc safe transitions in threaded wasm mode (#71229)
Katelyn Gadd [Wed, 29 Jun 2022 03:46:14 +0000 (20:46 -0700)]
Re-enable automatic gc safe transitions in threaded wasm mode (#71229)

Gc safe transitions and memory barriers were disabled for wasm, now they are enabled if the wasm_gc_safepoints AOT compiler option is set or the DISABLE_THREADS define is not active

2 years agoJIT: fix double reporting of some GC frame slots (#71245)
Andy Ayers [Wed, 29 Jun 2022 01:11:29 +0000 (18:11 -0700)]
JIT: fix double reporting of some GC frame slots (#71245)

If there is a gc struct local that is dependently promoted, the struct
local may be untracked while the promoted gc fields of the struct are
tracked.

If so, the jit will double report the stack offset for the gc field,
first as an untracked slot, and then as a tracked slot.

Detect this case and report the slot as tracked only.

Closes #71005.

2 years ago[mono] Avoid a linear search in the GENERICPARAMCONSTRAINT table, its sorted by owner...
Zoltan Varga [Wed, 29 Jun 2022 01:08:33 +0000 (21:08 -0400)]
[mono] Avoid a linear search in the GENERICPARAMCONSTRAINT table, its sorted by owner. (#71349)

2 years ago[mono] Use GenericArraySortHelper<T> on mono as well. (#71325)
Zoltan Varga [Wed, 29 Jun 2022 01:08:17 +0000 (21:08 -0400)]
[mono] Use GenericArraySortHelper<T> on mono as well. (#71325)

* [mono] Use GenericArraySortHelper<T> on mono as well.

* Remove unnecessarily DynamicDependency attributes.

2 years agoDisable LTCG when building libnethost.lib for Windows. (#71089)
Alex Rønne Petersen [Wed, 29 Jun 2022 00:03:00 +0000 (02:03 +0200)]
Disable LTCG when building libnethost.lib for Windows. (#71089)

Fixes dotnet/runtime#71056.

2 years agoUpdate to use CustomMarshaller entry point type (#71398)
Elinor Fung [Tue, 28 Jun 2022 23:07:49 +0000 (16:07 -0700)]
Update to use CustomMarshaller entry point type (#71398)

2 years agoRemove unnecessary DynamicDependency in CoreLib (#71369)
Michal Strehovský [Tue, 28 Jun 2022 23:05:29 +0000 (08:05 +0900)]
Remove unnecessary DynamicDependency in CoreLib (#71369)

* The ones on `CreateArraySortHelper` were introduced before we introduced dataflow annotations on `CreateInstanceForAnotherGenericParameter`. This should now just fall out naturally.
* The ones on `InvokerEmitUtil` were added recently in #67917. I'm going to assume it's just a cargo cult because the reflection within the methods is fully analyzable. We would need warning suppressions if it wasn't.

2 years agoUpdate guideline of squashing commits (#71394)
Kunal Pathak [Tue, 28 Jun 2022 21:06:37 +0000 (14:06 -0700)]
Update guideline of squashing commits (#71394)

* do not squash commits

* point to pr-guide

2 years agoJIT: strengthen checking of the loop table (#71184)
Andy Ayers [Tue, 28 Jun 2022 20:00:04 +0000 (13:00 -0700)]
JIT: strengthen checking of the loop table (#71184)

Add loop table checking to the post-phase list, conditional on whether the
table is expected to be valid.

Declare that the table is valid from the end of the find loops phase to the
end of the optimization phases.

Add checks that sibling loops are fully disjoint, no child shares top with its
parent, and all top-entry loops have at most one non-loop backedge.

Expand set of phases that opt into the "common" poost phase checks
to include all those between find loops and hoisting.

Closes #71084.
Closes #71071.

2 years ago[wasm] Add Vector128.OnesComplement SIMD intrinsic (#71384)
Radek Doulik [Tue, 28 Jun 2022 19:07:47 +0000 (21:07 +0200)]
[wasm] Add Vector128.OnesComplement SIMD intrinsic (#71384)

* [wasm] Add Vector128.OnesComplement SIMD intrinsic

Add wasm specific implementation of `Vector128.OnesComplement` method.

Example compilation output. Managed:

    static Vector128<double> SimdTest3(Vector128<double> input)
    {
        return Vector128.OnesComplement(input);
    }

IR:

    BB3:                                              ; preds = %BB2
      %cast_to_4_x_i32 = bitcast <2 x double> %simd_vtype to <4 x i32>
      %wasm_not = xor <4 x i32> %cast_to_4_x_i32, <i32 -1, i32 -1, i32 -1, i32 -1>
      %cast_back = bitcast <4 x i32> %wasm_not to <2 x double>
      br label %BB4

wasm - Debug configuration:

    (func Wasm_Console_V8_CJS_Sample_Test_SimdTest3_System_Runtime_Intrinsics_Vector128_1_double(param $0 i32, $1 i32, $2 i32))
     local $3 i32
     local $4 i32
     local $5 v128
     local $6 v128
     0x00cf955a: global.get $__stack_pointer
     0x00cf955c: local.set $3
     0x00cf955e: i32.const 16
     0x00cf9560: local.set $4
     0x00cf9562: local.get $3
     0x00cf9564: local.get $4
     0x00cf9566: i32.sub
     0x00cf9567: drop
     0x00cf9568: local.get $1
     0x00cf956a: v128.load align:4    [SIMD]
     0x00cf956e: local.set $5
     0x00cf9570: local.get $5
     0x00cf9572: v128.not    [SIMD]
     0x00cf9574: local.set $6
     0x00cf9576: local.get $6
     0x00cf9578: drop
     0x00cf9579: local.get $0
     0x00cf957b: local.get $6
     0x00cf957d: v128.store    [SIMD]
     0x00cf9581: return

wasm - Release configuration:

    (func idx:7866(param $0 i32, $1 i32, $2 i32))
     0x00185b37: local.get $0
     0x00185b39: local.get $1
     0x00185b3b: v128.load align:4    [SIMD]
     0x00185b3f: v128.not    [SIMD]
     0x00185b41: v128.store    [SIMD]

* Apply feedback

* Add `--enable-simd` to `wasm-opt` again

* Fix build

2 years agoJIT: add missing test case for gdv and boxing (#71389)
Andy Ayers [Tue, 28 Jun 2022 19:05:14 +0000 (12:05 -0700)]
JIT: add missing test case for gdv and boxing (#71389)

This should have gone in with #60355. It was included in the 6.0 port (#69630).
Now adding it to main as well.

2 years agoUse null coalescing in many more places (#71361)
Stephen Toub [Tue, 28 Jun 2022 18:47:36 +0000 (14:47 -0400)]
Use null coalescing in many more places (#71361)

2 years agoEnable IDE0170 (Simplify property pattern) and IDE0200 (remove unnecessary lambda...
Stephen Toub [Tue, 28 Jun 2022 18:46:45 +0000 (14:46 -0400)]
Enable IDE0170 (Simplify property pattern) and IDE0200 (remove unnecessary lambda expression) (#71011)

As part of updating the config file with recently added rules, also turn on a few of them.

2 years agoJIT: Avoid incorrect TYP_UINT retyping for ToScalar (#71372)
Jakob Botsch Nielsen [Tue, 28 Jun 2022 16:39:46 +0000 (18:39 +0200)]
JIT: Avoid incorrect TYP_UINT retyping for ToScalar (#71372)

TYP_UINT is only meaningful for certain operations in the JIT and nodes
can/should never produce values of this type.

Fix #71360

2 years agoAdd test coverage for generic type substitution with byreflike generics (#71276)
Jeremy Koritzinsky [Tue, 28 Jun 2022 16:04:15 +0000 (09:04 -0700)]
Add test coverage for generic type substitution with byreflike generics (#71276)

This test coverage also found some interesting behavior (issue TBD) in the following scenario:

Given a `<byreflike T>` (aka a `T` that can be a byreflike type), we allow passing this to a `<U>` generic parameter (where `U` does not allow byref-like types).

We do correctly throw when instantiating the generic with a byreflike type though, so we don't end up in a bad state.

I've marked this test with an ActiveIssue attribute pending feedback on whether or not this is a bug.

2 years agoUpdate ValueStringBuilder grow logic (#70942)
Stephen Toub [Tue, 28 Jun 2022 15:02:23 +0000 (11:02 -0400)]
Update ValueStringBuilder grow logic (#70942)

Handle the case where _chars.Length * 2 is too large to be an array but _pos + additionalCapacityBeyondPos is small enough to be an array.

2 years agoRename nightly to daily in the dogfood instructions (#71383)
Jan Kotas [Tue, 28 Jun 2022 13:27:58 +0000 (06:27 -0700)]
Rename nightly to daily in the dogfood instructions (#71383)

Consistency with runtime and SDK download urls and other docs.

2 years agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 184898...
dotnet bot [Tue, 28 Jun 2022 13:11:33 +0000 (06:11 -0700)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 1848989 (#71365)

2 years agoSimplify instructions for using ILC (#70811)
Andrii Kurdiumov [Tue, 28 Jun 2022 12:39:19 +0000 (18:39 +0600)]
Simplify instructions for using ILC (#70811)

* Simplify instructions for using ILC

Because Microsoft.DotNet.ILCompiler on Nuget now, it's reasonable to inform user that adding custom nuget feed is for daily builds of ILC

* Attempt to improve docs

* Address PR feedback

* Removed unused file

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoAnnotate collections.specialized to be native aot compatible (#71159)
Lakshan Fernando [Tue, 28 Jun 2022 11:53:54 +0000 (04:53 -0700)]
Annotate collections.specialized to be native aot compatible (#71159)

* annoate specialized to be native aot compatible

* FB

* Update src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
2 years agoRewire polymorphism metadata to the contract model (#71346)
Eirik Tsarpalis [Tue, 28 Jun 2022 10:47:05 +0000 (11:47 +0100)]
Rewire polymorphism metadata to the contract model (#71346)

* Rewire polymorphism metadata to the contract model

* fix file ordering

* Expand test coverage

2 years ago[GDBJIT] Fix "section extending past end of file" warning (#69124)
Ilya Leoshkevich [Tue, 28 Jun 2022 10:14:54 +0000 (12:14 +0200)]
[GDBJIT] Fix "section extending past end of file" warning (#69124)

GDB frequently prints the following complaint:

    BFD: warning: <in-memory> has a section extending past end of file
    warning: Discarding section .text which has a section size (28e) larger than the file size [in module <in-memory>]

The problem is that GDBJIT emits the .text section with the type
SHT_PROGBITS, but does not provide any contents. Fix by using
SHT_NOBITS instead - this is how .text in separate debuginfo normally
looks like.

Co-authored-by: Ilya Leoshkevich <Ilya Leoshkevich>
2 years agoType loader support for static virtual methods (#71321)
Michal Strehovský [Tue, 28 Jun 2022 04:38:49 +0000 (13:38 +0900)]
Type loader support for static virtual methods (#71321)

Fixes #67745.

Support for static virtual methods that was added in #66084 was enough for compile-time resolution of static virtual methods, but didn't cover dynamic code. For example, given following code:

```csharp
interface IFoo { static virtual void Frob(); }
class SomeCaller<T> where T : IFoo { ... T.Frob(); }
class SomeClass : IFoo { ... }
```

If we do `typeof(SomeCaller<>).MakeGenericType(typeof(SomeClass)` at runtime, the runtime has to find what method implements `IFoo.Frob` on `SomeClass` and ensure proper data structures are generated for `SomeCaller<SomeClass>` so that the call lands in the right spot at runtime.

On a high level, what we need:
* Change to the compiler to generate extra data ("interface dispatch maps") that lets us find an implementation of interface method X on a given type Y.
* Change to the runtime to read the new data structure.
* Change to the compiler to generate extra method bodies for types that can potentially be used with MakeGeneric at runtime. This is an overapproximation since we don't know the set of types that will really be used.
* Change to type loader data structures to capture when shared generic code needs to do this mapping, and change the code in the compiler that emits it, and to the type loader that reads it.

I've made it so that the dispatch logic between instance and static methods is shared. It's not strictly necessary for both to go into the same data structure, but it prevents duplicating the code on the emission and reading side. The side effect of that is that static virtual methods now go into the sealed vtable. We have to put them somewhere. This spot is as good as any.

I've also had to make a small change to the ordering of data structure generation within the type loader. I've made it so that EEType/MethodTable structures are fully populated before we start filling out generic dictionaries. This prevents us from calling into the runtime dispatch logic with EETypes/MethodTables that are not actually built yet. I really didn't want to duplicate the dispatch logic into the type loader.

2 years ago[wasm][debugger] Fix firefox tests (#71272)
Thays Grazia [Mon, 27 Jun 2022 23:36:16 +0000 (20:36 -0300)]
[wasm][debugger] Fix firefox tests (#71272)

* Fix firefox tests

* Update src/mono/wasm/debugger/BrowserDebugProxy/Firefox/FirefoxMonoProxy.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Remove whitespace

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoClean up CapiHelper.Unix
Kevin Jones [Mon, 27 Jun 2022 22:23:55 +0000 (18:23 -0400)]
Clean up CapiHelper.Unix

2 years agoRemove some unnecessary fixed blocks (#71317)
Stephen Toub [Mon, 27 Jun 2022 21:59:07 +0000 (17:59 -0400)]
Remove some unnecessary fixed blocks (#71317)

2 years agoImprove allocations and startup in HashAlgorithmNames
Kevin Jones [Mon, 27 Jun 2022 21:05:46 +0000 (17:05 -0400)]
Improve allocations and startup in HashAlgorithmNames

2 years agoMove helpers for marshaller shape into separate class (#71344)
Elinor Fung [Mon, 27 Jun 2022 20:58:46 +0000 (13:58 -0700)]
Move helpers for marshaller shape into separate class (#71344)

2 years agoMake sure we emit diagnostics for "unsupported" marshalling for downlevel platforms...
Jeremy Koritzinsky [Mon, 27 Jun 2022 20:58:13 +0000 (13:58 -0700)]
Make sure we emit diagnostics for "unsupported" marshalling for downlevel platforms (#71342)

2 years agoSimplify "MakeTmpArgNode" (#71019)
SingleAccretion [Mon, 27 Jun 2022 20:24:30 +0000 (23:24 +0300)]
Simplify "MakeTmpArgNode" (#71019)

Use the ABI info stored in the call arg instead of bespoke logic.

2 years agoArgument tests for CreateJsonTypeInfo and CreateJsonPropertyInfo (#71324)
Krzysztof Wicher [Mon, 27 Jun 2022 19:44:33 +0000 (21:44 +0200)]
Argument tests for CreateJsonTypeInfo and CreateJsonPropertyInfo (#71324)

* Argument tests for CreateJsonTypeInfo and CreateJsonPropertyInfo

* add check for typeof(void) - possibly workaround #71339

2 years agoJIT: Fix local assertion prop for small locals (#71336)
Jakob Botsch Nielsen [Mon, 27 Jun 2022 18:05:16 +0000 (20:05 +0200)]
JIT: Fix local assertion prop for small locals (#71336)

For small locals we need to cast these to the type of the local when the
assertion is created. Also add some checking on the loading side of
these assertions.

Fix #70607

2 years agoFix URL to runtime-assets in Capability.Security.cs (#71334)
Alexander Köplinger [Mon, 27 Jun 2022 17:28:03 +0000 (19:28 +0200)]
Fix URL to runtime-assets in Capability.Security.cs (#71334)

2 years agoAllow more permissive forward subbing into call arguments (#71161)
Jakob Botsch Nielsen [Mon, 27 Jun 2022 17:19:23 +0000 (19:19 +0200)]
Allow more permissive forward subbing into call arguments (#71161)

2 years agoBump Helix workitem timeout for iOS Device perf scenarios (#71330)
Alexander Köplinger [Mon, 27 Jun 2022 17:06:07 +0000 (19:06 +0200)]
Bump Helix workitem timeout for iOS Device perf scenarios (#71330)

2 years agoAdd annotations for ref fields to public API surface (#71265)
Aaron Robinson [Mon, 27 Jun 2022 16:50:07 +0000 (09:50 -0700)]
Add annotations for ref fields to public API surface (#71265)

Matching preview 6 changes. Will change when C#11 language support is available.

2 years ago[main] Update dependencies from dotnet/runtime dnceng/internal/dotnet-optimization...
dotnet-maestro[bot] [Mon, 27 Jun 2022 16:44:51 +0000 (16:44 +0000)]
[main] Update dependencies from dotnet/runtime dnceng/internal/dotnet-optimization dotnet/icu dotnet/xharness dotnet/emsdk dotnet/roslyn-analyzers (#71128)

[main] Update dependencies from dotnet/runtime dnceng/internal/dotnet-optimization dotnet/icu dotnet/xharness dotnet/emsdk dotnet/roslyn-analyzers

2 years agoApply Auto layout to large internal structs in System.Text.Json (#71329)
Eirik Tsarpalis [Mon, 27 Jun 2022 16:44:07 +0000 (18:44 +0200)]
Apply Auto layout to large internal structs in System.Text.Json (#71329)

* Move IsCalendarDateOnly field to the end of the struct.

* Revert "Move IsCalendarDateOnly field to the end of the struct."

This reverts commit 217740ae352c14c3245f6cb01c67e9c78aa2fbd5.

* Apply Auto layout to large internal structs in STJ

2 years agoAdd Regex span startat overloads (#71228)
Stephen Toub [Mon, 27 Jun 2022 16:28:49 +0000 (12:28 -0400)]
Add Regex span startat overloads (#71228)

Also fixes the new Count methods to behave correctly for RightToLeft.

2 years agoJIT: don't try to shorten an already short arm64 adr (#71306)
Andy Ayers [Mon, 27 Jun 2022 15:40:40 +0000 (08:40 -0700)]
JIT: don't try to shorten an already short arm64 adr (#71306)

Fixes #71217.

2 years ago[main] Update dependencies from dotnet/linker (#71255)
dotnet-maestro[bot] [Mon, 27 Jun 2022 12:13:29 +0000 (14:13 +0200)]
[main] Update dependencies from dotnet/linker (#71255)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoAvoid some unnecessary unsigned -> signed casts (#70884)
Jakob Botsch Nielsen [Mon, 27 Jun 2022 11:07:31 +0000 (13:07 +0200)]
Avoid some unnecessary unsigned -> signed casts (#70884)

We do not need a signed cast if we know the sign bit from a previous unsigned cast.

2 years agoSupport `PUTARG_SPLIT(STRUCT LCL_VAR/LCL_FLD)` on ARM/64 (#70861)
SingleAccretion [Mon, 27 Jun 2022 10:54:41 +0000 (13:54 +0300)]
Support `PUTARG_SPLIT(STRUCT LCL_VAR/LCL_FLD)` on ARM/64 (#70861)

* LowerPutArgStk -> LowerPutArgStkOrSplit

* Support "PUTARG_SPLIT(STRUCT LCL_VAR/LCL_FLD)" on ARM/64

2 years agoUse `Array.Resize` in data storages (#71302)
Petar Petrov [Mon, 27 Jun 2022 09:59:17 +0000 (12:59 +0300)]
Use `Array.Resize` in data storages (#71302)

2 years agoSkip export without EntryPoints from linker script (#71307)
Adeel Mujahid [Mon, 27 Jun 2022 08:54:23 +0000 (11:54 +0300)]
Skip export without EntryPoints from linker script (#71307)

2 years agoMore use of SequenceEqual, IndexOf, IndexOfAnyExcept, etc. (#71278)
Stephen Toub [Sun, 26 Jun 2022 18:11:06 +0000 (14:11 -0400)]
More use of SequenceEqual, IndexOf, IndexOfAnyExcept, etc. (#71278)

* More use of SequenceEqual, IndexOf, etc.

* Fix EncodingTable

* Address PR feedback

* Update src/libraries/System.Private.DataContractSerialization/src/System/Xml/EncodingStreamWrapper.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoRemove unused property from ImageConverter (#71294)
Stephen Toub [Sun, 26 Jun 2022 06:49:05 +0000 (02:49 -0400)]
Remove unused property from ImageConverter (#71294)