platform/upstream/dotnet/runtime.git
4 years ago[netcore] Cleanups. (mono/mono#17661)
Zoltan Varga [Fri, 1 Nov 2019 16:52:45 +0000 (12:52 -0400)]
[netcore] Cleanups. (mono/mono#17661)

* [netcore] Remove the type_info field from RuntimeType, extend the TypeCache structure instead.

* [netcore] Remove some linker exclusions which are not needed.

Commit migrated from https://github.com/mono/mono/commit/e9d68e9485611d47c3ad17f3b4d178089e68cab0

4 years ago[System.Net.Http]: Bring `HttpClient` from CoreFX on monotouch and xammac. (mono...
Jo Shields [Fri, 1 Nov 2019 14:26:08 +0000 (10:26 -0400)]
[System.Net.Http]: Bring `HttpClient` from CoreFX on monotouch and xammac. (mono/mono#17628)

Commit migrated from https://github.com/mono/mono/commit/16d1a2e6f124ca80875870841b0ce1a7c605673e

4 years ago[interp] Handle remoting field access same as jit (mono/mono#17641)
Vlad Brezae [Fri, 1 Nov 2019 12:55:58 +0000 (14:55 +0200)]
[interp] Handle remoting field access same as jit (mono/mono#17641)

Doing this we avoid using slow ldrmfld in the common case of loading fields from instance methods, when we execute on the real object. We could do this also for strmfld but we need to track on the stack if the instance object is this, which is not worth the trouble.

Commit migrated from https://github.com/mono/mono/commit/166fdf60b0eecb66e36ea744a75366fec9f92170

4 years ago[interp] Optimize call path (mono/mono#17623)
Vlad Brezae [Fri, 1 Nov 2019 12:55:27 +0000 (14:55 +0200)]
[interp] Optimize call path (mono/mono#17623)

* [interp] Optimize void calls

By avoiding setting of retval

* [interp] Avoid computing param count for every call

* [interp] Remove wrong profiler check

From the times when interp had its own EH mechanism. We raise this event from mono_handle_exception_internal for interp.

* [interp] Remove profiling check code from method exit

We emit MINT_PROF_EXIT opcode when under profiler. Unify profiling enter/exit with tracing enter/exit since they are very similar.

Commit migrated from https://github.com/mono/mono/commit/170d33c35b76933c1d726922a7c40a9af5a6017d

4 years agoLower min/max SSE operations on x64 (mono/mono#17536)
Filip Navara [Fri, 1 Nov 2019 12:30:41 +0000 (13:30 +0100)]
Lower min/max SSE operations on x64 (mono/mono#17536)

Follow up on mono/mono#17511.

Commit migrated from https://github.com/mono/mono/commit/8aa3654de586bf87ce69608eac71675eeef74a45

4 years ago[llvm] Fix a case where we treated the dreg of a store_membase instruction as a dreg...
Zoltan Varga [Fri, 1 Nov 2019 07:43:42 +0000 (03:43 -0400)]
[llvm] Fix a case where we treated the dreg of a store_membase instruction as a dreg, its actually the base reg. (mono/mono#17648)

Commit migrated from https://github.com/mono/mono/commit/dc8d55d4462216db4c3cb5f9eb3167fc6b746575

4 years ago[interp] Avoid emitting MINT_SAFEPOINT for every single call (mono/mono#17625)
Vlad Brezae [Thu, 31 Oct 2019 15:49:16 +0000 (17:49 +0200)]
[interp] Avoid emitting MINT_SAFEPOINT for every single call (mono/mono#17625)

Commit migrated from https://github.com/mono/mono/commit/b484979aa9741673c2f820bdac7f5c925128ad9d

4 years agoAvoid caching of System.dll image and types as they may be unloaded with appdomain...
Jonathan Chambers [Thu, 31 Oct 2019 14:13:01 +0000 (10:13 -0400)]
Avoid caching of System.dll image and types as they may be unloaded with appdomain. (mono/mono#17602)

Commit migrated from https://github.com/mono/mono/commit/3648cb087b0b49c05300789a1bf5724d942ca174

4 years agoFix build
Alexander Köplinger [Thu, 31 Oct 2019 12:37:55 +0000 (13:37 +0100)]
Fix build

Commit migrated from https://github.com/mono/mono/commit/ca72deed17918505422a6b0ca67201fcf7021af0

4 years ago[interp] Fix interp logging (mono/mono#17636)
Vlad Brezae [Thu, 31 Oct 2019 13:32:50 +0000 (15:32 +0200)]
[interp] Fix interp logging (mono/mono#17636)

* [interp] Don't print NOPs during cprop

They can become numerous and distracting.

* [interp] Fix mono_interp_print_code

Regressed after code_size was changed to byte count instead of short count.

Commit migrated from https://github.com/mono/mono/commit/1d043a31e7d207739f81b303b7ee2c79ed135859

4 years ago[runtime] Add a --enable-minimal=threads configure option to disable threading suppor...
Zoltan Varga [Thu, 31 Oct 2019 05:33:50 +0000 (01:33 -0400)]
[runtime] Add a --enable-minimal=threads configure option to disable threading support. Use it on wasm. (mono/mono#17611)

Commit migrated from https://github.com/mono/mono/commit/dc76a95aa9d266c0c9611408b00e63dfeca214b5

4 years ago[eglib] Assert in g_strlcpy () if src/dest is NULL, instead of printing a warning...
Zoltan Varga [Wed, 30 Oct 2019 20:07:44 +0000 (16:07 -0400)]
[eglib] Assert in g_strlcpy () if src/dest is NULL, instead of printing a warning. (mono/mono#17507)

Related to https://github.com/mono/mono/issues/17283.

Commit migrated from https://github.com/mono/mono/commit/5811404e55e7b61f747ea93226d506e2e3fc3210

4 years agoRearrange System.Private.CoreLib for easier monorepo integration (mono/mono#17517)
Jo Shields [Wed, 30 Oct 2019 19:09:06 +0000 (15:09 -0400)]
Rearrange System.Private.CoreLib for easier monorepo integration (mono/mono#17517)

* [netcore] Move corlib around to match CoreCLR directory layout better

This is a prerequisite to making a sane migration of this whole
directory from mono.git to coreclr.git

Commit migrated from https://github.com/mono/mono/commit/27921fbbd06baadeb5fa07049c587e2a214d131f

4 years ago[dim][regression] Explicit interface override (mono/mono#17583)
Thays Grazia [Wed, 30 Oct 2019 17:47:15 +0000 (14:47 -0300)]
[dim][regression] Explicit interface override (mono/mono#17583)

* Precedence order:
-> Override interface method in class
-> Method in class
-> DIM

Commit migrated from https://github.com/mono/mono/commit/fffb1201bdd14e18e19a3c61d0afe25a91a2d501

4 years ago[interp] fix signature mismatch between jit<>interp for string constructor (mono...
Bernhard Urban-Forster [Wed, 30 Oct 2019 15:36:04 +0000 (16:36 +0100)]
[interp] fix signature mismatch between jit<>interp for string constructor (mono/mono#17595)

[interp] fix signature mismatch between jit<>interp for string constructor

Commit migrated from https://github.com/mono/mono/commit/95cad2452622dcc7197bbc312d6b397172b4a313

4 years ago[System.Private.CoreLib] Remove NativeRuntimeEventSource
Marek Safar [Wed, 30 Oct 2019 07:03:41 +0000 (08:03 +0100)]
[System.Private.CoreLib] Remove NativeRuntimeEventSource

Commit migrated from https://github.com/mono/mono/commit/e4c0b50dec5f90cdd369a842d577bab37ba059fb

4 years agoInline TLS access. (mono/mono#17119)
Jay Krell [Wed, 30 Oct 2019 15:06:24 +0000 (08:06 -0700)]
Inline TLS access. (mono/mono#17119)

Inline TLS access.

This attempt differs from the previous in that the TLS accessor functions are presented to far less code, i.e. not to main.c, so their data references do not need to be resolved so much.

See https://github.com/mono/mono/commit/mono/mono@bffd4c6b99213a0b154d7efac9b0581df67775e8 etc.

Commit migrated from https://github.com/mono/mono/commit/10ac2750e2b29c812e553778aa854e8653e0dadb

4 years agoRemove some unused icalls. (mono/mono#17612)
Zoltan Varga [Wed, 30 Oct 2019 14:08:50 +0000 (10:08 -0400)]
Remove some unused icalls. (mono/mono#17612)

Commit migrated from https://github.com/mono/mono/commit/79f5e6c288a542aa67a7626c0e6b7e873b6ba78d

4 years ago[netcore] Report errors on Windows CI (mono/mono#17616)
Filip Navara [Wed, 30 Oct 2019 13:39:47 +0000 (14:39 +0100)]
[netcore] Report errors on Windows CI (mono/mono#17616)

* [netcore] Report errors on Windows CI

* Fix Windows build

Commit migrated from https://github.com/mono/mono/commit/3d397805d4bb5764bc2e8e0da3c83d47c4b1f569

4 years ago[wasm] Print a useful error message instead of a signature mismatch error on missing...
Zoltan Varga [Wed, 30 Oct 2019 04:04:15 +0000 (00:04 -0400)]
[wasm] Print a useful error message instead of a signature mismatch error on missing icalls. (mono/mono#17600)

Commit migrated from https://github.com/mono/mono/commit/2823ac5d95bd9558de0b164271968ac3cb2d6c58

4 years ago[wasm] Fix build problems. (mono/mono#17596)
Zoltan Varga [Wed, 30 Oct 2019 04:03:08 +0000 (00:03 -0400)]
[wasm] Fix build problems. (mono/mono#17596)

* [runtime] Add a stub for MacOsIPInterfaceProperties::ParseRouteInfo icall on non-osx platforms to fix the wasm aot build.

* [wasm] Avoid generating invalid ninja build files if an assembly is specified on the command line and its also an implicit reference.

* Put back and ifdef.

* Fix the windows build.

Commit migrated from https://github.com/mono/mono/commit/9adce0b6321e4bcc7ca40074b7d1293d3f0e8eb2

4 years agoTemporary build fix
Filip Navara [Tue, 29 Oct 2019 20:55:55 +0000 (21:55 +0100)]
Temporary build fix

Commit migrated from https://github.com/mono/mono/commit/d49d3efd5d7832e8c599a1a34431b5c68650639a

4 years ago[mini] Initial tiered compilation work (mono/mono#17551)
Bernhard Urban-Forster [Tue, 29 Oct 2019 21:36:01 +0000 (22:36 +0100)]
[mini] Initial tiered compilation work (mono/mono#17551)

[mini] Initial tiered compilation work

Enable it with `./autogen.sh --enable-experiment=tiered`.

Let's consider `Simple.cs`:
```csharp
using System.Runtime.CompilerServices;
using System;

public class Simple {
    public static void Main (string []args) {
        HotMethod ();
        Console.WriteLine ("cnt: " + cnt);
        HotMethod ();
        Console.WriteLine ("cnt: " + cnt);
    }

    static int cnt = 0;

    [MethodImplAttribute (MethodImplOptions.NoInlining)]
    public static void HotMethod () {
        for (int i = 0; i <= 1000; i++)
            cnt += i;
    }
}
```

```console
$ csc Simple.cs
$ MONO_LOG_LEVEL=debug MONO_LOG_MASK=tiered ./mono/mini/mono-sgen --trace=M:Simple:HotMethod --interp=-all Simple.exe
[0x10ec275c0: 0.00000 0] ENTER:i Simple:HotMethod ()()
Mono: tiered: queued Simple:HotMethod ()
[0x10ec275c0: 0.00010 0] LEAVE:i Simple:HotMethod ()(
Mono: tiered: patching 0x7fe855803224 with patch_kind=INTERP @ tier_level=0
Mono:   -> caller= Simple:Main (string[]) [{0x7fe85420df88} + 0x34 interp]  (0x7fe8558031f0 0x7fe855803258) [0x7fe85420c880 - Simple.exe]
Mono:   -> callee=Simple:HotMethod ()
Mono: tiered: patching 0x7fe8558031f2 with patch_kind=INTERP @ tier_level=0
Mono:   -> caller= Simple:Main (string[]) [{0x7fe85420df88} + 0x2 interp]  (0x7fe8558031f0 0x7fe855803258) [0x7fe85420c880 - Simple.exe]
Mono:   -> callee=Simple:HotMethod ()
cnt: 500500
[0x10ec275c0: 0.04093 0] ENTER:c Simple:HotMethod ()()
[0x10ec275c0: 0.04095 0] LEAVE:c Simple:HotMethod ()(
cnt: 1001000
```
Note the suffix after `ENTER:`
* `i` indicates it's executed by the interpreter
* `c` indicates it's a compiled method (JIT)

Another example:
```console
$ make -C mono/mini gshared.exe
$ ./mono/mini/mono-sgen --interp=-all --stats ./mono/mini/gshared.exe
Regression tests: 84 ran, 0 failed in Tests
[...]
Tiered statistics
Methods promoted                    : 68
```

It's a basic proof-of-concept for now. An incomplete list of future work items:

* Right now it only works for direct calls, need to expand it to virtual/interface calls.
* Calls of the JIT leading into the interpreter again can't be patched yet.
* Kind of related, no concept of versioning compiled methods does exist yet. The interpreter maintains its own table of "transformed" methods, however, when doing the transition from JIT->interpreter, the wrapper+interpmethod will end up in the JIT table. We need a way to have multiple JIT compilation results for the same MonoMethod exist.
* Investigate actual performance. We might have to optimize the interp<>JIT transition.
* Patching is racy. Need to make that atomic.
* All the FIXMEs in this PR

<!--
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
-->

Commit migrated from https://github.com/mono/mono/commit/d274cfbacdb2aeab0184662997882f3d78991e48

4 years ago[eglib] Handle dli.dli_sname being NULL in g_module_address (). (mono/mono#17592)
Zoltan Varga [Tue, 29 Oct 2019 13:21:23 +0000 (09:21 -0400)]
[eglib] Handle dli.dli_sname being NULL in g_module_address (). (mono/mono#17592)

Should fix the warnings/assertions in g_strlcpy ().

Commit migrated from https://github.com/mono/mono/commit/b0d966bd7ab887f075f6ce3d1c9858af6b52f30f

4 years ago[master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx ...
dotnet-maestro[bot] [Tue, 29 Oct 2019 11:51:33 +0000 (12:51 +0100)]
[master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx (mono/mono#17577)

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

- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19527.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19527.3

* Update dependencies from https://github.com/dotnet/core-setup build 20191027.2

- Microsoft.NETCore.App - 5.0.0-alpha1.19527.2

* Update dependencies from https://github.com/dotnet/corefx build 20191027.5

- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha.1.19527.5

* Update CoreFX.issues.rsp

GetGCMemoryInfo was moved to GCExtendedTests in https://github.com/dotnet/corefx/commit/mono/mono@d6dac9e6a7875862b91139334c8ec620f599cd4d.

GetTotalAllocatedBytes and GetAllocatedBytesForCurrentThread seem to pass now.

Commit migrated from https://github.com/mono/mono/commit/cddf90dda46e7420679636ac1d358f411a5b5fcf

4 years ago[runtime] Implement support for SuppressGCTransitionAttribute. (mono/mono#17534)
Zoltan Varga [Mon, 28 Oct 2019 14:59:53 +0000 (10:59 -0400)]
[runtime] Implement support for SuppressGCTransitionAttribute. (mono/mono#17534)

Fixes https://github.com/mono/mono/issues/17367.

Commit migrated from https://github.com/mono/mono/commit/e4cc70f4b5038ec5d6500ba988d0bb67143658bc

4 years agoAdditional and adjusted logging for parallel minor GC. (mono/mono#17522)
Johan Lorensson [Mon, 28 Oct 2019 14:34:42 +0000 (15:34 +0100)]
Additional and adjusted logging for parallel minor GC. (mono/mono#17522)

* Additional and adjusted logging for parallel minor GC.

When running parallel minor GC we currently get incorrect timing
on several loggings and counters due to work being put on thread pool
and accumulated. This commit fix so that the logging is accurate
when running with and without parallelization. In parallel mode a new
logging is also added to show the accumulated split between major and los
remset scan jobs.

The counters time_minor_scan_remsets and time_minor_scan_roots are only
updated when not running parallel GC since they are not correct when
running parallel GC.

* Fix WASM build error.

Commit migrated from https://github.com/mono/mono/commit/c5edcd1ed443ae5b960d8f8972b0850b7999e44a

4 years ago[netcore] Fix offsets generation when cross compiling
Alexander Köplinger [Fri, 25 Oct 2019 18:32:03 +0000 (20:32 +0200)]
[netcore] Fix offsets generation when cross compiling

The offsets-tool.py uses some magic to map `typename` to `<underscore>typename` for looking up runtime types.
This caused issues on netcore because we aliased it to a different name.

To fix this let's keep the `_MonoInternalThread` name instead and just fix the one location where `_MonoThread` is used.

Commit migrated from https://github.com/mono/mono/commit/450d4746849d228c85748d9ab4ef68f90ac0c7f2

4 years ago[netcore] Don't load types in aot-compiler.c that don't exist in corefx
Alexander Köplinger [Fri, 25 Oct 2019 18:27:34 +0000 (20:27 +0200)]
[netcore] Don't load types in aot-compiler.c that don't exist in corefx

Fixes https://github.com/mono/mono/issues/16026

Commit migrated from https://github.com/mono/mono/commit/fb7b075e4930751421a5feb0b9ac095d832df228

4 years ago[merp] Introduce a new 'dump mode' that allows different signal behavior when dumping...
Alexis Christoforides [Sat, 26 Oct 2019 22:48:40 +0000 (18:48 -0400)]
[merp] Introduce a new 'dump mode' that allows different signal behavior when dumping (mono/mono#17537)

* dump_native_stacktrace should always register the sigterm handler.

Cherry picked from the https://github.com/mono/mono/pull/17310

* [merp] Introduce a new 'dump mode' that allows different signal behavior when dumping

The primary reason for this is gaining the ability to interpret SIGTERM properly as a crashing signal when outside of 'dump mode', and as a utility signal during the 'thread summarizer' dumping process.

Commit migrated from https://github.com/mono/mono/commit/db568c6fe0cb5eab71ed729ec5b412365eacf280

4 years ago[runtime] Unbalanced GC Unsafe transitions before shutdown (mono/mono#17566)
Aleksey Kliger (λgeek) [Sat, 26 Oct 2019 22:45:35 +0000 (18:45 -0400)]
[runtime] Unbalanced GC Unsafe transitions before shutdown (mono/mono#17566)

When embedders call mono_runtime_quit or mono_jit_cleanup, we need to do unbalanced transitions to GC Unsafe, because after mini_cleanup runs we don't have GC thread states anymore and MONO_EXIT_GC_UNSAFE will assert.

* [runtime] Do an unbalanced GC Unsafe transition in mono_jit_cleanup

After mini_cleanup, we don't have GC thread states anymore because all that
stuff was cleaned up, so MONO_EXIT_GC_UNSAFE would assert

* [runtime] Mark mono_runtime_quit external only.

Runtime should use mono_runtime_quit_internal.

After we call the quit_function (aka mini_cleanup) we don't have any GC thread
states anymore because all that stuff got cleaned up.  So MONO_EXIT_GC_UNSAFE
can't work.

Commit migrated from https://github.com/mono/mono/commit/0e3caf00df54199be88cfcb53ed847226defebb4

4 years ago[cxx][x86] int/ptr casts (mono/mono#17570)
Jay Krell [Sat, 26 Oct 2019 16:26:15 +0000 (09:26 -0700)]
[cxx][x86] int/ptr casts (mono/mono#17570)

[cxx][x86] int/ptr casts

Commit migrated from https://github.com/mono/mono/commit/5f3446bd12c32727b926eb0d39769af96a6a389c

4 years ago[cxx] Compile mini-llvm.c as C++ if configure -enable-cxx. (mono/mono#17558)
Jay Krell [Fri, 25 Oct 2019 15:46:01 +0000 (08:46 -0700)]
[cxx] Compile mini-llvm.c as C++ if configure -enable-cxx. (mono/mono#17558)

[cxx] Compile mini-llvm.c as C++ if configure -enable-cxx.

This is presently catastrophic, because of `MonoJitICallId` varying between C and C++, and therefore the layout of `MonoCallInst`.

Related to:
https://github.com/mono/mono/pull/17557

https://github.com/mono/mono/pull/17445#issuecomment-546175352

Commit migrated from https://github.com/mono/mono/commit/893486638cae8efc46323d6c2209fc99febcd05d

4 years ago[jit][x86][cxx] int/ptr casts (mono/mono#17382)
Jay Krell [Fri, 25 Oct 2019 15:34:50 +0000 (08:34 -0700)]
[jit][x86][cxx] int/ptr casts (mono/mono#17382)

Commit migrated from https://github.com/mono/mono/commit/84d64d314bdbbd8cee07bbcb9ec8d030abe0156d

4 years ago[runtime] Make mono_thread_manage external only (mono/mono#17554)
Aleksey Kliger (λgeek) [Fri, 25 Oct 2019 15:28:18 +0000 (11:28 -0400)]
[runtime] Make mono_thread_manage external only (mono/mono#17554)

* [runtime] Make mono_thread_manage external only

runtime should use mono_thread_manage_internal

Commit migrated from https://github.com/mono/mono/commit/d6ee245c94a8365c1d418ea82f9b83ce11cc53a3

4 years ago[interp] Optimize stelem (mono/mono#17519)
Vlad Brezae [Fri, 25 Oct 2019 14:25:08 +0000 (17:25 +0300)]
[interp] Optimize stelem (mono/mono#17519)

* [interp] Optimize stelem instructions

* [intepr] Optimize stelem_ref and slowpath casts

mono_object_isinst_checked uses coop handles and is very slow. Attempt to use the straightforward mono_class_is_assignable_from_checked.

Makes stelem_ref 5x faster.

Commit migrated from https://github.com/mono/mono/commit/768fefbad1e3835c3be09828c9c43f2964079f65

4 years ago[llvm] Use -place-safepoints in JIT mode too (mono/mono#17116)
Egor Bogatov [Fri, 25 Oct 2019 14:10:57 +0000 (17:10 +0300)]
[llvm] Use -place-safepoints in JIT mode too (mono/mono#17116)

* always use -place-safepoints pass in JIT mode

* ignore loaded llvm

* remove gc.safepoint_poll after optimizations

* fix typo

* cleanup

* cleanup

* cleanup

* cleanup

* Do not emit safepoints on entry thus simple functions (without calls and loops) won't have them at all

* Undo  -spp-no-entry=true

* fix failing tests

* do not emit sp in Allocators

Commit migrated from https://github.com/mono/mono/commit/dc4a7f5ed7094a586cee28c4f9987c40b4f2cea5

4 years ago[cxx] externC for some icalls, for wasm and ios. (mono/mono#17444)
Jay Krell [Thu, 24 Oct 2019 21:59:11 +0000 (14:59 -0700)]
[cxx] externC for some icalls, for wasm and ios. (mono/mono#17444)

Maybe all JIT icalls?

Commit migrated from https://github.com/mono/mono/commit/4ef7c566af91722821031f11d704cae2061937e3

4 years agoInclude signal.h unconditionally. (mono/mono#17430)
Jay Krell [Thu, 24 Oct 2019 21:44:57 +0000 (14:44 -0700)]
Include signal.h unconditionally. (mono/mono#17430)

Some of the includes already were unconditional, including both on Win32 and Unix.
It is part of ANSI C 89, albeit in a reduced form compared to typical Unix (no sigaction).

Remove configuration of MSG_NOSIGNAL which has no other uses.

Preserve configuration of signal.h temporarily due to other uses of ifdef HAVE_SIGNAL_H.
 i.e. LLVM?

Commit migrated from https://github.com/mono/mono/commit/fc390a5f2493ae908ccf2696c4ca675d82104db6

4 years ago[cxx][x86] int/ptr casts. (mono/mono#17441)
Jay Krell [Thu, 24 Oct 2019 21:37:12 +0000 (14:37 -0700)]
[cxx][x86] int/ptr casts. (mono/mono#17441)

* [cxx][x86] Another int/ptr cast.

* More casts. Notice these are under
`#if defined (MONO_ARCH_USE_SIGACTION) && !defined (MONO_CROSS_COMPILE)`
which would explain them not showing up.

Commit migrated from https://github.com/mono/mono/commit/ec81a868a104ca0c465023ff5d9f90c0f131f725

4 years ago[master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx ...
dotnet-maestro[bot] [Thu, 24 Oct 2019 19:06:46 +0000 (21:06 +0200)]
[master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx (mono/mono#17458)

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

- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19518.2
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19518.2

* Update dependencies from https://github.com/dotnet/core-setup build 20191021.2

- Microsoft.NETCore.App - 5.0.0-alpha1.19521.2

* Update dependencies from https://github.com/dotnet/corefx build 20191020.7

- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19520.7

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

- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19523.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19523.3

* Update dependencies from https://github.com/dotnet/core-setup build 20191023.10

- Microsoft.NETCore.App - 5.0.0-alpha1.19523.10

* Update dependencies from https://github.com/dotnet/corefx build 20191023.8

- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19523.8

* Disable a file system watcher test on mac

See https://github.com/mono/mono/issues/17547

* Reenable tests that were fixed

Commit migrated from https://github.com/mono/mono/commit/a7287bdae54c0539a74fdbe87eb73ba268a95ed6

4 years ago[interp] fix code length for JitInfo (mono/mono#17538)
Bernhard Urban-Forster [Thu, 24 Oct 2019 18:13:27 +0000 (20:13 +0200)]
[interp] fix code length for JitInfo (mono/mono#17538)

* [interp] fix code length for JitInfo

* fix c++ build

Commit migrated from https://github.com/mono/mono/commit/25b53a642b4756332e5cdb932ed09521da3418df

4 years ago[netcore] Fix corerun build deps
Marek Safar [Thu, 24 Oct 2019 14:58:20 +0000 (10:58 -0400)]
[netcore] Fix corerun build deps

Commit migrated from https://github.com/mono/mono/commit/81a4a19f0a3282866cb6459da5f56ff67f26b940

4 years agoFix eglib on AIX/PASE (mono/mono#17476)
Calvin Buckley [Thu, 24 Oct 2019 16:04:20 +0000 (13:04 -0300)]
Fix eglib on AIX/PASE (mono/mono#17476)

* fix eglib on AIX/PASE

* Work around access(2) syscall bug on PASE
  On PASE, X_OK will always returns true. This is contrary to
  how AIX behaves (though corresponds to documentation!). This
  is probably because it's an upcall to the ILE version of
  access, and that seemingly always returns true.

* Always export the dummy function in the test suite
  The AIX linker didn't export this properly, without using the
  giant sledgehammer of -bexpall. Write an export file and use
  it. This required some build system changes to expose an
  AIX-only automake conditional.

* Use a file that exists on PASE for tests
  PASE doesn't use Unix-style DNS resolution, so /etc/hosts is
  missing. Use /etc/magic, since that seems to be present.

* Don't use /bin on AIX/PASE for tests
  This is a symlink to /usr/bin, and it seems chdir/getcwd
  follows links. Use /usr instead, that is unlikely to be a
  symlink.

* Make a note what directory we're in if we fail test_cwd

* Change manual executable access check change per Jay

* Change test on POSIXy platforms to always use root directory

Commit migrated from https://github.com/mono/mono/commit/638e2c6a8614d25aad591112d3414e28641b97e0

4 years ago[interp] Add super instructions for field storing (mono/mono#17525)
Vlad Brezae [Thu, 24 Oct 2019 15:05:04 +0000 (18:05 +0300)]
[interp] Add super instructions for field storing (mono/mono#17525)

* [interp] Add also floating versions for stloc.np

* [interp] Add super instructions for stfld

When storing into a field of a local or an argument (ldloc/ldarg -> random instructions that end up pushing one value -> stfld). We add this instruction to the cprop pass because the instructions that are optimized together are not consecutive and we need the stack information to be able to access the instruction that loaded the argument / local and to make sure that the local wasn't dirtied. Alternatively we could make the super instruction pass stack aware, which we should probably do if more super instruction candidates turn out to require stack state information.

* [interp] Enable cprop for methods without locals

We do some optimizations here that don't apply to locals.

* [interp] Fix result stack type of CEE_CONV_OVF_I_UN

Commit migrated from https://github.com/mono/mono/commit/b7ef7363382757c2951a7a84026d5a1baa7f0130

4 years ago[netcore] Add a few more missing SSE intrinsics. (mono/mono#17511)
Zoltan Varga [Thu, 24 Oct 2019 10:57:13 +0000 (06:57 -0400)]
[netcore] Add a few more missing SSE intrinsics. (mono/mono#17511)

* [netcore] Add a few more missing SSE intrinsics.

* Disable some intrinsics for non-llvm.

Commit migrated from https://github.com/mono/mono/commit/951769b2795df22904079d79d8d97d35c44466ba

4 years agoAdjust restart world logging level to match start major/nursery logging. (mono/mono...
Johan Lorensson [Thu, 24 Oct 2019 08:57:56 +0000 (10:57 +0200)]
Adjust restart world logging level to match start major/nursery logging. (mono/mono#17520)

With this change we will get the following logging on level 1:

2019-10-22 15:46:59 Start nursery collection 38898 00000205A0000000-00000205A1000000, size: 16777216
2019-10-22 15:46:59 restarted (pause time: 2728 usec, max: 689233 usec)

showing the pause time and when runtime was restared, before this fix
we will only see the start log message on level 1.

Commit migrated from https://github.com/mono/mono/commit/fe7654f745c9b8ba030c9c4c1671904c6d9bda53

4 years ago[netcore] Managed ThreadPool implementation (mono/mono#17387)
Filip Navara [Thu, 24 Oct 2019 08:56:25 +0000 (10:56 +0200)]
[netcore] Managed ThreadPool implementation (mono/mono#17387)

* Wire up the managed side of the portable thread pool

* Remove old native thread pool code

* Fix non-netcore build

* Fix Thread.IsThreadPoolThread

* Fix MSVC builds

* Code style fix

* Make the locking primitives uninterruptible

* Revert icall changes for non-netcore

* Implement Thread.ResetThreadPoolThread

* Compile out more thread pool code for netcore

* Remove ThreadPoolBoundHandle, it is shared now

* Address PR feedback on code style

Commit migrated from https://github.com/mono/mono/commit/7a15b718735eccfac6ecd7467a09279d2f23e16e

4 years ago[debugger] Changing how debugger handles exception when hybrid suspend is enabled...
Thays Grazia [Wed, 23 Oct 2019 20:56:58 +0000 (17:56 -0300)]
[debugger] Changing how debugger handles exception when hybrid suspend is enabled (mono/mono#17478)

* Removing all fixes to fix mono/mono#15203 and mono/mono#17083, and trying a new approach to fix this mono/mono#17084, together.

The thing is when we are executing on hybrid suspend the caller is executed inside try catch in the runtime_invoke_ method that is generated. And this try catch should be ignored for the debugger exception, otherwise it's the last try catch in main thread, but should always be considered to generate the stack trace.

Fixes mono/mono#17084

* This test check the case that we were missing. On preemptive this test always runs perfectly, on Hybrid, never run well until this PR.

* Changing how call unit test.
Changing variable name.

Commit migrated from https://github.com/mono/mono/commit/8fda1738f728dec900e7a53b78fefdbbbc9e0924

4 years ago[cxx] Put extern "C" in MONO_LLVM_INTERNAL. (mono/mono#17443)
Jay Krell [Wed, 23 Oct 2019 19:36:35 +0000 (12:36 -0700)]
[cxx] Put extern "C" in MONO_LLVM_INTERNAL. (mono/mono#17443)

Commit migrated from https://github.com/mono/mono/commit/4d7adf4d2a0c7c31d8081a4c01d2bb16b4029ea7

4 years agoOptimize LOS for better parallelization. (mono/mono#17173)
Johan Lorensson [Wed, 23 Oct 2019 18:58:04 +0000 (20:58 +0200)]
Optimize LOS for better parallelization. (mono/mono#17173)

Scanning LOS list as part of minor GC didn't parallelize well since
all scan jobs needed to walk the complete LOS list. This led to touching
a lot of memory walking the list, increasing minor GC pause times
when the number of items in the LOS list increased. As an example,
stressing LOS data structure using ~600 MB's of random sized byte arrays
caused minor GC pause times between ~20ms without parallelization and ~19ms
with parallelization. NOTE, the more work each job gets (more memory to scan)
we will get a better parallelization, but still a lot of room for improvement.

Changing from a normal linked list to a SgenArrayList makes it more effective
to parallelize the scan jobs and since the list is using sequential
memory, this will also reduce cache misses for each thread iterating LOS
objects. Tagging objects in SgenArrayList with reference information reduce
cache misses dramatically in cases where objects not including references
exists on the list, since scanning jobs can skip these items without any
need to touch object memory causing cache misses.

Same scenario running with fix gives us minor GC pause times, without
parallelization in ~7ms (down from 20~ms) and with parallelization,
< 5ms (down from 19ms). NOTE, the more work each job gets (more memory to scan)
we will get a better result using parallelization, so the delta will increase
between using and not using parallelization, this scenario primarily stress
the extreme case where most LOS objects doesn't have references.

In total, this optimization reduce minor GC pause time 4x, from ~19ms when
using parallelization down to < 5ms.

Commit migrated from https://github.com/mono/mono/commit/df30c7228c4061573601ea9a71772cc6f00e4b85

4 years ago[wasm] Avoid adding an extra arg to native-to-managed wrappers. (mono/mono#17508)
Zoltan Varga [Wed, 23 Oct 2019 15:06:18 +0000 (11:06 -0400)]
[wasm] Avoid adding an extra arg to native-to-managed wrappers. (mono/mono#17508)

[wasm] Avoid adding an extra arg to native-to-managed wrappers.

Fixes https://github.com/mono/mono/issues/17389.

<!--
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
-->

Commit migrated from https://github.com/mono/mono/commit/31b475e25a4ab5b6d8af731be9bb9e8158da31d9

4 years ago[coop] Fix big endian problem in MonoThradStateMachine and cleanup. (mono/mono#17502)
Jay Krell [Wed, 23 Oct 2019 14:21:54 +0000 (07:21 -0700)]
[coop] Fix big endian problem in MonoThradStateMachine and cleanup. (mono/mono#17502)

Commit migrated from https://github.com/mono/mono/commit/8b8b8b5010140b56bab3130e1b5b5e296dd86752

4 years ago[netcore] Add Unsafe.SkipInit intrinsic
Filip Navara [Wed, 23 Oct 2019 09:53:06 +0000 (11:53 +0200)]
[netcore] Add Unsafe.SkipInit intrinsic

Commit migrated from https://github.com/mono/mono/commit/e29f8e32b77e29ec314c0e509e1d1aef9d286285

4 years ago[interp] Add a new super instructions pass (mono/mono#17489)
Vlad Brezae [Wed, 23 Oct 2019 08:57:07 +0000 (11:57 +0300)]
[interp] Add a new super instructions pass (mono/mono#17489)

Together with a few very simple super instructions. We replace common instruction patterns to avoid indirection via interp stack, instruction dispatch overhead and to allow the compiler to generate better code for the instruction.

Commit migrated from https://github.com/mono/mono/commit/479d2dff365a688cc0045b3c76aa7aba79d4784e

4 years ago[interp] Retry cprop pass if killing stloc (mono/mono#17491)
Vlad Brezae [Wed, 23 Oct 2019 07:39:27 +0000 (10:39 +0300)]
[interp] Retry cprop pass if killing stloc (mono/mono#17491)

When replacing a stloc with a pop, we should retry the pass, since it is very likely that we will be able to kill the instruction that pushed that value on the stack.

Commit migrated from https://github.com/mono/mono/commit/4419dc919f01c6d97ecd1662929adc6e7e642e83

4 years agoSetLastError slightly later, in case last error not preserved, and it is just as...
Jay Krell [Wed, 23 Oct 2019 07:36:15 +0000 (00:36 -0700)]
SetLastError slightly later, in case last error not preserved, and it is just as good. (mono/mono#17483)

SetLastError slightly later, in case last error not preserved, and it is just as good.

Commit migrated from https://github.com/mono/mono/commit/92c08fab4d417d9c3e62dab7f1bac5a710f28916

4 years ago[interp] Optimize ldelem instructions (mono/mono#17494)
Vlad Brezae [Wed, 23 Oct 2019 07:23:49 +0000 (10:23 +0300)]
[interp] Optimize ldelem instructions (mono/mono#17494)

Remove the switch and have each instruction have its own code. Seems to improve speed on a benchmark that heavily uses ldelem by about 10-20%.

Commit migrated from https://github.com/mono/mono/commit/61594078466fd80a4f80a0c3d670adb8301144b0

4 years ago[netcore] Disable debugging code in lookup_intrins (mono/mono#17464)
Filip Navara [Wed, 23 Oct 2019 04:01:51 +0000 (06:01 +0200)]
[netcore] Disable debugging code in lookup_intrins (mono/mono#17464)

Commit migrated from https://github.com/mono/mono/commit/1e60703a191297440d25f1f3a103fb515163869b

4 years ago[reflection] mono_method_get_base_method on a GTD should use canonical ginst (mono...
Aleksey Kliger (λgeek) [Tue, 22 Oct 2019 18:07:44 +0000 (14:07 -0400)]
[reflection] mono_method_get_base_method on a GTD should use canonical ginst (mono/mono#17475)

* [test] GetCustomAttributes on generic type definition

* [reflection] mono_method_get_base_method on a GTD should use canonical ginst

The issue is in how we pass along the generic instantiation.  So there are two
parts here: we start with a method on a GTD which has to decompose into the GTD
and it's instantiation with its own generic parameters, and then we go up to
its parent and grandparent inflating and decomposing the resulting
instantiation. The instantiations keep passing the last parameter as the number
of parameters shrinks so that the gparam index from the original type is now
out of bounds for the parent and grandparent.  If we mess up, we'll get a
BadImageFormatException from the runtime

Fixes https://github.com/mono/mono/issues/17278

Commit migrated from https://github.com/mono/mono/commit/fb5b2c949ddd2ab09fcddb458584a5facd9ec94e

4 years ago[coop] Use bitfields for coop state machine state representation (mono/mono#17298)
Aleksey Kliger (λgeek) [Tue, 22 Oct 2019 16:14:05 +0000 (12:14 -0400)]
[coop] Use bitfields for coop state machine state representation (mono/mono#17298)

* [checked] Mask the thread state in GC thread state assertions

Because we have extra bits (like suspend count and the no_checkpoints bit) on
the thread state, we have to mask it to get the actual thread state enum value

* [coop] Use bitfields to represent coop thread state

Instead of using a 32-bit int, use bitfields and type-punning through a union
type.  We need to type pun because we need to access the entire state as a 32-bit int so that we can do atomic CAS.

* use atomic load of thread state in unwrap_thread_state.

Saw one stack trace on CI on the full coop lane where check_thread_state saw STATE_RUNNING
but with a positive suspend count.  Another thread was starting a GC a
the time.  Seems like we saw the state as runnning, but the suspend
count as if we were already in async_suspend_requested.

Thread 22 (Thread 0x7f43c03ff700 (LWP 39860)):

Commit migrated from https://github.com/mono/mono/commit/ebb5846e0d743a12a359f4b1dbcea9d18ccfe867

4 years ago[System.Private.CoreLib] Remove unused methods
Marek Safar [Tue, 22 Oct 2019 13:49:26 +0000 (09:49 -0400)]
[System.Private.CoreLib] Remove unused methods

Commit migrated from https://github.com/mono/mono/commit/f34fd20fbf009c9ef174c1fabdbccda47c93b9da

4 years agoUpdate Mono for changes in shared CoreLib partition
Filip Navara [Tue, 22 Oct 2019 09:54:15 +0000 (11:54 +0200)]
Update Mono for changes in shared CoreLib partition

Commit migrated from https://github.com/mono/mono/commit/cf1a9e003371495f4fff86c690da0213fff29c85

4 years ago[jit] Avoid running mono_handle_native_crash () on the altstack, it can't produce...
Zoltan Varga [Tue, 22 Oct 2019 10:31:23 +0000 (06:31 -0400)]
[jit] Avoid running mono_handle_native_crash () on the altstack, it can't produce a backtrace. AMD64 only for now. (mono/mono#17466)

* [jit] Avoid running mono_handle_native_crash () on the altstack, it can't produce a backtrace. AMD64 only for now.

* Fix checks so stack overflows work again.

Commit migrated from https://github.com/mono/mono/commit/b96260e603fe0188e54019bfde8ca00bc2b5d78c

4 years ago[interp] Replace loading of static readonly fields with LDC (mono/mono#17420)
Vlad Brezae [Mon, 21 Oct 2019 20:42:24 +0000 (23:42 +0300)]
[interp] Replace loading of static readonly fields with LDC (mono/mono#17420)

LDC is faster and also allows for constant propagation. Cleanup code a little bit.

Commit migrated from https://github.com/mono/mono/commit/c1461e4a2d9c539506b88af786c948ff8a8bad7d

4 years agoNo type_traits on Android.
Jay Krell [Fri, 18 Oct 2019 01:17:24 +0000 (18:17 -0700)]
No type_traits on Android.

In file included from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android/mono/metadata/icall.c:42:
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android/mono/metadata/icall-internals.h:89:10: fatal error: 'type_traits' file not found

Commit migrated from https://github.com/mono/mono/commit/fd82c6036ec3720d568050c1e538f9729cef984e

4 years ago[cxx][debug-interp] Cast once from void* to non-void*.
Jay Krell [Sat, 19 Oct 2019 01:35:42 +0000 (18:35 -0700)]
[cxx][debug-interp] Cast once from void* to non-void*.

Commit migrated from https://github.com/mono/mono/commit/21d7d41bfe4a8aebed8e73deadd1fb1177360392

4 years ago[Coop] Unconvert Microsoft.Win32.NativeMethods. (mono/mono#16992)
Jay Krell [Mon, 21 Oct 2019 08:29:39 +0000 (01:29 -0700)]
[Coop] Unconvert Microsoft.Win32.NativeMethods. (mono/mono#16992)

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_CloseProcess.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess.

* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle.

Commit migrated from https://github.com/mono/mono/commit/9f50bdb2d944793d30ea2d052cdad96feb282003

4 years ago[interp] Small fixes. (mono/mono#17442)
Zoltan Varga [Mon, 21 Oct 2019 03:28:25 +0000 (23:28 -0400)]
[interp] Small fixes. (mono/mono#17442)

* [interp] Really abort in ves_real_abort ().

* [interp] Fix stack usage in TRACE_EXIT.

* [interp] Add a callback to free ThreadContext.

* Fix warnings.

* Remove an empty statement.

* Fix a double free.

Commit migrated from https://github.com/mono/mono/commit/4b9226619c9caef3d45778380198c70a43e3570c

4 years ago[netcore] Implement Array.GetElementSize as intrinsic (mono/mono#17437)
Filip Navara [Sun, 20 Oct 2019 22:39:39 +0000 (00:39 +0200)]
[netcore] Implement Array.GetElementSize as intrinsic (mono/mono#17437)

* [netcore] Implement Array.GetElementSize as intrinsic

* Remove unnecessary icall

* alloc_preg -> alloc_ireg

* Implement Array.GetElementSize as intrinsic in interpreter

* Address PR feedback

Commit migrated from https://github.com/mono/mono/commit/32ab6bcf004dee2009ab98f9381842ff3fc6e6f2

4 years ago[netcore] Remove unused code for Array.Unsafe[Mov/Load/Store] intrinsics
Filip Navara [Sat, 19 Oct 2019 09:58:49 +0000 (11:58 +0200)]
[netcore] Remove unused code for Array.Unsafe[Mov/Load/Store] intrinsics

Commit migrated from https://github.com/mono/mono/commit/67c8d0d812d5045ca084d24ad271233685a6c899

4 years agoUse correct variable in mini_get_cpu_features (mono/mono#17436)
Filip Navara [Sun, 20 Oct 2019 05:26:44 +0000 (07:26 +0200)]
Use correct variable in mini_get_cpu_features (mono/mono#17436)

* Use correct variable in mini_get_cpu_features

* Address PR feedback

Commit migrated from https://github.com/mono/mono/commit/bc678a2c10b98d8624bc55da1e4409be13a265f4

4 years agoRemove dead code left out in mono/mono#17341 (mono/mono#17433)
Filip Navara [Sun, 20 Oct 2019 05:23:05 +0000 (07:23 +0200)]
Remove dead code left out in mono/mono#17341 (mono/mono#17433)

Commit migrated from https://github.com/mono/mono/commit/91f10aeee4ff70696f19fdda9f3d6b67403bc45d

4 years ago[jit][x86][cxx] int/ptr casts in mini-x86.c (mono/mono#17380)
Jay Krell [Sat, 19 Oct 2019 17:20:56 +0000 (10:20 -0700)]
[jit][x86][cxx] int/ptr casts in mini-x86.c (mono/mono#17380)

Commit migrated from https://github.com/mono/mono/commit/91413f78f3242aab3d38d0fb609dd748999265fc

4 years agoReplace ICALL_DECL_EXPORT with ICALL_EXPORT. They are always the same, and it is...
Jay Krell [Sat, 19 Oct 2019 11:25:54 +0000 (04:25 -0700)]
Replace ICALL_DECL_EXPORT with ICALL_EXPORT. They are always the same, and it is only used once. (mono/mono#17429)

Replace ICALL_DECL_EXPORT with ICALL_EXPORT. They are always the same and it is only used once.

Commit migrated from https://github.com/mono/mono/commit/84f4e1dcbf96925105f4d4f54bb9cb9b61067603

4 years ago[bcl] Add null reference checks to Interlocked.Exchange<T> (mono/mono#17400)
Aleksey Kliger (λgeek) [Fri, 18 Oct 2019 23:11:22 +0000 (19:11 -0400)]
[bcl] Add null reference checks to Interlocked.Exchange<T> (mono/mono#17400)

* [bcl] Add null reference checks to Interlocked.Exchange<T>

and Interlocked.CompareExchange<T>

This is to mimic the old behavior in unmanaged when the intrinsic cannot be
used.

The issue was detected via the coreclr acceptance test:
https://github.com/mono/coreclr/blob/mono/tests/src/baseservices/threading/interlocked/exchange/exchangetneg.il

* and netcore

Commit migrated from https://github.com/mono/mono/commit/d8ae32a9ee7763c861bdc31831271d82aa8a4953

4 years ago[cxx] [wasm] int/ptr casts esp. m2n-gen. (mono/mono#17379)
Jay Krell [Fri, 18 Oct 2019 22:03:00 +0000 (15:03 -0700)]
[cxx] [wasm] int/ptr casts esp. m2n-gen. (mono/mono#17379)

Commit migrated from https://github.com/mono/mono/commit/a2992d634b9cfa6ae8572ba597f009cb05104743

4 years agoMerge pull request mono/mono#17279 from imhameed/bug-gh-16935-netcore-equalsall-codegen
imhameed [Fri, 18 Oct 2019 19:47:41 +0000 (12:47 -0700)]
Merge pull request mono/mono#17279 from imhameed/bug-gh-16935-netcore-equalsall-codegen

Generate LLVM IR for OP_XEQUAL that is recognized by LLVM's vector pattern recognizers.

Commit migrated from https://github.com/mono/mono/commit/8836231459121e0144ae03169554c1d0636ec5ba

4 years agoSome updates to make RISC-V buildable again. (mono/mono#17408)
Alex Rønne Petersen [Fri, 18 Oct 2019 18:16:14 +0000 (20:16 +0200)]
Some updates to make RISC-V buildable again. (mono/mono#17408)

Some updates to make RISC-V buildable again.

Also some updates to the toolchain setup documentation.

Commit migrated from https://github.com/mono/mono/commit/d44e0e80d73d59de204b5db881e3d8c6076b4cac

4 years ago[profiler] Fix coverage profiler on macos (mono/mono#17396)
Vlad Brezae [Fri, 18 Oct 2019 14:31:47 +0000 (17:31 +0300)]
[profiler] Fix coverage profiler on macos (mono/mono#17396)

If we have coverage profiling enabled for a method (mono_profiler_coverage_instrumentation_enabled, with coverage_filter callback), then we should be able to allocate a coverage info structure (mono_profiler_coverage_alloc). After https://github.com/mono/mono/commit/mono/mono@52429673dc617fd437518757c04c7448211075e9, coverage_filter was reporting wrapper methods as ok to profile, while mono_profiler_coverage_alloc was refusing to allocate the necessary structure, leading to crashes.

Commit migrated from https://github.com/mono/mono/commit/37f628750af0f81e7550989e83bcfe3d134fb6be

4 years ago[interp][wasm] Remove more varargs to conserve stack. (mono/mono#17388)
Jay Krell [Fri, 18 Oct 2019 07:39:05 +0000 (00:39 -0700)]
[interp][wasm] Remove more varargs to conserve stack. (mono/mono#17388)

Commit migrated from https://github.com/mono/mono/commit/958b9b2658f6d866ba451781cfa2180e2b340f35

4 years agoEnable GSS on Linux and Android (mono/mono#17223)
Egor Bogatov [Thu, 17 Oct 2019 23:01:44 +0000 (02:01 +0300)]
Enable GSS on Linux and Android (mono/mono#17223)

Commit migrated from https://github.com/mono/mono/commit/4908d1f19a615b033ec148b49c8fab83f1e6f0ec

4 years ago[interp] Constant folding for integers (mono/mono#17362)
Vlad Brezae [Thu, 17 Oct 2019 11:23:12 +0000 (14:23 +0300)]
[interp] Constant folding for integers (mono/mono#17362)

* [interp] Move instructions together

For easy check if an instruction is unary or binary operation. We consider conversion instructions to be unary operators and compare instructions to be binary operators.

* [interp] Add stloc.np also for longs

* [interp] Add stats for total number of emitted instructions

Also make the killed_instructions counter actually track the total amount of killed instructions. It was not previously tracking instructions killed as part of addition of stloc.np / movloc.

* [interp] Improve logging during cprop

Make dumping instruction support also InterpInst's not just compacted instructions.

* [interp] Constant folding of common unary operators

* [interp] Constant fold binary operations

* [interp] Remove MINT_CONV_U8_I4 opcode

It is equivalent with MINT_CONV_I8_U4.

Commit migrated from https://github.com/mono/mono/commit/ec653e70bfaba99e9fd88ceb3ff475eda83cb8f1

4 years ago[cxx] Int vs. enum, static for efficiency, cleanup, fix typo. (mono/mono#17377)
Jay Krell [Thu, 17 Oct 2019 10:25:18 +0000 (03:25 -0700)]
[cxx] Int vs. enum, static for efficiency, cleanup, fix typo. (mono/mono#17377)

[cxx] Int vs. enum, static for efficiency, cleanup, fix typo.

Commit migrated from https://github.com/mono/mono/commit/e8b6fcc9451eded4ba370649bcb41fad405f0b2a

4 years ago[cxx][x86] int/ptr casts. (mono/mono#17345)
Jay Krell [Thu, 17 Oct 2019 10:24:46 +0000 (03:24 -0700)]
[cxx][x86] int/ptr casts. (mono/mono#17345)

Commit migrated from https://github.com/mono/mono/commit/e97e1f994d0310b4f988fad343793019cf5e273d

4 years ago[interp] Always intrinsify MemoryBarrier method
Vlad Brezae [Wed, 16 Oct 2019 20:13:10 +0000 (23:13 +0300)]
[interp] Always intrinsify MemoryBarrier method

As we do it on jit.

Commit migrated from https://github.com/mono/mono/commit/ae0fbd366e3125d8da99663a492f6116de4214b9

4 years ago[interp] Avoid using full barriers for volatile operations
Vlad Brezae [Wed, 16 Oct 2019 20:01:54 +0000 (23:01 +0300)]
[interp] Avoid using full barriers for volatile operations

This commit avoid unnecessary memory barriers on x86 and amd64.

Volatile writes have release semantics, volatile reads have acquire semantics. Organize the code a little bit to indicate this. On x86 and amd64 we don't require barrier for acquire and release semantics since they are provided by the arch, so we can skip them. Ideally we should have 3 memory barrier interp instructions for each type, but, currently, they would all seem to call mono_memory_barrier so it is useless at this point.

Commit migrated from https://github.com/mono/mono/commit/0102263645b73422d84dbe7fac3bdee65c7447a7

4 years agoUpgrade build scripts to support VS2019. (mono/mono#17269)
Johan Lorensson [Thu, 17 Oct 2019 06:55:50 +0000 (08:55 +0200)]
Upgrade build scripts to support VS2019. (mono/mono#17269)

Changes will default Windows SDK version as well as Platform Toolset to
the default versions used in the targeted VS version. If the projects are
opened up in VS2015, it should default to Windows SDK 8.1 and v140, but if
the same projects are opened in VS2019, it will default to latest Windows SDK 10
and v142. This way the project files should adapt to used VS version, meaning
that we could still build them using VS2015 (what's currently used on CI) but also
using VS2017 and VS2019. There should not be a need to install any previous versions
of build tools, unless an older version is targeted. It is also possible to set
PlatformToolset when calling msbuild and that should adapt to corresponding default
Windows SDK version for targeted toolset version.

Commit makes many changes and adjustments, aligning all vcxproj files but changes
should not affect build output.

Commit migrated from https://github.com/mono/mono/commit/4f8a82c9fdebd7e9dcc5392a8b3a0fd129789bc0

4 years agoUse functions instead of macros for is_in/is_out. (mono/mono#17350)
Jay Krell [Thu, 17 Oct 2019 04:46:03 +0000 (21:46 -0700)]
Use functions instead of macros for is_in/is_out. (mono/mono#17350)

Use functions instead of macros for is_in/is_out.

Commit migrated from https://github.com/mono/mono/commit/edafa021d3b8e5b5762a297afa38ae58c21997b1

4 years ago[master] Update dependencies from dotnet/core-setup dotnet/corefx (mono/mono#17355)
dotnet-maestro[bot] [Wed, 16 Oct 2019 21:12:15 +0000 (23:12 +0200)]
[master] Update dependencies from dotnet/core-setup dotnet/corefx (mono/mono#17355)

* Update dependencies from https://github.com/dotnet/core-setup build 20191015.17

- Microsoft.NETCore.App - 5.0.0-alpha1.19515.17

* Update dependencies from https://github.com/dotnet/corefx build 20191015.14

- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19515.14

* Reenable a test that was fixed

Commit migrated from https://github.com/mono/mono/commit/1dbad7cd881f1051fe21e72911bd4ce0228cb954

4 years ago[cxx][x86][amd64] Remove unused STORE_MEM_IMM. (mono/mono#17347)
Jay Krell [Wed, 16 Oct 2019 20:26:02 +0000 (13:26 -0700)]
[cxx][x86][amd64] Remove unused STORE_MEM_IMM. (mono/mono#17347)

[cxx][x86][amd64] Remove unused STORE_MEM_IMM.

And there was an int/ptr cast error within.

Commit migrated from https://github.com/mono/mono/commit/c0d50719eab15fbf7fe8259fd3df065af7eb91f3

4 years ago[bcl][jit] implement Interlocked.Exchange<T> in terms of object (mono/mono#17341)
Aleksey Kliger (λgeek) [Wed, 16 Oct 2019 19:35:49 +0000 (15:35 -0400)]
[bcl][jit] implement Interlocked.Exchange<T> in terms of object (mono/mono#17341)

* [bcl][jit] implement Interlocked.Exchange<T> in terms of object

Exchange<T> is supposed to be picked up as an intrinsic.  But if it isn't,
since T has a class constraint, call the `Exchange (ref object, ref object, ref
object)` overload instead.

This works around a limitation in the JIT:
https://github.com/mono/mono/blob/mono/mono@82a07273c22b996b08fa88ee2e6632d782ac2242/mono/mini/mini-trampolines.c#L704-L713

if we're in the common call trampoline, and the caller is generic method and
the callee is a generic method, if we're using generic sharing for the caller,
but there's no generic jit info for the callee, we will not patch the call
site.

In this case we had Exchange<T> calling Exchange_T<T>
where the callee is an icall (and evidently didn't have generic jit info).

So every time we called Exchange<T>, we would go through the trampoline when
trying to call Exchange_T<T> without patching the call site.

Addresses part of https://github.com/mono/mono/issues/17334

* Bump Mono

* Also drop CompareExchange_T<T>

* Sprinkle some Unsafe magic.

Mark the non-icall methods that we expect the JIT to treet as intrinsics with [Intrinsic]

* aot-runtime doesn't need Volatile.Read<T>/Write<T> code

Both of those methods are implemented as calls to the object overload of Volatile.Read/Write

Commit migrated from https://github.com/mono/mono/commit/f017835ac11371038aec3ea66c513c8234d73187

4 years agoremove GenericVectorTests from rsp (mono/mono#17366)
Egor Bogatov [Wed, 16 Oct 2019 19:24:16 +0000 (22:24 +0300)]
remove GenericVectorTests from rsp (mono/mono#17366)

Commit migrated from https://github.com/mono/mono/commit/58b53299b76c7f788a18116676ea8aa9c00a0b9c

4 years ago[cxx][netcore] Goto around init. (mono/mono#17348)
Jay Krell [Wed, 16 Oct 2019 18:56:09 +0000 (11:56 -0700)]
[cxx][netcore] Goto around init. (mono/mono#17348)

[cxx][netcore] Goto around init.

Commit migrated from https://github.com/mono/mono/commit/de9ccfa63fc373d20759275c5eb5f3706869def3

4 years ago[cxx][x86] ifndef DISABLE_JIT around mono_arch_emit_prolog. (mono/mono#17346)
Jay Krell [Wed, 16 Oct 2019 18:28:24 +0000 (11:28 -0700)]
[cxx][x86] ifndef DISABLE_JIT around mono_arch_emit_prolog. (mono/mono#17346)

Commit migrated from https://github.com/mono/mono/commit/70675241410f886b096ee79decaf6c3da047640a

4 years agofix netcore build with cygwin (mono/mono#17361)
Egor Bogatov [Wed, 16 Oct 2019 18:20:48 +0000 (21:20 +0300)]
fix netcore build with cygwin (mono/mono#17361)

Commit migrated from https://github.com/mono/mono/commit/c13f36bdfe4558277b92fba714385d0ee377bf0b

4 years ago[netcore] Implement System.IO.HasOverriddenBeginEndRead(Write)… (mono/mono#17237)
Egor Bogatov [Wed, 16 Oct 2019 18:16:51 +0000 (21:16 +0300)]
[netcore] Implement System.IO.HasOverriddenBeginEndRead(Write)… (mono/mono#17237)

* Implement HasOverriddenBeginEndRead and HasOverriddenBeginEndWrite

* fix typo

* clean up

* more clean up

* more clean up

* convert into intrinsics

* handle end* methods

* Update intrinsics.c

* make cache_System_IO_Stream_slots static

* fix race condition

* Rollback to icall

* Update icall.c

* Address feedback

* Address feedback

Commit migrated from https://github.com/mono/mono/commit/886cd73784befd68b45c4fa3fa4f6864fe366139

4 years ago[ci] Improve netcore build telemetry by running nupkg and tests through build.sh...
Alexander Köplinger [Wed, 16 Oct 2019 16:52:13 +0000 (18:52 +0200)]
[ci] Improve netcore build telemetry by running nupkg and tests through build.sh (mono/mono#17349)

Follow-up to https://github.com/mono/mono/pull/17331.

We were running nuget pack and tests explicitly in the Azure Pipelines
config so we weren't capturing failure telemetry.

Commit migrated from https://github.com/mono/mono/commit/cd6e574b87b4746afa980165a52e0eb0a95be58e

4 years agoReplace mono_assembly_name_free use with mono_assembly_name_free_internal. (mono...
Jay Krell [Wed, 16 Oct 2019 12:25:55 +0000 (05:25 -0700)]
Replace mono_assembly_name_free use with mono_assembly_name_free_internal. (mono/mono#16982)

Replace mono_assembly_name_free use with mono_assembly_name_free_internal.

Maybe just remove the GC mode change and remove the internal form.
We don't really equate malloc/free with GC/locks/hangs, though arguably we should. Arguably this change is right.

Commit migrated from https://github.com/mono/mono/commit/a03027cab08e9b2caddef8cdd8b62b8d2d6430c8

4 years ago[interp] Add constant propagation of integers (mono/mono#17326)
Vlad Brezae [Wed, 16 Oct 2019 10:56:14 +0000 (13:56 +0300)]
[interp] Add constant propagation of integers (mono/mono#17326)

* [interp] Make StackValue more intuitive

Replace the opcode field with an enum which will represent what type of value is contained (STACK_VALUE_LOCAL, STACK_VALUE_I4 etc)

* [interp] Add the mint type to the local data

Makes the emitting code easier and we no longer compute the mint type for each local access, which is fairly expensive.

* [interp] Handle indirect locals saner during cprop

Instead of checking for the indirect flag when loading from a local, simply never store a StackValue into such a local since we can't use it. We use the same logic when not pushing on the stack values for such locals.

* [interp] Add constant folding for integers

We decode the values from LDC_I4 and LDC_I8 opcodes and track/propagate the values on the stack and in the locals using the existing infrastructure. When loading a local, we try to load using the known constant value instead, so we might get to kill that local.

* [interp] Similar to stloc.np we can optimize pop/push pairs

If the pushing instruction pushes the same value that was popped by the previous instruction, we can kill them both

* [tests] Remove issue that seems to have been fixed for a while

Commit migrated from https://github.com/mono/mono/commit/0aabccef9bf6f17313fa384349a8089e8d8b0642