platform/upstream/dotnet/runtime.git
4 years agomerge with master
Sung Yoon Whang [Tue, 26 May 2020 21:55:51 +0000 (14:55 -0700)]
merge with master

4 years agoPorting some patches from sourcebuild to runtime (#36861)
Anirudh Agnihotry [Tue, 26 May 2020 21:46:02 +0000 (14:46 -0700)]
Porting some patches from sourcebuild to runtime (#36861)

* porting some patches from sourcebuild to runtime

* Update src/installer/Directory.Build.props

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
* lowercase or

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
4 years agofix GCC build
Sung Yoon Whang [Tue, 26 May 2020 21:32:15 +0000 (14:32 -0700)]
fix GCC build

4 years agoOptimization to remove redundant zero initializations. (#36918)
Eugene Rozenfeld [Tue, 26 May 2020 21:18:21 +0000 (14:18 -0700)]
Optimization to remove redundant zero initializations. (#36918)

* Optimization to remove redundant zero initializations.

This change adds a phase iterates over basic blocks starting with
the first basic block until there is no unique basic block successor
or until it detects a loop. It keeps track of local nodes it encounters.
When it gets to an assignment to a local variable or a local field,
it checks whether the assignment is the first reference to the local
(or to the parent of the local field), and, if so, it may do one of two
optimizations:
1. If the following conditions are true:
        the local is untracked,
        the rhs of the assignment is 0,
        the local is guaranteed to be fully initialized in the prolog,
   then the explicit zero initialization is removed.
2. If the following conditions are true:
        the assignment is to a local (and not a field),
        the local is not lvLiveInOutOfHndlr or no exceptions can be thrown
             between the prolog and the assignment,
        either the local has no gc pointers or there are no gc-safe points
             between the prolog and the assignment,
    then the local is marked with lvHasExplicitInit, which tells the codegen
    not to insert zero initialization for this local in the prolog.

This addresses one of the examples in #2325 and 5 examples in #1007.

4 years agoBump crossgen2 dependencies (#37017)
Jan Kotas [Tue, 26 May 2020 21:12:51 +0000 (14:12 -0700)]
Bump crossgen2 dependencies (#37017)

Unify on the latest version of System.CommandLine

4 years agoSingle-File: Run from Bundle (#36052)
Swaroop Sridhar [Tue, 26 May 2020 21:08:48 +0000 (14:08 -0700)]
Single-File: Run from Bundle (#36052)

* Single-File: Run from Bundle

This change implements:

* Runtime changes necessary to load assemblies directly from the bundle:
    * Design notes about [Load from Bundle](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#peimage-loader)
    * Most of these changes are directly from https://github.com/dotnet/coreclr/pull/26504 and https://github.com/dotnet/coreclr/pull/26904

* Hostpolicy change to not add bundled assemblies to TPA list:
    * Design notes about [Dependency Resolution](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#dependency-resolution)
    * TBD (separately) items: Fix for hammer servicing #36031

Fixes #32822

* Address some code review feedback

* Address futher review feedback

* Fix Assembly.ni.dll and Assembly.dll path usage.
* Remove unused full-path computation for corelib when loading from bundle.
* Add tracing when loading from bundle.
* Add bundle-probing for satellite assemblies.
* Adapt the BundleRename test to the .net5 scenario where assemblies are loaded from bundle.

4 years agoFix incorrect filtering operation in EventPipeHelper::IsEnabled (#36933)
Sung Yoon Whang [Tue, 26 May 2020 21:03:22 +0000 (14:03 -0700)]
Fix incorrect filtering operation in EventPipeHelper::IsEnabled (#36933)

4 years ago[mono] Remove unaligned apk after Sign step (#37018)
Egor Bogatov [Tue, 26 May 2020 19:52:33 +0000 (22:52 +0300)]
[mono] Remove unaligned apk after Sign step (#37018)

We don't need two *.apk files in the output dir

4 years agoBuilding coreclr and installer with true sourceBuildFlag (#36854)
Anirudh Agnihotry [Tue, 26 May 2020 18:44:48 +0000 (11:44 -0700)]
Building coreclr and installer with true sourceBuildFlag (#36854)

* Building coreclr and installer with true sourceBuildFlag

* removing the old ci leg

4 years agoFix binplacing WASM files for in-tree runtime pack (#36985)
Alexander Köplinger [Tue, 26 May 2020 18:19:02 +0000 (20:19 +0200)]
Fix binplacing WASM files for in-tree runtime pack (#36985)

It got broken by https://github.com/dotnet/runtime/pull/36781.

4 years agoTracking how much memory is committed per object heap (#36731)
Andrew Au [Tue, 26 May 2020 18:09:17 +0000 (11:09 -0700)]
Tracking how much memory is committed per object heap (#36731)

4 years agoImprove System.Text.Json coverage (#32341) (#36919)
Josh Schreuder [Tue, 26 May 2020 17:15:51 +0000 (03:15 +1000)]
Improve System.Text.Json coverage (#32341) (#36919)

* Remove unused method on JsonClassInfo (#32341)

* Add test coverage for a couple of validation branches in JsonWriterHelper (#32341)

Co-authored-by: Josh Schreuder <josh.schreuder@gmail.com>
4 years agoDocument disabling ApiCompat checks (#37011)
Eirik Tsarpalis [Tue, 26 May 2020 16:50:18 +0000 (17:50 +0100)]
Document disabling ApiCompat checks (#37011)

* Document disabling ApiCompat checks

4 years agoUpdate hosted pools for publish to BAR (#36832)
Matt Mitchell [Tue, 26 May 2020 16:06:45 +0000 (09:06 -0700)]
Update hosted pools for publish to BAR (#36832)

Reduce contention on the internal build pools

4 years agoSwitch to getCacheDir if getExternalFilesDir is not available (#37009)
Egor Bogatov [Tue, 26 May 2020 15:43:13 +0000 (18:43 +0300)]
Switch to getCacheDir if getExternalFilesDir is not available (#37009)

4 years agoAddress futher review feedback
Swaroop Sridhar [Sun, 24 May 2020 09:40:17 +0000 (02:40 -0700)]
Address futher review feedback

* Fix Assembly.ni.dll and Assembly.dll path usage.
* Remove unused full-path computation for corelib when loading from bundle.
* Add tracing when loading from bundle.
* Add bundle-probing for satellite assemblies.
* Adapt the BundleRename test to the .net5 scenario where assemblies are loaded from bundle.

4 years agoAdd SIMD acceleration for Matrix4x4.Invert #34394 (#36323)
Erhan Atesoglu [Tue, 26 May 2020 14:51:23 +0000 (07:51 -0700)]
Add SIMD acceleration for Matrix4x4.Invert #34394 (#36323)

* Add SIMD acceleration for Matrix4x4.Invert #34394

Fix for #34394.

Added SIMD hardware acceleration support to the Matrix4x4.Invert function.

* Add link to source and update THIRD-PARTY-NOTICES.TXT

Added the link to Microsoft/DirectXMath source code and appended license to THIRD-PARTY-NOTICES.TXT

* Add test for non-invertable matrix.

Given a Matrix4x4 of only rank 3 test to see the matrix is non-invertable.

* Typo fixed in new test case

* Fixed formating for test matrix.

* Fix for missing return statement.

* Add suggested fixes to Matrix4x4.Invert

Update containing all suggested fixes.

* Added missing using statement

Added missing using statement for Internal.Runtime.CompilerServices.Unknown static object.

* Use abbreviated constructor for Vector128

* Moved implementations into local functions

Moved the SSE implementation and SoftwareFallback to local functions of Invert.

4 years agoInitial work of porting native diagnostic eventpipe library to C. (#34600)
Johan Lorensson [Tue, 26 May 2020 13:28:53 +0000 (15:28 +0200)]
Initial work of porting native diagnostic eventpipe library to C. (#34600)

First bulk of changes related to porting EventPipe C++ library from
CoreCLR into a C library that can be shared between Mono as well as
CoreCLR runtime.

Due to dependencies and current time line it has been decided to
initially target Mono runtime (since it doesn't have event pipe
functionality at the moment), but library is still designed to
integrate into other runtimes, replacing current C++ library
implementation, when time permits.

Until that happens, we will need to make sure changes done in C++
code base gets ported over to C library. The amount of changes going
into the native library should however be small and if major changes
needs to be done, we should first make sure to move over to use the
shared version of event pipe C-library in CoreCLR and then only do
changes into shared version of the library.

Port is currently mapping existing C++ code base, no focus on rewrite
or change current implementation (unless needed to port code over to C).

Library source files are currently placed into mono/eventpipe folder
and build as a separate library, linked into runtime, but will be
moved when ready to be shared between runtimes. We might also move
all code into a loadable library and p/invokes, depending on size,
at least for Mono runtime targeting mobile devices.

There is also a unit test runner under mono/eventpipe/tests using
eglib test runner, running through a set of unit tests covering
the eventpipe library implementation.

Library is split up over a couple of source files closely mapping
corresponding coreclr source files. Most code could be shared between
runtimes and artifacts that are runtime specific, like
locks/lists/maps/strings/pal layer etc, a shim API is defined in ep-rt.h
and ep-rt-types.h that gets implemented by the targeted runtime consuming
the event pipe C library, like ep-rt-mono.h and ep-rt-types-mono.h.
All function in the shim API is small and should be inlinable. For example,
locking the configuration lock is declared like this in ep-rt.h:

bool
ep_rt_config_aquire (void);
and in ep-rt-mono.h it is implemented like this:

static
inline
bool
ep_rt_config_aquire (void)
{
ep_rt_spin_lock_aquire (ep_rt_mono_config_lock_get ());
return true;
}

and CoreCLR should implement the function using its corresponding
locking primitives. NOTE, since we primarily target Mono in initial
port there might smaller adjustments needed to the shim API once
bringing it over to CoreCLR, but those changes/adjustments can be
done when needed.

Since library could be shared, it tries to standardize on common C99
data types when available. If there are runtime specific types needed,
they are declared in ep-rt-types.h and implemented by each runtime in
corresponding file. Most of library is currently following Mono coding
guidelines.

For shared types naming is done like this, EventPipe[Type], like
EventPipeProvider. This naming follow naming of other types in Mono
as well as CoreCLR. There is one exception to this rule, types that
are runtime specific implementation, naming is following function
naming with a _t prefix, like ep_rt_session_provider_list_t,
that is a list specific type, implemented by each runtime. This is
done to make it easier to see difference of types implemented in
the runtime specific shim and types implemented in the shared
library API surface.

Since library shim implemented by targeted runtime will be called
by C code, it can't throw exceptions, the C library should however
compile under C++, meaning that CoreCLR's shim should be able to
use C++ constructions as long as it don't throw any exceptions.

Library function naming follows the following pattern, for "public"
functions included in ep-*.h , ep_ + object + action, so for example,
ep_config_create_provider, corresponds to EventPipe::Configuration::CreateProvider
in C++ library. For "private/internal" functions not, ep_ prefix is
dropped, but object + action is still preserved, for example
config_create_provider and function is marked as being static
when possible. If a function assumes a lock is held when getting
called, it is using _lock_held (similar to SAL annotations) postfix
to indicate that function doesn't claim lock and if function needs
lock to be held by caller, it will assert that condition on enter
(similar to PRECONDITION(EventPipe::IsLockOwnedByCurrentThread())).

Library uses asserts internally to validate state and conditions.
This is a debug/checked build assert that should be excluded in
release builds. It is defined in EP_ASSERT and should be redefined
by targeted runtime. Private/internal functions asserts incorrect
input parameters and state, while "public" functions return back
error to caller when detecting incorrect input parameters.
Incorrect state can still be assert in all kinds of functions.

Getters/Setters are setup for accessing type members. All functions
except a type's own alloc/init/fini/free implemented in ep-*.c are
not allowed to use direct type member access and should go through
available inlinable getter/setter functions. There is also a way
to build the library that catches incorrect use of members at
compile time (not in ep-*-internals.c since it include
alloc/init/fini/free implementations, but in other source files).

Types that can be stack allocated offers a init/fini function pairs.
Types that should only be heap allocated, alloc/free, and types
supporting both stack/heap, implements alloc/init/fini/free. Since C
can't prevent incorrect usage patterns, the implementation needs to
follow correct life time management patterns. Types allocated using
alloc should be freed with corresponding free function. For example,
ep_event_alloc should be freed by ep_event_free, the init/fini methods
are then called by the alloc/free implementations. For types supporting
stack allocation and allocated on stack or aggregated within other types,
init must be called before first use and fini before going out of scope.

Ownership of allocated objects is only considered complete on successful
function calls. If a function fails, caller still owns resource and need
to take actions.

Library uses UTF8 strings internally, mainly since Mono runtime already
uses that and it is more portable. Number of strings in the library is
limited, and in cases where stream protocol uses UTF16 strings,
a prealloc string is stored on the type, reducing need to do multiple
UTF8 -> UTF16 conversions over the lifetime of the type.

NOTE, this is first commit setting up most of the direction of the library
and (as part of doing that) ported a great deal of eventpipe code and
added ~40 native unittests. It is however not complete, or fully working,
so there will be several follow up commit building on top of this work
in order to get complete library.

4 years ago[reflection] Check whether a pointer is valid before dereferencing (#36981)
monojenkins [Tue, 26 May 2020 13:25:36 +0000 (09:25 -0400)]
[reflection] Check whether a pointer is valid before dereferencing (#36981)

`Xamarin.Android` native runtime calls `mono_reflection_type_from_name`
and passes `NULL` as the `image` parameter.  The parameter is then
propagated all the way to `_mono_reflection_get_type_from_info` where,
in case the assembly isn't loaded yet, it is used to obtain base
directory of the assembly.  However, since the `image` parameter is
`NULL` in our case, attempt to dereference it causes a segfault:

    libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4c0 in tid 11029 (ompanyname.app3), pid 11029 (ompanyname.app3)
    crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
    /system/bin/tombstoned: received crash request for pid 11029
    crash_dump64: performing dump of process 11029 (target tid = 11029)
    DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    DEBUG   : Build fingerprint: 'google/sdk_gphone_x86_64/generic_x86_64:10/QSR1.190920.001/5891938:user/release-keys'
    DEBUG   : Revision: '0'
    DEBUG   : ABI: 'x86_64'
    DEBUG   : Timestamp: 2020-05-25 14:45:29+0200
    DEBUG   : pid: 11029, tid: 11029, name: ompanyname.app3  >>> com.companyname.app3 <<<
    DEBUG   : uid: 10134
    DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4c0
    DEBUG   : Cause: null pointer dereference
    DEBUG   :     rax 000000000000002f  rbx 0000000000000001  rcx 0000000000000000  rdx 0000000000000030
    DEBUG   :     r8  0000000000000003  r9  000000000013e2e2  r10 0173eed800000000  r11 0000000000000206
    DEBUG   :     r12 0000000000000000  r13 00007478530343c0  r14 00007478075eda33  r15 000074780763efb0
    DEBUG   :     rdi 0000000000000000  rsi 00007478e2cb14d0
    DEBUG   :     rbp 00007ffef3a35680  rsp 00007ffef3a355d0  rip 0000747807a4066a
    DEBUG   :
    DEBUG   : backtrace:
    DEBUG   :       mono/mono#00 pc 00000000003ba66a  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonosgen-2.0.so (_mono_reflection_get_type_from_info+474)
    DEBUG   :       mono/mono#01 pc 00000000003ba3d1  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonosgen-2.0.so (mono_reflection_type_from_name_checked+321)
    DEBUG   :       mono/mono#02 pc 00000000003ba26d  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonosgen-2.0.so (mono_reflection_type_from_name+125)
    DEBUG   :       mono/mono#03 pc 000000000000ddb5  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::typemap_java_to_managed(char const*)+389) (BuildId: 9952f1cfe0d910ae631abc73479f88eef34fd71d)
    DEBUG   :       mono/mono#04 pc 000000000000def3  /data/app/com.companyname.app3-aQUF6Ge6_v-WaLb5i8Q7vw==/lib/x86_64/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::typemap_java_to_managed(_MonoString*)+99) (BuildId: 9952f1cfe0d910ae631abc73479f88eef34fd71d)
    DEBUG   :       mono/mono#05 pc 0000000000069532  <anonymous:5ad25000>

Even though this happens in `Xamarin.Android`, the error may occur for
any embedding application which passes `NULL` for the `image` parameter
in situation when the assembly isn't in memory yet.

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: grendello <grendello@users.noreply.github.com>
4 years agoOptimize decommit (#35896)
Peter Sollich [Tue, 26 May 2020 12:21:47 +0000 (05:21 -0700)]
Optimize decommit (#35896)

Optimize the way we decommit memory on both SVR and WKS GC.

Key ideas for SVR GC:
 - in decommit_ephemeral_segment_pages, instead of decommitting right there, just remember what we intended to decommit.

- in gc_thread function, have the thread with heap_number 0 periodically wake up and do gradual decommits for all heaps by calling the new method decommit_ephemeral_pages_step on them. This way, the decommit is not part of the GC pause and does not contribute to it.

- decommit_ephemeral_pages_step will decommit a "reasonable" amount of space per heap and time interval, and return how much it decomitted. A return value of 0 indicates no further progress.

- take into account Gen 1 budget size and Gen 1 free list when computing how much memory we are likely to need soon.

For WKS GC:

- As for SVR GC, take Gen 1 budget size and Gen 1 free list into account.

- Decommit gradually, taking into account the elapsed time since the last GC to make sure decommit does not become a major part of the GC pause.

As the validation scenario, I used an enhanced version of GCPerfSim that can be made to go through "phases", where the phases are programmed by an input text file. To cause decommits, I varied the amount of survivorship between phases - in one phase, one object out of 30 survived, in the next phase 1 out of 300 survived. 10 GB were allocated on each thread in each phase, and the phases with high and low survivorship were repeated 10 times. Test machine was an i9-7900X, 1 allocating thread was used for WKS GC, and 10 allocating threads for SVR GC.

Metrics directly influenced by decommitting memory were selected:
- Wall clock time (influenced both by GC pause time and page faults during allocation)
- GC pause time (especially in SVR GC, impacted by decommitting during GC pause)
- CPU samples spent decommitting
- CPU samples spend in KiPagefault triggered by allocator

Comparison with the master branch gave these results (numbers are medians of 3 runs):

SVR                                       Baseline    Optimized
================================
Wallclock time (secs):         127.456        106.581
GC pause time (secs):          50.120           41.293
Samples in decommit:           5,467            1,918
Samples in KiPagefault        77,872          21,449
 from allocator

WKS                                      Baseline    Optimized
================================
Wallclock time (secs):          57.213            54.321
GC pause time (secs):          21.422            22.060
Samples in decommit:             465                   48
Samples in KiPagefault         5,505               3,509
 from allocator

So all metrics are noticeably improved, with the exception of GC pause time for WKS. Given the scatter in the pause time numbers, it seems likely that this slight apparent regression is spurious.

4 years agoAvoid additional casts in SocketAsyncContext (#36997)
Ben Adams [Tue, 26 May 2020 09:12:12 +0000 (10:12 +0100)]
Avoid additional casts in SocketAsyncContext (#36997)

4 years agoUpdate mobile testing runner publishing target to insert before linker runs (#36687)
Marek Safar [Tue, 26 May 2020 08:33:44 +0000 (10:33 +0200)]
Update mobile testing runner publishing target to insert before linker runs (#36687)

4 years agoFix accumulating the offset in PemReader
Kevin Jones [Mon, 25 May 2020 19:52:11 +0000 (15:52 -0400)]
Fix accumulating the offset in PemReader

The preebEndIndex offset was a total value in to the PEM's contents,
not a moving offset. This would cause it to advance past the contents
of the PEM and potentially miss valid PEM contents.

4 years agoTimeout support for unprivileged Ping on Linux/BSD (#35461)
SRV [Mon, 25 May 2020 17:59:59 +0000 (20:59 +0300)]
Timeout support for unprivileged Ping on Linux/BSD  (#35461)

* Added support of timeout when unprivileged ping is used

* Fixed test according with new timeout parameter

* Fixes code style issues

* Fixed command-line flag for ping6 on BSD

* Separated timeout test

* Removed trailing whitespace

* Workaround for OSX ping6

* Removed static local method

* Suppress Ping stdout

* Fixed variable name

* Added test for zero timeout

* Handle zero timeout correctly

4 years agoUpdate dependencies from https://github.com/dotnet/xharness build 20200525.1 (#36982)
dotnet-maestro[bot] [Mon, 25 May 2020 17:30:29 +0000 (17:30 +0000)]
Update dependencies from https://github.com/dotnet/xharness build 20200525.1 (#36982)

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20271.3 -> To Version 1.0.0-prerelease.20275.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agoconfigure.ac: check for sockaddr_in6 on Win32 (#36742)
monojenkins [Mon, 25 May 2020 15:08:54 +0000 (11:08 -0400)]
configure.ac: check for sockaddr_in6 on Win32 (#36742)

HAVE_STRUCT_SOCKADDR_IN6 needs to be defined to enable IPv6 features in
mono/metadata/w32socket.c.

Fixes TcpListener issues in wine-mono.

Co-authored-by: w-flo <w-flo@users.noreply.github.com>
4 years agoRemove volatile on field in ConcurrentDictionary.Tables (#36976)
Stephen Toub [Mon, 25 May 2020 11:18:01 +0000 (07:18 -0400)]
Remove volatile on field in ConcurrentDictionary.Tables (#36976)

4 years ago[master] Update dependencies from mono/linker Microsoft/vstest dotnet/xharness (...
dotnet-maestro[bot] [Mon, 25 May 2020 08:07:50 +0000 (08:07 +0000)]
[master] Update dependencies from mono/linker Microsoft/vstest dotnet/xharness (#36811)

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

Microsoft.NET.ILLink.Tasks
 From Version 5.0.0-preview.3.20269.1 -> To Version 5.0.0-preview.3.20270.1

* Update dependencies from https://github.com/microsoft/vstest build 20200521-01

Microsoft.NET.Test.Sdk
 From Version 16.7.0-preview-20200518-01 -> To Version 16.7.0-preview-20200521-01

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

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20270.1 -> To Version 1.0.0-prerelease.20270.2

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

Microsoft.NET.ILLink.Tasks
 From Version 5.0.0-preview.3.20269.1 -> To Version 5.0.0-preview.3.20271.1

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

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20270.1 -> To Version 1.0.0-prerelease.20271.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agoFix output for user strings in R2RDump (#36935)
Anton Lapounov [Mon, 25 May 2020 03:03:40 +0000 (20:03 -0700)]
Fix output for user strings in R2RDump (#36935)

Quote user strings and escape control characters, unpaired surrogates, and other unsafe characters.

4 years agoFixing emitAnyConst and related functions to better handle alignment (#36432)
Tanner Gooding [Sun, 24 May 2020 14:41:28 +0000 (07:41 -0700)]
Fixing emitAnyConst and related functions to better handle alignment (#36432)

* Fixing emitAnyConst and related functions to better handle alignment

* Don't use small alignment where it might not be supported

* Applying formatting patch

* Adding some comments explaining how emitAnyConst works

4 years agoAdd comments per code review feedback
Sung Yoon Whang [Sun, 24 May 2020 09:33:12 +0000 (02:33 -0700)]
Add comments per code review feedback

4 years agoDisable GC/API/GC/AddThresholdTest on ARM64 (#36940)
Jan Kotas [Sun, 24 May 2020 07:01:32 +0000 (00:01 -0700)]
Disable GC/API/GC/AddThresholdTest on ARM64 (#36940)

Issue #36850

4 years agoFix exception message to indicate Cofactor is required. (#36821)
Kevin Jones [Sun, 24 May 2020 04:28:15 +0000 (00:28 -0400)]
Fix exception message to indicate Cofactor is required. (#36821)

4 years agoUse BinaryPrimitives where possible. (#36881)
Kevin Jones [Sun, 24 May 2020 04:26:47 +0000 (00:26 -0400)]
Use BinaryPrimitives where possible. (#36881)

4 years agoFollow ups for Math.BigMul (#36920)
Jan Kotas [Sun, 24 May 2020 03:23:20 +0000 (20:23 -0700)]
Follow ups for Math.BigMul (#36920)

- Use more efficient and compact uint cast instead of bit masks where possible
- Improved test coverage
- Update comment in FastMod
- Optimize BigMul for 32-bit platforms

4 years agoUse TARGET_64BIT instead of set of TARGET_<arch> definitions for CLRConfig::EXTERNAL_...
Mikhail Pilin [Sun, 24 May 2020 03:18:14 +0000 (05:18 +0200)]
Use TARGET_64BIT instead of set of TARGET_<arch> definitions for CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_64 and CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_32 checking. (#36924)

4 years ago Remove PreserveDependency from SR class (#36358)
Youssef Victor [Sat, 23 May 2020 09:31:08 +0000 (11:31 +0200)]
 Remove PreserveDependency from SR class (#36358)

4 years agoRevert "Libunwind1.5rc2 (#36027)" (#36909)
Santiago Fernandez Madero [Sat, 23 May 2020 06:33:25 +0000 (23:33 -0700)]
Revert "Libunwind1.5rc2 (#36027)" (#36909)

This reverts commit 8c6c7655bb7abc5c4ce769923aa5bea1daee6bd3.

4 years ago[jit] Return the compiled method and an unbox trampoline from ldvirtftn when calling...
monojenkins [Sat, 23 May 2020 04:17:37 +0000 (00:17 -0400)]
[jit] Return the compiled method and an unbox trampoline from ldvirtftn when calling ldvirtftn on a valuetype method. (#36736)

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

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years agoOptimize BitOperations uses in CoreLib (#35650)
Clinton Ingram [Sat, 23 May 2020 03:50:01 +0000 (20:50 -0700)]
Optimize BitOperations uses in CoreLib (#35650)

* make Log2 branch-free

* convert LeadingZeroCount uses to Log2

* switch Bmi1.TrailingZeroCount calls to BitOperations

4 years agoBigMul with 64-bit operands (#35975)
SRV [Sat, 23 May 2020 03:48:53 +0000 (06:48 +0300)]
BigMul with 64-bit operands (#35975)

* Unsigned 128-bit BigMul

* Signed 128-bit BigMul

* Added explanation of alg and reference to it

* Removed else branch

Co-authored-by: Adeel Mujahid <adeelbm@outlook.com>
4 years ago[Arm64] ASIMD Shift Intrinsics (#36830)
Egor Chesakov [Sat, 23 May 2020 02:44:35 +0000 (19:44 -0700)]
[Arm64] ASIMD Shift Intrinsics (#36830)

* ShiftArithmetic

* ShiftArithmeticRounded

* ShiftArithmeticRoundedSaturate

* ShiftArithmeticRoundedSaturateScalar

* ShiftArithmeticRoundedScalar

* ShiftArithmeticSaturate

* ShiftArithmeticSaturateScalar

* ShiftArithmeticScalar

* ShiftLeftLogical

* ShiftLeftLogicalSaturate

* ShiftLeftLogicalSaturateScalar

* ShiftLeftLogicalSaturateUnsigned

* ShiftLeftLogicalSaturateUnsignedScalar

* ShiftLeftLogicalScalar

* ShiftLeftLogicalWideningLower

* ShiftLeftLogicalWideningUpper

* ShiftLogical

* ShiftLogicalRounded

* ShiftLogicalRoundedSaturate

* ShiftLogicalRoundedSaturateScalar

* ShiftLogicalRoundedScalar

* ShiftLogicalSaturate

* ShiftLogicalSaturateScalar

* ShiftLogicalScalar

* ShiftRightArithmetic

* ShiftRightArithmeticAdd

* ShiftRightArithmeticAddScalar

* ShiftRightArithmeticNarrowingSaturateLower

* ShiftRightArithmeticNarrowingSaturateUnsignedLower

* ShiftRightArithmeticNarrowingSaturateUnsignedUpper

* ShiftRightArithmeticNarrowingSaturateUpper

* ShiftRightArithmeticRounded

* ShiftRightArithmeticRoundedAdd

* ShiftRightArithmeticRoundedAddScalar

* ShiftRightArithmeticRoundedNarrowingSaturateLower

* ShiftRightArithmeticRoundedNarrowingSaturateUnsignedLower

* ShiftRightArithmeticRoundedNarrowingSaturateUnsignedUpper

* ShiftRightArithmeticRoundedNarrowingSaturateUpper

* ShiftRightArithmeticRoundedScalar

* ShiftRightArithmeticScalar

* ShiftRightLogical

* ShiftRightLogicalAdd

* ShiftRightLogicalAddScalar

* ShiftRightLogicalNarrowingLower

* ShiftRightLogicalNarrowingSaturateLower

* ShiftRightLogicalNarrowingSaturateUpper

* ShiftRightLogicalNarrowingUpper

* ShiftRightLogicalRounded

* ShiftRightLogicalRoundedAdd

* ShiftRightLogicalRoundedAddScalar

* ShiftRightLogicalRoundedNarrowingLower

* ShiftRightLogicalRoundedNarrowingSaturateLower

* ShiftRightLogicalRoundedNarrowingSaturateUpper

* ShiftRightLogicalRoundedNarrowingUpper

* ShiftRightLogicalRoundedScalar

* ShiftRightLogicalScalar

* SignExtendWideningLower

* SignExtendWideningUpper

* ZeroExtendWideningLower

* ZeroExtendWideningUpper

* ShiftArithmeticRoundedSaturateScalar

* ShiftArithmeticSaturateScalar

* ShiftLeftLogicalSaturateScalar

* ShiftLeftLogicalSaturateUnsignedScalar

* ShiftLogicalRoundedSaturateScalar

* ShiftLogicalSaturateScalar

* ShiftRightArithmeticNarrowingSaturateScalar

* ShiftRightArithmeticNarrowingSaturateUnsignedScalar

* ShiftRightArithmeticRoundedNarrowingSaturateScalar

* ShiftRightArithmeticRoundedNarrowingSaturateUnsignedScalar

* ShiftRightLogicalNarrowingSaturateScalar

* ShiftRightLogicalRoundedNarrowingSaturateScalar

4 years agoMake Vector256 dependent on AVX instruction set (#36895)
Kunal Pathak [Sat, 23 May 2020 00:50:33 +0000 (17:50 -0700)]
Make Vector256 dependent on AVX instruction set (#36895)

4 years agoRemove dead Exception handling code in Uri (#36865)
Miha Zupan [Sat, 23 May 2020 00:15:28 +0000 (02:15 +0200)]
Remove dead Exception handling code in Uri (#36865)

4 years agoRemove System.Globalization.Native shim from shared framework (#36904)
Santiago Fernandez Madero [Sat, 23 May 2020 00:13:41 +0000 (17:13 -0700)]
Remove System.Globalization.Native shim from shared framework (#36904)

* Remove System.Globalization.Native shim from shared framework

* Add System.Globalization.Native sources to mono paths in pipeline

4 years agoPipelines performance tweaks (#36815)
Ben Adams [Fri, 22 May 2020 23:58:02 +0000 (00:58 +0100)]
Pipelines performance tweaks (#36815)

* Pipelines performance tweaks

* Packaging

* Don't use Unsafe for array cast

* Remove Unsafe use

4 years agoDisable System.Numerics.Tests.Vector3Tests.Vector3InequalityTest on arm64 (#36906)
Santiago Fernandez Madero [Fri, 22 May 2020 23:00:45 +0000 (16:00 -0700)]
Disable System.Numerics.Tests.Vector3Tests.Vector3InequalityTest on arm64 (#36906)

4 years agoImprove obsoletion message for IgnoreNullValues (#36886)
Layomi Akinrinade [Fri, 22 May 2020 21:49:34 +0000 (17:49 -0400)]
Improve obsoletion message for IgnoreNullValues (#36886)

4 years agoFixing make dist after implementation of static ICU Shim. (#36795)
monojenkins [Fri, 22 May 2020 21:23:26 +0000 (17:23 -0400)]
Fixing make dist after implementation of static ICU Shim. (#36795)

Fixing make dist after implementation of static ICU Shim.

Co-authored-by: thaystg <thaystg@users.noreply.github.com>
4 years agoAdd MONO_LOADER_LIBRARY_NAME define (#36835)
Ryan Lucia [Fri, 22 May 2020 21:21:02 +0000 (17:21 -0400)]
Add MONO_LOADER_LIBRARY_NAME define (#36835)

4 years agoRenamed pInitRegZeroed to pInitRegModified, initRegZeroed to initRegM… (#36321)
Ivan [Fri, 22 May 2020 20:57:25 +0000 (15:57 -0500)]
Renamed pInitRegZeroed to pInitRegModified, initRegZeroed to initRegM… (#36321)

4 years ago[Arm64] Follow-up on renaming intrinsics to Narrowing for consistency with Widening...
Egor Chesakov [Fri, 22 May 2020 20:33:59 +0000 (13:33 -0700)]
[Arm64] Follow-up on renaming intrinsics to Narrowing for consistency with Widening (#36857)

* Rename AddHighNarrow to AddHighNarrowing

* Rename AddRoundedHighNarrow to AddRoundedHighNarrowing

* Rename ExtractAndNarrowHigh to ExtractNarrowingUpper

* Rename ExtractAndNarrowLow to ExtractNarrowingLower

* Rename SubtractHighNarrow to SubtractHighNarrowing

* Rename SubtractRoundedHighNarrow to SubtractRoundedHighNarrowing

4 years agoAdd NotNullIfNotNull, MemberNotNull attributes to doc (#36856)
buyaa-n [Fri, 22 May 2020 19:49:42 +0000 (12:49 -0700)]
Add NotNullIfNotNull, MemberNotNull attributes to doc (#36856)

4 years ago[Arm64] Polynomial Multiply Long Intrinsics (#36853)
Egor Chesakov [Fri, 22 May 2020 17:46:19 +0000 (10:46 -0700)]
[Arm64] Polynomial Multiply Long Intrinsics (#36853)

Implements PolynomialMultiplyWideningLower and PolynomialMultiplyWideningUpper

4 years agoFix CoreCLR initialization on Illumos-based distros (#36808)
Adeel Mujahid [Fri, 22 May 2020 17:37:33 +0000 (20:37 +0300)]
Fix CoreCLR initialization on Illumos-based distros (#36808)

4 years agoFix wasm build when runtime configuration and configuration are different (#36855)
Santiago Fernandez Madero [Fri, 22 May 2020 17:07:21 +0000 (10:07 -0700)]
Fix wasm build when runtime configuration and configuration are different (#36855)

* Fix wasm build when runtime configuration and configuration are different

* PR Feedback

4 years agoUse linux-musl runtime on Alpine Helix workers (#36827)
Simon Nattress [Fri, 22 May 2020 16:43:28 +0000 (09:43 -0700)]
Use linux-musl runtime on Alpine Helix workers (#36827)

* Use linux-musl runtime on Alpine Helix workers

* Add OS Subgroup to send-to-helix-step

* Pass in osSubgroup

Also, capitalize it in line with the rest of the repo

* Use __TargetOS which understands linux_musl for rid generation

I don't fully understand why we use `TargetOS` in `helixpublishwitharcade.proj` but set `__TargetOS` in the calling `send-to-helix-step.yml`.

4 years agoEnsure Image.Save can handle non readable / seekable Streams (#36805)
Eric StJohn [Fri, 22 May 2020 13:48:15 +0000 (06:48 -0700)]
Ensure Image.Save can handle non readable / seekable Streams (#36805)

* Ensure Image.Save can handle non readable / seekable Streams

* Address feedback

* Fix Image.Save on Unix for write only non-seekable stream

* Remove test which uses bogus handle value

4 years agoRemove x86 OSX code (#36874)
Jan Vorlicek [Fri, 22 May 2020 13:25:16 +0000 (15:25 +0200)]
Remove x86 OSX code (#36874)

This removes x86 OSX code that was never used for .NET Core.

4 years agoFix a summary typo in ConsoleLoggerOptions.cs (#36870)
Honza Rameš [Fri, 22 May 2020 13:24:56 +0000 (15:24 +0200)]
Fix a summary typo in ConsoleLoggerOptions.cs (#36870)

4 years agoConsider armel arch (#36872)
Gleb Balykov [Fri, 22 May 2020 13:24:00 +0000 (16:24 +0300)]
Consider armel arch (#36872)

4 years agoStrip the ILLinkTrim.xml file from System.Security assemblies (#36864)
Eric Erhardt [Fri, 22 May 2020 13:23:35 +0000 (08:23 -0500)]
Strip the ILLinkTrim.xml file from System.Security assemblies (#36864)

Contributes to #35199

4 years agoMove where wasm binaries are generated (#36781)
Steve Pfister [Fri, 22 May 2020 13:16:40 +0000 (09:16 -0400)]
Move where wasm binaries are generated (#36781)

This change shifts producing wasm binaries to the native dir so that they'll come over to the installer on CI.

4 years ago[mono] Fix MonoRunner.java - assets were not copied correctly (#36824)
Egor Bogatov [Fri, 22 May 2020 08:21:28 +0000 (11:21 +0300)]
[mono] Fix MonoRunner.java - assets were not copied correctly (#36824)

4 years agoAdded CreateDelegate<T> overloads to MethodInfo (#36680)
Ivan Diaz Sanchez [Fri, 22 May 2020 05:43:08 +0000 (22:43 -0700)]
Added CreateDelegate<T> overloads to MethodInfo (#36680)

* Added generic overloads for MethodInfo.CreateDelegate<>()

* Added full support of CreateDelegate<T> and the necessary tests.

* Refactored to apply the new CreateDelegate overloads as necessary throughout runtime.

* Reverted Linq.Expressions changes and fully qualified Delegate to System.Delegate

4 years agoExtract shared functionality to a TryRemoveCastIfPresent method (#36837)
Tanner Gooding [Fri, 22 May 2020 04:37:07 +0000 (21:37 -0700)]
Extract shared functionality to a TryRemoveCastIfPresent method (#36837)

4 years agoUse socketpair to implement Process.Start redirection (#34861)
Stephen Toub [Fri, 22 May 2020 04:19:46 +0000 (00:19 -0400)]
Use socketpair to implement Process.Start redirection (#34861)

* Use socketpair to implement Process.Start redirection

Today on Unix, we create an anonymous pipe via pipe/pipe2 to be used for stdin/stdout/stderr on processes created by Process.Start.  We then wrap the resulting file descriptors with FileStreams to hand out via Process.StandardInput/Output/Error.  This has a few issues, however. Any async operations on the resulting stream (or wrapping stream reader) will actually be async-over-sync, and that in turn means that a) any async read will end up blocking a thread pool thread until it's satisified, and b) the operation isn't cancelable.  The implications of (b) are obvious, and the problem with (a) is that code which launches a bunch of processes and uses BeginOutput/ErrorReadLine or the like will end up blocking a bunch of thread pool threads.

This change replaces the pipe/pipe2 calls with socketpair calls, and instead of wrapping the resulting file descriptors with FileStream, wraps them in Sockets and NetworkStreams.  This gives us the full capabilities of the networking stack, which fully supports asynchronous and cancelable reads and writes.

* Try to fix macOS failures with socketpair

4 years agoPorting more of the SIMD intrinsics to be implemented as HWIntrinsics (#36579)
Tanner Gooding [Fri, 22 May 2020 03:50:35 +0000 (20:50 -0700)]
Porting more of the SIMD intrinsics to be implemented as HWIntrinsics (#36579)

* Porting Ceiling and Floor to use SimdAsHWIntrinsic

* Porting SquareRoot to use SimdAsHWIntrinsic

* Porting ConditionalSelect to use SimdAsHWIntrinsic

* Porting get_AllBitsSet, get_Count, and get_Zero to use SimdAsHWIntrinsic

* Porting op_Explicit to use SimdAsHWIntrinsic

* Changing Vector2/3/4 and Vector<T>.Equals to forward to operator ==

* Removing SIMDIntrinsicAbs

* Removing SIMDIntrinsicMax and SIMDIntrinsicMin

* Removing SIMDIntrinsicCeil and SIMDIntrinsicFloor

* Porting op_Equality and op_Inequality to use SimdAsHWIntrinsic

* Removing SIMDIntrinsicSqrt

* Removing SIMDIntrinsicSelect

* Removing SIMDIntrinsicBitwiseAndNot and SIMDIntrinsicBitwiseXor

* Removing SIMDIntrinsicGreaterThanOrEqual and SIMDIntrinsicLessThanOrEqual

* Removing SIMDIntrinsicGreaterThan and SIMDIntrinsicLessThan

* Removing SIMDIntrinsicInstEquals

* Removing SIMDIntrinsicOpEquality and SIMDIntrinsicOpInEquality

* Porting this.Equals to use SimdAsHWIntrinsic

* Don't handle IEquatable`1.Equals via SimdAsHWIntrinsic

* Applying formatting patch

* Account for op2 being able to precede op1 in the LIR order

* Ensure SimdAsHWIntrinsic with 0 args are properly handled

* Fixup the arm64 LowerHWIntrinsicCmpOp implementation to use LowerNodeCC

* Fixing an assert in the NotSupported HWIntrinsic tests

4 years agoRemove Microsoft.DotNet.PlatformAbstractions (#36707)
Eric Erhardt [Fri, 22 May 2020 02:40:51 +0000 (21:40 -0500)]
Remove Microsoft.DotNet.PlatformAbstractions (#36707)

* Remove Microsoft.DotNet.PlatformAbstractions

This library overlapped with other System APIs and is now obsolete. For API replacement:

ApplicationEnvironment.ApplicationBasePath => AppContext.BaseDirectory
HashCodeCombiner => System.HashCode
RuntimeEnvironment.GetRuntimeIdentifier() => RuntimeInformation.RuntimeIdentifier
RuntimeEnvironment.OperatingSystemPlatform => RuntimeInformation.IsOSPlatform(OSPlatform)
RuntimeEnvironment.RuntimeArchitecture => RuntimeInformation.ProcessArchitecture
RuntimeEnvironment.OperatingSystem => RuntimeInformation.OSDescription
RuntimeEnvironment.OperatingSystemVersion => RuntimeInformation.OSDescription / Environment.OSVersion.Version

Fix #3470

4 years ago[wasm][debugger] Allow invoking property getters for objects (#35934)
monojenkins [Fri, 22 May 2020 02:38:34 +0000 (22:38 -0400)]
[wasm][debugger] Allow invoking property getters for objects (#35934)

Co-authored-by: radical <radical@users.noreply.github.com>
4 years agoJIT: don't call back into morph from fgRemoveConditionalJump (#36792)
Andy Ayers [Fri, 22 May 2020 01:41:29 +0000 (18:41 -0700)]
JIT: don't call back into morph from fgRemoveConditionalJump (#36792)

This can get called before morph and run into issues where morph
specific data is not yet initialized. The remorphing wasn't going to
do much other than extract side effects and rethread the statement
ordering. So just do these latter bits.

Closes #36468.

4 years agoMove app local ICU string length validation to native shim (#36735)
Santiago Fernandez Madero [Fri, 22 May 2020 01:21:53 +0000 (18:21 -0700)]
Move app local ICU string length validation to native shim (#36735)

* Move app local string length validation to native shim

* Fix build

4 years agoAdding A log presence check before trying to delete (#36779)
Anirudh Agnihotry [Thu, 21 May 2020 23:47:13 +0000 (16:47 -0700)]
Adding A log presence check before trying to delete (#36779)

* checking if log is present before deleteing

* Update src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogSourceCreationTests.cs

Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
4 years agoStop emitting weird intermediate folder artifacts/tests/artifacts (#36833)
Tomáš Rylek [Thu, 21 May 2020 22:49:14 +0000 (00:49 +0200)]
Stop emitting weird intermediate folder artifacts/tests/artifacts (#36833)

The logic in dir.common.props for relativizing test directories
doesn't work well for the generated XUnit wrapper csproj files as
these are generated under artifacts\tests. Relativizing this
directory against src\coreclr\tests\src ended up with a weird
sequence that ended up duplicating the tests/artifacts folder
level. I have fixed this by explicitly passing the root directory
for relativization for the XUnit wrapper projects.

Thanks

Tomas

Fixes: #1655

4 years ago[Arm64] ASIMD Shift instructions (#36552)
Egor Chesakov [Thu, 21 May 2020 22:05:21 +0000 (15:05 -0700)]
[Arm64] ASIMD Shift instructions (#36552)

* sqrshl

* sqrshrn

* sqrshrn2

* sqrshrun

* sqrshrun2

* sqshl

* sqshlu

* sqshrn

* sqshrn2

* sqshrun

* sqshrun2

* srshl

* sshl

* uqrshl

* uqrshrn

* uqrshrn2

* uqshl

* uqshrn

* uqshrn2

* urshl

* ushl

4 years agoMinor documentation improvements (#36834)
Eirik Tsarpalis [Thu, 21 May 2020 20:14:52 +0000 (21:14 +0100)]
Minor documentation improvements (#36834)

4 years agoUpdating the HWIntrinsics to support dropping unnecessary casts (#36512)
Tanner Gooding [Thu, 21 May 2020 19:51:50 +0000 (12:51 -0700)]
Updating the HWIntrinsics to support dropping unnecessary casts (#36512)

* Updating the HWIntrinsics to support dropping unnecessary casts

* Applying formatting patch

* Only drop the cast operation if the source is greater than or equal to the expected size

4 years agoEnable passing coreclr tests (#36702)
Fan Yang [Thu, 21 May 2020 18:39:47 +0000 (14:39 -0400)]
Enable passing coreclr tests (#36702)

4 years agoAllow building Browser/wasm config on Windows (#36816)
Michal Strehovský [Thu, 21 May 2020 18:25:01 +0000 (20:25 +0200)]
Allow building Browser/wasm config on Windows (#36816)

Seems to work fine for the `Mono.CoreLib` subset, which is all we care about in the IL Linker-land.

4 years agoAdding check to bypass decoding pdbs that have no sequence points. (#36771)
monojenkins [Thu, 21 May 2020 18:24:31 +0000 (14:24 -0400)]
Adding check to bypass decoding pdbs that have no sequence points. (#36771)

Unity has a pdb with zero sequence points somehow. If a user added a reference to the library and then attempted to set a managed breakpoint mono would hit an assert and crash when it would attempt to decode this pdb.

Call stack would look like:
```
> mono-2.0-boehm.dll!mono_ppdb_get_seq_points(_MonoDebugMethodInfo * minfo, char * * source_file, _GPtrArray * * source_file_list, int * * source_files, MonoSymSeqPoint * * seq_points, int * n_seq_points) Line 508 C
  mono-2.0-boehm.dll!mono_debug_get_seq_points(_MonoDebugMethodInfo * minfo, char * * source_file, _GPtrArray * * source_file_list, int * * source_files, MonoSymSeqPoint * * seq_points, int * n_seq_points) Line 1093 C
  mono-2.0-boehm.dll!get_source_files_for_type(_MonoClass * klass) Line 6920 C
  mono-2.0-boehm.dll!get_types_for_source_file(void * key, void * value, void * user_data) Line 7003 C
  mono-2.0-boehm.dll!monoeg_g_hash_table_foreach(_GHashTable * hash, void(*)(void *, void *, void *) func, void * user_data) Line 364 C
  mono-2.0-boehm.dll!mono_de_foreach_domain(void(*)(void *, void *, void *) func, void * user_data) Line 95 C
  mono-2.0-boehm.dll!vm_commands(int command, int id, unsigned char * p, unsigned char * end, Buffer * buf) Line 7341 C
  mono-2.0-boehm.dll!debugger_thread(void * arg) Line 10323 C
  mono-2.0-boehm.dll!start_wrapper_internal(StartInfo * start_info, unsigned __int64 * stack_ptr) Line 1241 C
  mono-2.0-boehm.dll!start_wrapper(void * data) Line 1315 C
  kernel32.dll!00007ffc12017bd4() Unknown
  ntdll.dll!00007ffc121ece51() Unknown
```

Adding a check to ignore pdbs like this prevents the crash and debugging can continue normally.

Related unity issue: https://issuetracker.unity3d.com/issues/macos-editor-crashes-on-mono-log-write-logfile-when-attaching-a-debugger-and-then-setting-a-breakpoint

Co-authored-by: UnityAlex <UnityAlex@users.noreply.github.com>
4 years agoHandle multi-reg copies/reloads (#36802)
Carol Eidt [Thu, 21 May 2020 18:14:46 +0000 (11:14 -0700)]
Handle multi-reg copies/reloads (#36802)

Fix #36619

4 years agoAdd autoconf, automake and libtool as dependencies (#36475)
Egor Bogatov [Thu, 21 May 2020 14:11:57 +0000 (17:11 +0300)]
Add autoconf, automake and libtool as dependencies (#36475)

* Add autoconf, automake and libtool as dependencies

* Update instructions

4 years agoFixing tests on android. (#36788)
Thays Grazia [Thu, 21 May 2020 09:29:14 +0000 (06:29 -0300)]
Fixing tests on android. (#36788)

The linker was removing the icu shim functions even exporting them. The unique solution that we found until now is to force the linking using the -u flag.
This is a temporary fix until we don't implement QCalls.
Fixes https://github.com/dotnet/runtime/issues/36685

4 years agoFix missing symbol issues in SunOS build (#36455)
Adeel Mujahid [Thu, 21 May 2020 08:41:31 +0000 (11:41 +0300)]
Fix missing symbol issues in SunOS build (#36455)

* Fix missing symbol issues in SunOS build

* Fix SIGSEGV due to invalid free()

4 years agoAdd JIT EventCounters (#36489)
Sung Yoon Whang [Thu, 21 May 2020 06:42:00 +0000 (23:42 -0700)]
Add JIT EventCounters (#36489)

* Add JIT counters

* Some renames

* fix build

* change return type of GetMethodsJittedCount to int

* remove ifdef

* Fix

* CR feedback

* More CR feedback

* More CR Feedback

* more code review feedback

* Fix build error and add displayunit to IL bytes jitted counter

4 years agoAdd R2R testing on Windows arm/arm64 (#36793)
Bruce Forstall [Thu, 21 May 2020 04:34:49 +0000 (21:34 -0700)]
Add R2R testing on Windows arm/arm64 (#36793)

4 years agoFix two issues with hosting on SunOS (#36527)
Adeel Mujahid [Thu, 21 May 2020 04:10:26 +0000 (07:10 +0300)]
Fix two issues with hosting on SunOS (#36527)

Fix two issues with hosting on SunOS:
* Compile corehost without use-cxa-atexit with gcc
* Disable RapidJson's 48-bit optimization on SunOS

* Compile without [`use-cxa-atexit`](https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html) in case of gcc
  * libc tries to invoke `pthread_cond_destroy()` in `dlclose()`ed fxr library in the consumer code. PR disables this feature.
  * Backtrace available at http://sprunge.us/bx4dlk. This happens _after_ the main() exits.
* Disable RapidJson's 48-bit pointer optimization on SunOS.
  * This optimization relies on zeros in higher 16-bits, whereas SunOS has 1s. More details at https://github.com/Tencent/rapidjson/issues/1596.
  * The impact here was that `runtimeOptions` key available in `hwapp.runtimeconfig.json` was not located by RapidJson's `FindMember()` API and we were getting `false` from: https://github.com/dotnet/runtime/blob/78b303df8fbb242985d049a277d0d199cafd51b5/src/installer/corehost/cli/runtime_config.cpp#L416-L422

Contributes to: #34944.

4 years agoUpdate public GC.AddMemoryPressure() and GC.RemoveMemoryPressure() (#36767)
Aaron Robinson [Thu, 21 May 2020 03:39:51 +0000 (20:39 -0700)]
Update public GC.AddMemoryPressure() and GC.RemoveMemoryPressure() (#36767)

* Update public GC.AddMemoryPressure() and GC.RemoveMemoryPressure()
to use newer algorithm.

* Remove old AddMemoryPressure/RemoveMemoryPressure impls

* Update test.

* Removing duplicate tests from coreclr directory.

4 years agoFix non-ascii absolute file path handling in Uri (#36429)
Miha Zupan [Thu, 21 May 2020 02:29:20 +0000 (04:29 +0200)]
Fix non-ascii absolute file path handling in Uri (#36429)

* Fix non-ascii absolute file path Uri handling

* Fix Unix tests

* Revert unrelated style change

* Add asserts to FilePathHandlesNonAscii to test AbsoluteUri roundtrips properties

4 years agoAdding a case requiring RuntimeJit (#36772)
Manish Godse [Thu, 21 May 2020 01:10:01 +0000 (18:10 -0700)]
Adding a case requiring RuntimeJit (#36772)

Handle CORINFO_HELP_THROW_NOT_IMPLEMENTED

4 years agoFix signing due to subset projects rename (#36791)
Santiago Fernandez Madero [Thu, 21 May 2020 00:52:07 +0000 (17:52 -0700)]
Fix signing due to subset projects rename (#36791)

4 years agoFix evaluate paths bug when multiple include paths are specified (#36780)
Santiago Fernandez Madero [Thu, 21 May 2020 00:17:52 +0000 (17:17 -0700)]
Fix evaluate paths bug when multiple include paths are specified (#36780)

4 years agoOptimize ToVector128, ToVector128Unsafe and Vector128.GetLower() (#36732)
Kunal Pathak [Wed, 20 May 2020 23:32:50 +0000 (16:32 -0700)]
Optimize ToVector128, ToVector128Unsafe and Vector128.GetLower() (#36732)

* Optimize ToVector128 , ToVector128Unsafe and Vector128.GetLower()

4 years agoJIT: widen type of constant or special static fields (#36769)
Andy Ayers [Wed, 20 May 2020 23:00:51 +0000 (16:00 -0700)]
JIT: widen type of constant or special static fields (#36769)

Since we're pushing the value of these fields we need to widen the value
to a stack type.

Addresses issues seen in #36592.

4 years ago[mono] Implement AsAny marshalling for simple arrays (#35686)
Alexis Christoforides [Wed, 20 May 2020 22:59:29 +0000 (18:59 -0400)]
[mono] Implement AsAny marshalling for simple arrays (#35686)

* [mono] Implement AsAny marshalling for simple arrays

Simple here means of rank 1, and with a blittable value type as element type.

* Also implement char arrays

* Do not allow in-params to be marshalled this way, as the callee would have write-ability that is not allowed by in-params

4 years agoSupport !JitDoOldStructRetyping on other platforms. (#35943)
Sergey Andreenko [Wed, 20 May 2020 22:52:13 +0000 (15:52 -0700)]
Support !JitDoOldStructRetyping on  other platforms. (#35943)

* Add more test cases.

* Initialize `ReturnTypeDesc` when we keep struct types.

* Add a few const modifiers.

* Additional checks in `LowerRet`

* Support `return double(cnst int)`.

* Optimize `LowerRetStruct`: no need for bitcast when read from memory.

* Prepare `LowerNode` for store local and local field to multireg.

* Compile the new methods with FEATURE_MULTIREG_RET.

* Improve `LowerRetStructLclVar`.

Don't use bitcast if the source is in memory or has the same type.

* Extract `LowerStoreLocCommon`.

* Support 3, 5. 6, 7 bytes structs in `LowerCallStruct`.

Move call handling to the users.

* Disable `JitDoOldStructRetyping` for x86 and x64.

Windows  x64 was supported in a previous PR, this adds x86 (Windows and Linux) and x64 Unix.

* Fix suggestions.

* Disable by default for the merge.

4 years ago[master] Update dependencies from mono/linker dotnet/llvm-project dotnet/xharness...
dotnet-maestro[bot] [Wed, 20 May 2020 22:51:11 +0000 (00:51 +0200)]
[master] Update dependencies from mono/linker dotnet/llvm-project dotnet/xharness (#36764)

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

runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk
 From Version 9.0.1-alpha.1.20262.1 -> To Version 9.0.1-alpha.1.20268.2

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

Microsoft.NET.ILLink.Tasks
 From Version 5.0.0-preview.3.20268.5 -> To Version 5.0.0-preview.3.20269.1

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

Microsoft.DotNet.XHarness.Tests.Runners
 From Version 1.0.0-prerelease.20265.8 -> To Version 1.0.0-prerelease.20270.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years ago[interp] Add separate opcode for pop vt (#36760)
monojenkins [Wed, 20 May 2020 21:35:59 +0000 (17:35 -0400)]
[interp] Add separate opcode for pop vt (#36760)

Before this change, pop-ing a vt from the stack was done in 2 opcodes, a MINT_POP (decrementing the stack) and the weird MINT_VTRESULT (decrementing the vtstack). However, optimizations could have removed both the initial loading of the value type on the stack as well as the MINT_POP, leaving MINT_VTRESULT underflowing the vtstack. Fix this and cleanup the code by pop-ing a value type from the stack in a single instruction.

Co-authored-by: BrzVlad <BrzVlad@users.noreply.github.com>
4 years agoCache Uri.IdnHost and Uri.PathAndQuery (#36460)
Miha Zupan [Wed, 20 May 2020 18:47:28 +0000 (20:47 +0200)]
Cache Uri.IdnHost and Uri.PathAndQuery (#36460)

* Cache Uri.IdnHost and Uri.PathAndQuery

* Continue caching DnsSafeHost

* Move PathAndQuery cache from MoreInfo to UriInfo

* Move DnsSafeHost and IdnHost logic to IdnHost getter

* Add more Host tests

4 years agoRemove overwriting RuntimeIdentifier in runtime.depproj for wasm/ios/android (#36757)
Alexander Köplinger [Wed, 20 May 2020 18:46:24 +0000 (20:46 +0200)]
Remove overwriting RuntimeIdentifier in runtime.depproj for wasm/ios/android (#36757)

It shouldn't be needed anymore since we have real assets for these targets now.