platform/upstream/dotnet/runtime.git
3 years agoAdd System.Runtime.CompilerServices.Unsafe.dll to the list of dlls not part of the...
David Wrighton [Fri, 4 Jun 2021 00:29:24 +0000 (17:29 -0700)]
Add System.Runtime.CompilerServices.Unsafe.dll to the list of dlls not part of the composite image to make roslyn work with the composite build (#53691)

3 years agoMissing `Dispose` after `RemoteExecutor.Invoke` (#53700)
Vladimir Sadov [Fri, 4 Jun 2021 00:21:21 +0000 (17:21 -0700)]
Missing `Dispose` after `RemoteExecutor.Invoke` (#53700)

3 years agoDisable BundleExtractToSpecificPath tests on Linux due to same problems (#53690)
Andy Gocke [Thu, 3 Jun 2021 23:41:51 +0000 (16:41 -0700)]
Disable BundleExtractToSpecificPath tests on Linux due to same problems (#53690)

3 years agoResolving most of ILLink warnings on Microsoft.Extensions.Hosting (#53646)
Jose Perez Rodriguez [Thu, 3 Jun 2021 23:10:12 +0000 (16:10 -0700)]
Resolving most of ILLink warnings on Microsoft.Extensions.Hosting (#53646)

* Resolving most of ILLink warnings on Microsoft.Extensions.Hosting

* Fix indentation issues

3 years agoSpecify kSecUseDataProtectionKeychain when generating RSA/ECC keys on macOS/iOS
Filip Navara [Thu, 3 Jun 2021 22:38:13 +0000 (00:38 +0200)]
Specify kSecUseDataProtectionKeychain when generating RSA/ECC keys on macOS/iOS

3 years ago[iOS] Fix AppleAppBuilder to work w/ AOT+LLVM (#53651)
Steve Pfister [Thu, 3 Jun 2021 22:36:15 +0000 (18:36 -0400)]
[iOS] Fix AppleAppBuilder to work w/ AOT+LLVM  (#53651)

When LLVM is enabled, this change makes sure we're linking in the .ddl-llvm.o files

3 years agodisable a test (#53661)
Sergey Andreenko [Thu, 3 Jun 2021 22:24:24 +0000 (15:24 -0700)]
disable a test (#53661)

3 years agoImprove ENC logging. (#53695)
Mike McLaughlin [Thu, 3 Jun 2021 22:02:51 +0000 (15:02 -0700)]
Improve ENC logging. (#53695)

Fix assert in CMiniMdRW::GetTableForToken.  g_TblIndex entries for MethodImpl and NestedClass needed token values.

3 years ago[iOS] Fix null dereference in AppleCryptoNative_SslIsHostnameMatch
Filip Navara [Thu, 3 Jun 2021 21:40:15 +0000 (23:40 +0200)]
[iOS] Fix null dereference in AppleCryptoNative_SslIsHostnameMatch

3 years agoFix for null pointer bug found by UBSAN (#53686)
monojenkins [Thu, 3 Jun 2021 20:27:39 +0000 (16:27 -0400)]
Fix for null pointer bug found by UBSAN (#53686)

Fix for null-pointer bug found with Clang's undefined-behavior-sanitizer using `-fsanitize=null`

https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html

Co-authored-by: jbcoe <jbcoe@users.noreply.github.com>
3 years ago[mono][llvm] Replace all remaining uses of SimdOp with the INTRINS_ enumeration....
Zoltan Varga [Thu, 3 Jun 2021 19:20:44 +0000 (15:20 -0400)]
[mono][llvm] Replace all remaining uses of SimdOp with the INTRINS_ enumeration. (#52593)

3 years agoAdd support for TLS and connectionless LDAP connections on Linux (#52904)
iinuwa [Thu, 3 Jun 2021 18:21:41 +0000 (13:21 -0500)]
Add support for TLS and connectionless LDAP connections on Linux (#52904)

* Set LDAP version with pointers on Linux

* Replace deprecated OpenLDAP methods

In OpenLDAP, ldap_simple_bind_s is deprecated in favor of
ldap_sasl_bind_s with the LDAP_SASL_SIMPLE auth method[1][].
Similarly, ldap_init is deprecated in favor of ldap_initialize[2][].
The newer APIs also allows us to specify a URI to use TLS with OpenLDAP.

[1]: https://git.openldap.org/openldap/openldap/-/blob/OPENLDAP_REL_ENG_2_4_58/include/ldap.h#L1278
[2]: https://git.openldap.org/openldap/openldap//blob/OPENLDAP_REL_ENG_2_4_58/include/ldap.h#L1513

* Add TLS and connectionless LDAP support to Linux

This commit manually specifies the LDAP URI option during connect
(but before binding). This is necessary because in order to know the
correct scheme, we need access to SessionOptions, which is not available
until after initialization.

Finally, it removes the PlatformUnsupportedException from the
SessionOptions.SecureSocketLayer property.

This makes it possible to use LDAP over TLS and connectionless (UDP)
LDAP.

* Add test configuration for LDAP TLS server

3 years agouse QUIC_ADDRESS_FAMILY enum for assigning socket family (#53673)
Tomas Weinfurt [Thu, 3 Jun 2021 16:53:57 +0000 (18:53 +0200)]
use QUIC_ADDRESS_FAMILY enum for assigning socket family (#53673)

3 years agoFixing the GetInterfaceMap tests for mono in the runtime repo. (#52566)
Bill Holmes [Thu, 3 Jun 2021 15:07:42 +0000 (11:07 -0400)]
Fixing the GetInterfaceMap tests for mono in the runtime repo. (#52566)

Addressing 4 issues for GetInterfaceMap and default interface methods
 - Only methods marked as virtual on on interface should be added to the
   interface map. (no static or instance)
 - If the found target method is ambiguous (a diamond) the target is
   null.
 - If the found target method's class in an interface, then the target
   class is the interface class, else it is the class of the RuntimeType
   (aka this)
 - If the found target method is abstract (reabstraction) then the
   target is null.

Fixes #34389

3 years agoIntegrate changes from NativeAOT branch (#53650)
Jan Kotas [Thu, 3 Jun 2021 12:58:33 +0000 (05:58 -0700)]
Integrate changes from NativeAOT branch (#53650)

* Integrate changes from NativeAOT branch

Includes faster virtual method enumerator that should help crossgen2 too

* Fix tests

3 years agoAdd Execution Checkpoint EventPipe event used to track runtime init on Mono. (#53024)
Johan Lorensson [Thu, 3 Jun 2021 10:18:24 +0000 (12:18 +0200)]
Add Execution Checkpoint EventPipe event used to track runtime init on Mono. (#53024)

3 years agoAdd MemoryMarshal.GetArrayDataReference(Array) (#53562)
Levi Broderick [Thu, 3 Jun 2021 07:46:51 +0000 (00:46 -0700)]
Add MemoryMarshal.GetArrayDataReference(Array) (#53562)

3 years agoStringSegment: more AsSpan overloads (#53463)
Günther Foidl [Thu, 3 Jun 2021 02:08:55 +0000 (04:08 +0200)]
StringSegment: more AsSpan overloads (#53463)

* Defined API

* Added tests

* Implementation

* Remove some branches

* PR Feedback

* Don't use default argument in ThrowInvalidArguments

3 years agoAdd remarks to /// comments for TimeOnly.IsBetween (#53620)
Matt Johnson-Pint [Thu, 3 Jun 2021 02:04:54 +0000 (19:04 -0700)]
Add remarks to /// comments for TimeOnly.IsBetween (#53620)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoFix SuperPMI dumping for replay. (#53649)
Sergey Andreenko [Thu, 3 Jun 2021 01:04:39 +0000 (18:04 -0700)]
Fix SuperPMI dumping for replay. (#53649)

* Fix `SetShimDebugVariables` for counter and simple.

* fix dumps for replays

3 years agoRelax a threading related assert (#53445)
Andrew Au [Thu, 3 Jun 2021 00:33:18 +0000 (17:33 -0700)]
Relax a threading related assert (#53445)

3 years agoFix Culture Native and Display Names (#53468)
Tarek Mahmoud Sayed [Thu, 3 Jun 2021 00:33:01 +0000 (17:33 -0700)]
Fix Culture Native and Display Names (#53468)

* Fix Culture Native and Display Names

* fix mono break

* Address the feedback

* Address more feedback

* Use ThreadCultureChange in the tests

* Exclude the test on  mobile platfoms

3 years agoAvoid setting the brick of the next region during sweep in plan (#53446)
Andrew Au [Thu, 3 Jun 2021 00:32:47 +0000 (17:32 -0700)]
Avoid setting the brick of the next region during sweep in plan (#53446)

3 years agoUnix: Additional check if the RSA key is external.
Kevin Jones [Wed, 2 Jun 2021 23:53:45 +0000 (19:53 -0400)]
Unix: Additional check if the RSA key is external.

Currently we are checking the RSA_METHOD to see if an RSA key "external",
where the private key material may not be exportable. This may not work
because the RSA key itself can declare if it is external or not.

This also checks the flags of the RSA key object itself so attempting
to export the private key is not performed.

3 years agoRemove some unnecessary string copies in hosting layer (#53631)
Elinor Fung [Wed, 2 Jun 2021 22:40:38 +0000 (15:40 -0700)]
Remove some unnecessary string copies in hosting layer (#53631)

3 years agoAdd test for EventListener consuming ThreadPool events (#48487)
Sung Yoon Whang [Wed, 2 Jun 2021 22:30:27 +0000 (15:30 -0700)]
Add test for EventListener consuming ThreadPool events  (#48487)

3 years ago[mono][aot] Compile llvm object files with -fPIC on android. (#53618)
Zoltan Varga [Wed, 2 Jun 2021 21:42:51 +0000 (17:42 -0400)]
[mono][aot] Compile llvm object files with -fPIC on android. (#53618)

3 years agoDelete obsolete libraries package settings files (#53610)
Viktor Hofer [Wed, 2 Jun 2021 20:17:19 +0000 (22:17 +0200)]
Delete obsolete libraries package settings files (#53610)

Deleting package settings files as the package isn't produced anymore
or because the workaround was resolved (i.e. .NETStandard downgrades).

3 years agoJIT: relax immediate dominator check for jump threading (#53613)
Andy Ayers [Wed, 2 Jun 2021 20:05:56 +0000 (13:05 -0700)]
JIT: relax immediate dominator check for jump threading (#53613)

When jump threading, we had been insisting that the redundant branch be
the immediate dominator (idom) of the branch being optimized. But now that we
are doing exact reachability checks, we can consider threading based on
redundant branches higher in the (original) dominator tree, provided that the
in-between branches have also been optimized.

This situation arises when there are repeated redundant branches in if-then
or if-then-else chains. Say there are 3 such branches. The algorithm works
top-down in the original dominator tree. To begin with, the second branch
in the chain is jump-threaded since it redundant to the first. As part
of this the second branch's block is modified to fall through. Now the
third branch's idom is the block that held the second branch, but this block
no longer ends with a branch. So the nearest redundant dominating branch is the
first branch in the chain. And this arrangement blocks jump-threading the third
branch as the redundant branch block is not in the idom block.

Jump threading will work correctly so long as there are unique paths from the
redundant branch outcomes to the branch being optimized. So we have appropriate
safety checks and can consider threading based on higher dominating branches.

Resolves #53501.

3 years agoFix JIT debugger notification location (#53590)
Jan Vorlicek [Wed, 2 Jun 2021 19:23:12 +0000 (21:23 +0200)]
Fix JIT debugger notification location (#53590)

* Fix JIT debugger notification location

My recent change to enable jitting into a scratch buffer has broken
debugging due to the notification to debugger being sent too early. This
change moves the notification after the call to WriteCode and also
removes the CallCompileMethodWithSEHWrapper completely, since its only
purpose was to call the notification in PAL_FINALLY and only when the
JITting succeeded.

* Fix #endif comment

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoFix SPMI dump. (#53586)
Sergey Andreenko [Wed, 2 Jun 2021 19:02:44 +0000 (12:02 -0700)]
Fix SPMI dump. (#53586)

* Fix SPMI dump.

* more fixes

3 years agoUse weak linking for SecCopyErrorMessageString (#52760)
Filip Navara [Wed, 2 Jun 2021 18:50:25 +0000 (20:50 +0200)]
Use weak linking for SecCopyErrorMessageString (#52760)

Improves error messages for System.Security.Cryptography methods on newer iOS/tvOS versions.

3 years ago[wasm] Enable more networking tests (#53027)
Pavel Savara [Wed, 2 Jun 2021 18:17:12 +0000 (20:17 +0200)]
[wasm] Enable more networking tests (#53027)

- enable System.Net.Http.Functional.Tests on browser
- System.Net.Http.Functional.Tests to run in chrome instead of V8 via WasmTestOnBrowser
- ActiveIssue https://github.com/dotnet/runtime/issues/34690 for WebSocket on Windows Mono
- fix Quic detection in test
- disable webSocket tests on Mono/Windows
- disable tests with MaxConnectionsPerServer not supported on Browser
- disable tests with Socket not supported on Browser
- disable tests with AutomaticDecompression not supported on Browser
- disable tests with UseProxy not supported on Browser
- disable tests with PreAuthenticate not supported on Browser
- disable tests with Credentials is not supported on Browser
- disable tests with Loopback server
- run outerloop on browser, rather than V8 only
- [ActiveIssue] #37669 for missing crypto MD5
- conditional tests with PlatformDetection.IsBrowserDomSupportedOrNotBrowser to allow System.Net.Http.Functional.Tests pass on V8
- disabled tests with https://github.com/dotnet/runtime/issues/53018
- disabled tests with https://github.com/dotnet/runtime/issues/53591
- disabled tests with https://github.com/dotnet/runtime/issues/53592

3 years agoDisable leakwheel test for mono (#53608)
Alexander Köplinger [Wed, 2 Jun 2021 17:28:58 +0000 (19:28 +0200)]
Disable leakwheel test for mono (#53608)

This test is expected to fail on mono, since it seems to rely on finalizers being run in order to determine success of the test.

3 years agoAdd information about frame chaining to CLR ABI (#53563)
Bruce Forstall [Wed, 2 Jun 2021 17:19:05 +0000 (10:19 -0700)]
Add information about frame chaining to CLR ABI (#53563)

* Add information about frame chaining

Update links for per-platform ABI documentation.

A few editorial changes.

* Code review feedback

3 years agoRemove more OSPlatformAttribute like attributes from wasm trimmed output (#53604)
Marek Safar [Wed, 2 Jun 2021 17:17:55 +0000 (19:17 +0200)]
Remove more OSPlatformAttribute like attributes from wasm trimmed output (#53604)

3 years agoadd NegotiateClientCertificateAsync support on Windows (#51905)
Tomas Weinfurt [Wed, 2 Jun 2021 17:10:35 +0000 (19:10 +0200)]
add NegotiateClientCertificateAsync support on Windows (#51905)

* add NegotiateClientCertificateAsync support on Windows

* feedback from review and test update

* throw on data during renegotiation

* disable NegotiateClientCertificateAsync on Win7

* feedback from review

* use Interlocked.Exchang instead of CompareExchange

* add trace message

3 years ago[mono] Add a no-exec code manager for AOT compilation; switch Catalyst CI to JustInte...
Aleksey Kliger (λgeek) [Wed, 2 Jun 2021 17:00:34 +0000 (13:00 -0400)]
[mono] Add a no-exec code manager for AOT compilation; switch Catalyst CI to JustInterp AOT mode (#53197)

* Initial pass at trying to run catalyst in aot interp only mode

* Cleanup

* Remove yml dup

* Incorporate changes and identify native libraries to skip during System.Diagnostics.FileVersionInfo test run

* [mini] Add a no-exec code manager for AOT compilation

   Don't allocate pages with execute permission if we're never going to be executing code.  Also don't try to toggle per-thread write protection if we're not expecting to write to executable pages.

* also set no_exec earlier and create the ALC codeman with noexec

* Don't assert on Catalyst in mono_codeman_enable_write

   We defensively also toggle the page write protect bits when resolving some AOT patch targets in mono_resolve_patch_target_ext.  Instead allow the call, but don't do anything.

* Set ENABLE_MONOTOUCH for MacCatalyst arm64.  Define MONOTOUCH in one place

* [aot] mscorlib.dll isn't CoreLib on netcore

   It's a forwarding assembly.  Don't treat it specially

* [testing] In JustInterp mode, only AOT System.Private.CoreLib

   We only need to AOT the trampolines in System.Private.CoreLib in interpreter-only mode.  We don't need to AOT any of the user code in other assemblies.

   Side effect: fixes the System.Runtime.Loader.DefaultContext testsuite in JustInterp mode.  Still broken in Full AOT mode. (That testsuite references the System.Runtime.Loader.Noop.Assembly assembly, but with a different filename
System.Runtime.Loader.Noop.Assembly_test.dll which causes linking errors due to incorrect symbols in AOT module registration in AppleAppBuilder)

* Update iOS sample to use JustInterp

   and adhoc signing

* Don't run iOS sample on the CI build machine

* Disable some tests

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

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Steve Pfister <steve@Steves-M1.fios-router.home>
3 years ago[wasm][aot] Force python to default to UTF8 (#53557)
Ankit Jain [Wed, 2 Jun 2021 16:54:44 +0000 (12:54 -0400)]
[wasm][aot] Force python to default to UTF8 (#53557)

3 years agoJIT: update switch flags after peel (#53570)
Andy Ayers [Wed, 2 Jun 2021 16:38:53 +0000 (09:38 -0700)]
JIT: update switch flags after peel (#53570)

If we introduce a temp for the switch operand, the switch node may have extra flags
set that it doesn't need. Reset these based on the operand.

Closes #53548.

3 years agoSupport PortableThreadPool native event sinks on Mono. (#53500)
Johan Lorensson [Wed, 2 Jun 2021 16:09:20 +0000 (18:09 +0200)]
Support PortableThreadPool native event sinks on Mono. (#53500)

3 years agoConsolidate setret handling for diverging functions (#53535)
imhameed [Wed, 2 Jun 2021 14:43:49 +0000 (07:43 -0700)]
Consolidate setret handling for diverging functions (#53535)

Some functions never associate the mini IR source registers used with their
`setret` instructions with LLVM values because they unconditionally throw.

`System.Runtime.Intrinsics.X86.Aes:Decrypt` is an example of such a function;
when compiled for arm64, it never returns a value and unconditionally throws a
`PlatformNotSupportedException`.

We already had support for handling this for some, but not all, return value
passing conventions. Deduplicate this support and apply it uniformly to all
return value passing conventions that expect a populated mini IR source
register.

Make `LLVMArgNone` specifically mean "no return value"/"`void` return
type".

Split from https://github.com/dotnet/runtime/pull/53132.

Partially fixes FullAOT compilation of System.Private.CoreLib.dll on arm64.

3 years agoUpdate area-owners.md (#53605)
Marek Safar [Wed, 2 Jun 2021 14:31:56 +0000 (16:31 +0200)]
Update area-owners.md (#53605)

3 years agoFix assertion failure / crash in multi-core JIT (#53573)
Koundinya Veluri [Wed, 2 Jun 2021 14:28:59 +0000 (07:28 -0700)]
Fix assertion failure / crash in multi-core JIT (#53573)

* Fix assertion failure / crash in multi-core JIT

- When the recorder times out it doesn't actually stop profiling, but writes out the profile
- The app may later stop profiling, and then it tries to write the profile again
- PR https://github.com/dotnet/runtime/pull/48326 fairly expected that the profile is only written once (some state is mutated)
- The non-timeout stop-profile path was also not stopping the timer
- Fix for https://github.com/dotnet/runtime/issues/53014 in main

3 years ago[main] Update dependencies from dnceng/internal/dotnet-optimization (#53343)
dotnet-maestro[bot] [Wed, 2 Jun 2021 14:26:42 +0000 (14:26 +0000)]
[main] Update dependencies from dnceng/internal/dotnet-optimization (#53343)

[main] Update dependencies from dnceng/internal/dotnet-optimization

3 years agoAdd hot reload test that adds custom attributes (#53387)
Aleksey Kliger (λgeek) [Wed, 2 Jun 2021 14:25:05 +0000 (10:25 -0400)]
Add hot reload test that adds custom attributes (#53387)

* Add hot reload test that adds custom attributes

   This test adds new rows to the CustomAttribute table with both new a class and a new method as parents.  That should result in an unsorted table, which CoreCLR should be able to handle.

* rework the test not to rely on Assembly.GetType

   Looking up the new class using System.Reflection.Assembly.GetType wasn't working.

* clear reflection caches

3 years ago[mono] Separate LLVM optimization and compilation into two separate functions. (...
imhameed [Wed, 2 Jun 2021 14:21:33 +0000 (07:21 -0700)]
[mono] Separate LLVM optimization and compilation into two separate functions. (#53536)

Dump optimized IR before attempting compilation to machine code. Makes
more information available when debugging.

Split from https://github.com/dotnet/runtime/pull/53132.

3 years agoRemove unused Libraries.Libdl (#53585)
Tom Deseyn [Wed, 2 Jun 2021 14:08:27 +0000 (16:08 +0200)]
Remove unused Libraries.Libdl (#53585)

3 years ago[mono][aot] Rework the code which handles llvmonly compilation failures and transitio...
Zoltan Varga [Wed, 2 Jun 2021 13:28:24 +0000 (09:28 -0400)]
[mono][aot] Rework the code which handles llvmonly compilation failures and transition to the interpreter (#53485)

* [mono][aot] Rework the code which handles llvmonly compilation failures.

If llvm fails for a method, retry the compilation and emit
the interp entry code during the second try.

* Fix invalid llvm code generation in interp_entry_only mode, there is no need to create PHI nodes.

* Fix returning values from interp_entry_only methods.

3 years ago[mono][aot] Pass the correct mtriple= argument to llc on android. (#53576)
Zoltan Varga [Wed, 2 Jun 2021 13:21:20 +0000 (09:21 -0400)]
[mono][aot] Pass the correct mtriple= argument to llc on android. (#53576)

3 years ago[wasm] Bump emscripten to 2.0.21 (#52870)
Radek Doulik [Wed, 2 Jun 2021 10:21:53 +0000 (12:21 +0200)]
[wasm] Bump emscripten to 2.0.21 (#52870)

* Bump emscripten version

* Rename __padding to _padding to avoid warnings

And errors as we use `-Werror`:

    error G94F6014A: identifier '__padding' is reserved because it starts with '__'

C99 and C++ standard defines indentifiers with `__` prefix as reserved.

* Fix cast warning/error

With latest emscripten we get this warning (and error as we use
 `-Werror`):

    src/libraries/Native/Unix/System.Native/pal_process.c(374,92): error G3DC5E52A: cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type [-Werror,-Wcast-function-type]
                  void (*oldhandler)(int) = (((unsigned int)sa_old.sa_flags) & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler;

* Add `-s DISABLE_EXCEPTION_CATCHING=0`

when building dotnet.js

* Use EMSDK_PYTHON

* Use delayed expansion

Before the `EMSDK_PYTHON` was evaluated before running
the `emsdk_env.bat` script.

* Replace deprecated EXTRA_EXPORTED_RUNTIME_METHODS

with EXPORTED_RUNTIME_METHODS

Build warning/error:

    emcc : warning : EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]

* Don't need to cast anymore

* 2.0.21 was just released, so try our luck ;-)

* Use new docker images with 2.0.21

* Use the sys includes fix on all platforms

* Remove deprecated --llvm-opts usage

Context: https://github.com/emscripten-core/emscripten/commit/0691cc68eef89fe59f66eacdba245470bea2a113

* Update emscripten version in the workload manifest

* Update emscripten versions in the docs

* Update eng/ versions

* Add ActiveIssue attr in the MemoryCacheTest

* Add ActiveIssue attr to the FileSystem tests

* Update after merge

* Resolve one more conflict

* Add ActiveIssue to the MemoryMappedFiles tests

* Revert "Fix cast warning/error"

This reverts commit 0a1aa4a88c07bc48d3d35c68369d1dca4897d849.

* Unset HAVE_FORK for Browser

* Remove active issue

Fixed by https://github.com/dotnet/runtime/commit/93cf5df65fc13bfbc29256acc8c9c0e102a1170b

* Set HAVE_FORK to 0

* Set HAVE_FORK to 0 instead if unsetting

* Remove -s DISABLE_EXCEPTION_CATCHING=0

It might not be needed anymore

3 years agoFix MinBy and MaxBy handling of empty sources (#53544)
Eirik Tsarpalis [Wed, 2 Jun 2021 05:56:50 +0000 (06:56 +0100)]
Fix MinBy and MaxBy handling of empty sources (#53544)

Addresses a bug where the empty source behaviour
is determined by the key type rather than the source type.

3 years agoEnsure inst_Mov() is used rather than inst_RV_RV(ins_Copy()) (#53569)
Tanner Gooding [Wed, 2 Jun 2021 05:23:01 +0000 (22:23 -0700)]
Ensure inst_Mov() is used rather than inst_RV_RV(ins_Copy()) (#53569)

3 years agoSome mixed missed Equals nullable annotations (#52166)
hrrrrustic [Wed, 2 Jun 2021 05:05:20 +0000 (08:05 +0300)]
Some mixed missed Equals nullable annotations  (#52166)

3 years agoAdd support for AvxVnni instructions under Experimental. (#51998)
weilinwa [Wed, 2 Jun 2021 02:18:48 +0000 (19:18 -0700)]
Add support for AvxVnni instructions under Experimental. (#51998)

* Add support for AvxVnni instructions under Experimental.

* Add support for AvxVnni instructions

* Add preveiw feature attribute

* Handle operands in lsra

* Undo changes for Experimental

* Update JITEEVersionIdentifier and fix remaining issues

* Resolve Mono CI failure

* Disable tests

* Disable Vector128 tests

* Modify disable tests

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
3 years agoFix access ordering issue in Module::AllocateDynamicEntry on arm64 (#53556)
Jan Vorlicek [Wed, 2 Jun 2021 00:31:36 +0000 (02:31 +0200)]
Fix access ordering issue in Module::AllocateDynamicEntry on arm64 (#53556)

While stress testing runtime on Windows ARM64 to repro an issue, I have
hit an ordering issue in access to m_maxDynamicEntries and
m_pDynamicStaticsInfo in the Module::AllocateDynamicEntry.

In one of a few thousands of runs, I got a runtime crash when the
m_pDynamicStaticsInfo was NULL. I was able to repro this issue reliably
in the above mentioned number of runs. After the fix, it doesn't repro
anymore.

The newId was 1 at the time of the crash, the m_maxDynamicEntries was
around 128. So the crashing thread has got the id 1, then another thread
updated the m_maxDynamicEntries before the crashing thread executed the
`if (newId >= m_maxDynamicEntries)`, so the thread went right to the
`m_pDynamicStaticsInfo[newId].pEnclosingMT = pMT;`. The
m_pDynamicStaticInfo is written before the m_maxDynamicEntries, so it
was expected that it cannot be NULL, but the crashing thread has seen
the operations in an opposite order due to the CPU access reordering.

The fix is to add VolatileLoad for accessing the m_maxDynamicEntries and
VolatileStore to set it. That ensures that the writes will be visible in
the intended order.

3 years agoAdd RID values for s390x (#52907)
Ulrich Weigand [Wed, 2 Jun 2021 00:11:49 +0000 (02:11 +0200)]
Add RID values for s390x (#52907)

* Add Linux on the s390x architecture to runtimeGroups.props

* Update generated files

3 years agoFully annotate JsonNode for trimmability (#53184)
Eric Erhardt [Wed, 2 Jun 2021 00:10:09 +0000 (19:10 -0500)]
Fully annotate JsonNode for trimmability (#53184)

Follow up to https://github.com/dotnet/runtime/pull/52934.

- Using JsonNode in dynamic statements is not trim compatible. Add a LibraryBuild warning since there isn't a direct API to put the warning on.
- Mark JsonValueNotTrimmable's ctor as unsafe
- Fix up a few warning messages
- minor doc fixup

Contributes to #45623

3 years agoTweak overheads of Regex cache access (#53449)
Stephen Toub [Tue, 1 Jun 2021 21:49:43 +0000 (17:49 -0400)]
Tweak overheads of Regex cache access (#53449)

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210531.4 (#53525)
dotnet-maestro[bot] [Tue, 1 Jun 2021 21:20:01 +0000 (21:20 +0000)]
Update dependencies from https://github.com/mono/linker build 20210531.4 (#53525)

[main] Update dependencies from mono/linker

3 years agoFix logging messages in ApiCompat.proj (#53531)
Viktor Hofer [Tue, 1 Jun 2021 19:17:23 +0000 (21:17 +0200)]
Fix logging messages in ApiCompat.proj (#53531)

3 years agoConvert some uses of ArrayList to List<T> (#53515)
Jan Kotas [Tue, 1 Jun 2021 18:58:02 +0000 (11:58 -0700)]
Convert some uses of ArrayList to List<T> (#53515)

ArrayList.ToArray(Type) has to lookup the array type in the type loader structures. It makes it slow and potentially AOT unfriendly since the code required to support the array type may not exist.
Convert most uses of ArrayList.ToArray in libraries to use List<T> if possible, or ArrayList.CopyTo if the conversion to List<T> was not straightforward.

Simplified a few other places that created arrays while I was on it.

3 years agoHandle the case when zero byte reads are cancelled with an empty buffer (#53456)
David Fowler [Tue, 1 Jun 2021 17:55:38 +0000 (10:55 -0700)]
Handle the case when zero byte reads are cancelled with an empty buffer (#53456)

- When there's no buffer allocated and the zero byte reads is cancelled, it'll try to make a read only sequence with the current buffer, if that buffer is null because it wasn't yet allocated, it'll end up throwing a null reference exception. This adds a check to make sure were return an empty ReadOnlySequence if the backing buffer is null.
- Added tests

3 years agoRevert "Disable flaky CodeDom tests (#53419)" (#53524)
Jan Vorlicek [Tue, 1 Jun 2021 17:45:55 +0000 (19:45 +0200)]
Revert "Disable flaky CodeDom tests (#53419)" (#53524)

This reverts commit cb1f5ad3351205f70721b7a5b5fe54a06716a056.

3 years ago[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharne...
dotnet-maestro[bot] [Tue, 1 Jun 2021 17:41:30 +0000 (17:41 +0000)]
[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharness dotnet/llvm-project dotnet/hotreload-utils (#53423)

[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharness dotnet/llvm-project dotnet/hotreload-utils

3 years ago[mono][aot] Add a pass to remove empty finally clauses. (#53482)
Zoltan Varga [Tue, 1 Jun 2021 16:50:24 +0000 (12:50 -0400)]
[mono][aot] Add a pass to remove empty finally clauses. (#53482)

This can remove the try-finally added for list iterators, i.e.:

        var l = new List<int> ();
        foreach (var i in l) {
        }

Where the finally clause is:

      IL_0040:  ldloca.s   V_3
      IL_0042:  constrained. [System.Collections]System.Collections.Generic.List`1/Enumerator<int32>
      IL_0048:  callvirt   instance void [System.Runtime]System.IDisposable::Dispose()
      IL_004d:  endfinally

and the Dispose method for List`1/Enumerator is empty.

3 years ago[wasm] Add comments with linker fixes made for running aot tests in (#52006)
Ankit Jain [Tue, 1 Jun 2021 16:33:22 +0000 (12:33 -0400)]
[wasm] Add comments with linker fixes made for running aot tests in (#52006)

3 years ago[mono] Add basic support for static virtual methods on interfaces (#53465)
Zoltan Varga [Tue, 1 Jun 2021 16:20:52 +0000 (12:20 -0400)]
[mono] Add basic support for static virtual methods on interfaces (#53465)

* [mono] Add basic support for abstract static methods.

* Enable some static virtual methods tests on mono.

* Disable the tests they still fail on wasm.

* Fix interpreter support.

* Reenable some tests.

3 years agoJIT: add option to choose guarded devirt class randomly (#53399)
Andy Ayers [Tue, 1 Jun 2021 15:55:09 +0000 (08:55 -0700)]
JIT: add option to choose guarded devirt class randomly (#53399)

Add a config setting to randomly choose one of the observed classes for
guarded devirtualization, rather than the most likely class.

3 years agoRemove WSL checks and platform detection (#53526)
Viktor Hofer [Tue, 1 Jun 2021 14:40:41 +0000 (16:40 +0200)]
Remove WSL checks and platform detection (#53526)

WSL1 isn't a supported build or execution environment for dotnet/runtime.
Because of that removing the checks and platform detection for it as
that code path isn't necessary for WSL2 anymore as it contains a fully
featured kernel which behaves just a like a usual Linux distro.

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

3 years agochange exceptions from socks proxy failure to be HttpRequestExceptions (#53516)
Geoff Kizer [Tue, 1 Jun 2021 14:00:25 +0000 (07:00 -0700)]
change exceptions from socks proxy failure to be HttpRequestExceptions (#53516)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoUpdate dependencies from https://github.com/mono/linker build 20210528.2 (#53462)
dotnet-maestro[bot] [Tue, 1 Jun 2021 08:13:13 +0000 (08:13 +0000)]
Update dependencies from https://github.com/mono/linker build 20210528.2 (#53462)

[main] Update dependencies from mono/linker

3 years agoFix arm build fail with clang11 (#53511)
Dong-Heon Jung [Tue, 1 Jun 2021 05:24:37 +0000 (14:24 +0900)]
Fix arm build fail with clang11 (#53511)

fix ```error: cast to smaller integer type 'unsigned int' from 'void *'```

3 years agoFix StubLinkerCPU::EmitMovConstant (#53510)
Jan Vorlicek [Tue, 1 Jun 2021 04:59:48 +0000 (06:59 +0200)]
Fix StubLinkerCPU::EmitMovConstant (#53510)

The method has a bug that caused it to early out for constants with
lowest 16, 24 or 32 bit being zero. The checks are inverse.
This issue caused failures in System.CodeDom.Tests after my change that
changed code heaps and resulted in the allocations starting at 64kB
aligned address. The failure could happen even before my change, but
extremely rarely, depending on where the heap virtual memory is located.

This change fixes the problem.

3 years agoFix42292 (#52463)
Steve MacLean [Tue, 1 Jun 2021 00:21:12 +0000 (20:21 -0400)]
Fix42292 (#52463)

* Fix issue 42292

* Cleanup PAL issues.targets

3 years ago[mono] Remove some obsolete emscripten flags. (#53486)
Zoltan Varga [Mon, 31 May 2021 19:23:14 +0000 (15:23 -0400)]
[mono] Remove some obsolete emscripten flags. (#53486)

3 years agoFixed path to projects (#53435)
Artem Kliatchkine [Mon, 31 May 2021 19:21:27 +0000 (21:21 +0200)]
Fixed path to projects (#53435)

3 years agosupport ServerCertificateContext in quic (#53175)
Tomas Weinfurt [Mon, 31 May 2021 18:28:16 +0000 (20:28 +0200)]
support ServerCertificateContext in quic (#53175)

3 years agoSocket: delete unix local endpoint filename on Close (#52103)
Tom Deseyn [Mon, 31 May 2021 16:07:31 +0000 (18:07 +0200)]
Socket: delete unix local endpoint filename on Close (#52103)

Fixes #45537

3 years ago[mono] Fix sgen_gc_info.memory_load_bytes (#53364)
Radek Doulik [Mon, 31 May 2021 14:17:45 +0000 (16:17 +0200)]
[mono] Fix sgen_gc_info.memory_load_bytes (#53364)

* [mono] Fix sgen_gc_info.memory_load_bytes

Set it to used memory size instead of available memory size

* Change the default size

For systems without information about available physical memory size

Also handle -1 return values from sysconf calls

* Scale the memory load by total_available/ram_size

3 years agoRefactor MsQuic's native IP address types. (#53461)
Theodore Tsirpanis [Mon, 31 May 2021 10:00:15 +0000 (13:00 +0300)]
Refactor MsQuic's native IP address types. (#53461)

* Use fixed buffers in MsQuic's native IP address types.
And handle them more efficiently when moving between them and .NET's IPAddresses.

* Update the names of all SOCKADDR_IN6's fields.

* Remove a redundant switch in MsQuicAddressHelpers.SetPort.

3 years agoRe-enabled optimizations for gtFoldExprConst (#53347)
SingleAccretion [Mon, 31 May 2021 08:25:23 +0000 (11:25 +0300)]
Re-enabled optimizations for gtFoldExprConst (#53347)

The method has been refactored and the code that was
causing problems for the optimizer no longer exists.

3 years agoAdd diagnostic support into sample app and AppBuilders on Mono. (#53361)
Johan Lorensson [Mon, 31 May 2021 07:46:02 +0000 (09:46 +0200)]
Add diagnostic support into sample app and AppBuilders on Mono. (#53361)

3 years agoFix issues with virtuals and mdarrays (#53400)
David Wrighton [Mon, 31 May 2021 07:36:24 +0000 (00:36 -0700)]
Fix issues with virtuals and mdarrays (#53400)

- Change up the definition of an MDArray which doesn't need a special descriptor in the embedded signature data to match the type of mdarray thay everyone always uses. This fixes the virtual function handling behavior for all reasonable cases. (All cases where the MDArray is used for a base type in the expected fashion.)
- Add a devirtualization test for this specific scenario

Fixes #52444

3 years agoSplit Variant marshalling tests (#53035)
Andrii Kurdiumov [Sun, 30 May 2021 18:54:13 +0000 (00:54 +0600)]
Split Variant marshalling tests (#53035)

* Rework of variant tests split

* Fix testing of disabled built-in COM

3 years agoUpdate clrjit.natvis to cover GT_SIMD and GT_HWINTRINSIC (#53470)
Tanner Gooding [Sun, 30 May 2021 18:42:10 +0000 (11:42 -0700)]
Update clrjit.natvis to cover GT_SIMD and GT_HWINTRINSIC (#53470)

3 years agoremove WSL checks in tests (#53475)
Geoff Kizer [Sun, 30 May 2021 11:28:37 +0000 (04:28 -0700)]
remove WSL checks in tests (#53475)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoAlways spawn message loop thread for SystemEvents (#53467)
Stephen Toub [Sun, 30 May 2021 11:16:29 +0000 (07:16 -0400)]
Always spawn message loop thread for SystemEvents (#53467)

* Always spawn message loop thread for SystemEvents

* Update src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoadd AcceptAsync cancellation overloads (#53340)
Geoff Kizer [Sat, 29 May 2021 19:10:10 +0000 (12:10 -0700)]
add AcceptAsync cancellation overloads (#53340)

* add AcceptAsync cancellation overloads

* pass cancellationToken to AcceptAsync in Unix NamedPipe impl

* add TcpListener overloads too

* enable pipe cancellation test on Unix

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoRemove unnecessary reference to iOS workload pack in the Mono workload (#53425)
Steve Pfister [Sat, 29 May 2021 16:16:02 +0000 (12:16 -0400)]
Remove unnecessary reference to iOS workload pack in the Mono workload (#53425)

The pack no longer exists and will cause an error when trying to import.

3 years agoAdd CookieContainer.GetAllCookies (#53441)
Stephen Toub [Sat, 29 May 2021 13:10:48 +0000 (09:10 -0400)]
Add CookieContainer.GetAllCookies (#53441)

3 years agoRemove DynamicallyAccessedMembers on JsonSerializer (#53235)
Eric Erhardt [Sat, 29 May 2021 01:55:56 +0000 (20:55 -0500)]
Remove DynamicallyAccessedMembers on JsonSerializer  (#53235)

* Remove DynamicallyAccessedMembers on JsonSerializer

Fix #52268

* Remove DynamicallyAccessedMembers from System.Net.Http.Json

These are no longer required since System.Text.Json doesn't have these annotations anymore.

* Update PreviousNetCoreApp baseline for attribute removal

* Fix trimming tests on browser-wasm

* Fix Json tests on EnableAggressiveTrimming leg

3 years ago[wasm] Re-enable Wasm.Build.Tests (#53433)
Ankit Jain [Sat, 29 May 2021 01:30:36 +0000 (21:30 -0400)]
[wasm] Re-enable Wasm.Build.Tests (#53433)

3 years ago[libraries] Move library tests Feature Switches defaults to Functional tests (#53253)
Mitchell Hwang [Sat, 29 May 2021 00:07:13 +0000 (20:07 -0400)]
[libraries] Move library tests Feature Switches defaults to Functional tests (#53253)

* [libraries] Remove UseSystemResourceKeys true default

* [libraries] Remove UseSystemResourceKeys for iOS

* [libraries] Resolve WebSockets System resource keys activeissue

* [tests] Move default feature switches from libraries to functional tests

* [tests] Move Browser wasm default switches into FuntionalTests scope

* Add Browser OS condition

* Move DefaultFeatureSwitches initialization to FunctionalTests project

* Consolidate trimming framework library features and condition for libraries with EnableAggressiveTrimming

* [testing][EAT] Revert trimming framework library features to browser defaults for enable aggressive trimming

* [tests] Add Xamarin Android, Xamarin Mac/iOS, and Wasm feature defaults to Functional tests

* Fixup tabs to spaces

* Add common feature switches, links, and cleanup

* Cleanup Xamarin Android link

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
3 years agoFix SuperPMI collect with getIntConfigValue (#53442)
Bruce Forstall [Fri, 28 May 2021 23:47:12 +0000 (16:47 -0700)]
Fix SuperPMI collect with getIntConfigValue (#53442)

* Fix SuperPMI collect with getIntConfigValue

PR #52427 introduced a per-compilation call to getIntConfigValue
on "SuperPMIMethodContextNumber". This pseudo-config should not
be collected. It exposed a pre-existing multi-threading issue in
the superpmi collector shim. I got rid of the per-compilation
override of the jithost MethodContext, which is problematic, and
currently unneeded, but documented the considerations around collecting
per-compilation data.

Fixes #53440

* Update src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
3 years agoUse IsReferenceOrContainsReferences in ConcurrentQueue/Bag (#53438)
Stephen Toub [Fri, 28 May 2021 22:40:53 +0000 (18:40 -0400)]
Use IsReferenceOrContainsReferences in ConcurrentQueue/Bag (#53438)

3 years agoFix `Task.Delay()` `<exception>` XML comments (#53392)
James Thomson [Fri, 28 May 2021 22:01:40 +0000 (23:01 +0100)]
Fix `Task.Delay()` `<exception>` XML comments (#53392)

* Fix `Task.Delay()` `<exception>` XML comments

Fix `ObjectDisposedException` comments to state that the exception is
thrown when the `CancellationTokenSource` of the `CancellationToken` is
disposed, and not the `CancellationToken` itself.

* Use suggested message

Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
* Use suggested message

Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
3 years agoMerged PR 13255: [5.0 MSRC] Ensure that extracted bundle does not use preexisting...
Vladimir Sadov [Fri, 28 May 2021 21:57:37 +0000 (14:57 -0700)]
Merged PR 13255: [5.0 MSRC] Ensure that extracted bundle does not use preexisting files. (#53374)

Changed location of the extraction root directory on Unix:
-  from ` $TMPDIR\.net\ `     typical path is   ` \var\tmp\.net\userName\AppName\App.ID\stuff `
-  to  ` $HOME\.net\ `          typical path is   ` \home\userName\.net\AppName\App.ID\stuff `

3 years agoAdd new devirt reason. (#53334)
Andy Ayers [Fri, 28 May 2021 19:00:01 +0000 (12:00 -0700)]
Add new devirt reason. (#53334)

3 years agoEnable recently added Microsoft.CodeAnalysis.NetAnalyzers rules (#53158)
Stephen Toub [Fri, 28 May 2021 18:46:46 +0000 (14:46 -0400)]
Enable recently added Microsoft.CodeAnalysis.NetAnalyzers rules (#53158)