platform/upstream/dotnet/runtime.git
4 years ago[loader] Move PInvoke and DllMap code into separate source file
Ryan Lucia [Tue, 8 Oct 2019 22:02:05 +0000 (18:02 -0400)]
[loader] Move PInvoke and DllMap code into separate source file

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

4 years ago[netcore] Remove unused InternalLoadUnmanagedDllFromPath
Ryan Lucia [Wed, 9 Oct 2019 17:37:35 +0000 (13:37 -0400)]
[netcore] Remove unused InternalLoadUnmanagedDllFromPath

As of https://github.com/dotnet/coreclr/pull/27090

Commit migrated from https://github.com/mono/mono/commit/80db55591af3bc85f3f2d0735c316b9b08350a79

4 years ago[netcore] Use a single NativeLibrary.cs for all platforms
Ryan Lucia [Tue, 8 Oct 2019 20:10:03 +0000 (16:10 -0400)]
[netcore] Use a single NativeLibrary.cs for all platforms

Commit migrated from https://github.com/mono/mono/commit/96050effa6e0461b986ac33ab15940b3a9d93353

4 years agoMirror changes from mono/coreclr (mono/mono#17297)
Dotnet-GitSync-Bot [Sat, 12 Oct 2019 06:50:00 +0000 (23:50 -0700)]
Mirror changes from mono/coreclr (mono/mono#17297)

* Enable fast-paths on Mono for Array (dotnet/coreclrmono/mono#27144)

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* [CoreLib] Remove String fields moved to shared

* Stub Array Try* methods

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

4 years ago[loader] Fix gnu/lib-names.h define (mono/mono#17294)
Ryan Lucia [Sat, 12 Oct 2019 00:49:24 +0000 (20:49 -0400)]
[loader] Fix gnu/lib-names.h define (mono/mono#17294)

Commit migrated from https://github.com/mono/mono/commit/9832bbb0ac059418c5edeb6388678be89e44f560

4 years ago[runtime] Add portable cached array creation functions and replace gcc-specific impl...
Jay Krell [Fri, 11 Oct 2019 23:47:20 +0000 (16:47 -0700)]
[runtime] Add portable cached array creation functions and replace gcc-specific impl. (mono/mono#16855)

* Remove unused mono_class_get_field_from_name_cached.

* Replace gcc-specific:
  mono_array_class_get_cached
  mono_array_new_cached
  mono_array_new_cached_handle

with portable forms that are easy enough to use and general enough.

Before was "easier" because cache provided for you -- possibly multiple.
Before was more general because rank was a parameter -- and had to be a constant.
It was always 1.

Commit migrated from https://github.com/mono/mono/commit/33d62537d4f7ceeabd8439b26724450a88981d58

4 years agoEnable more hw intrinsics for AOT (mono/mono#17160)
Egor Bogatov [Fri, 11 Oct 2019 19:09:08 +0000 (22:09 +0300)]
Enable more hw intrinsics for AOT (mono/mono#17160)

* Enable more hw intrinsics for AOT

* Address feedback

* does it fix the failure?

* fix loadedllvm

* Address feedback

* fix copy-paste

* forgot MONO_LLVM_INTERNAL

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

4 years agoUpdate MERP event type to MonoAppCrash (mono/mono#17131)
Kyle White [Fri, 11 Oct 2019 15:15:21 +0000 (11:15 -0400)]
Update MERP event type to MonoAppCrash (mono/mono#17131)

* Update parameters in MERP WerReportMetadata xml

To enable backend analysis, we need to update our parameters to match our back end event type, which is MonoAppCrash.

It doesn't make sense to me that the previous implementation constructed the XML here in Mono, but depended on the user (VSMac in this case) to add the "correct" event type.  The parameters in the XML, must match exactly what is expected for the given EventType, and so we should ensure they are always in-sync by defining them here.  Thus, I removed the usage of `eventType` in `mono_merp_enable` and hard coded the expected eventType.

* [merp] Don't pass eventType from managed

The eventType must me MONO_MERP_EVENT_TYPE_STR ("MonoAppCrash") - the backend
determines the format of the other fields based on the event type, so it
doesn't make sense to pass other values from managed since the runtime controls
the other fields.

For compatability Mono.Runtime.EnableMicrosoftTelemetry will still take a
string parameter (now called "unused" instead of "eventType_str") but it will
not pass it down to the internal call.

* Bump corlib version

* [merp] Revert paramerters in WerReportMetadata.xml

Still need event type to be `MonoAppCrash` but the parameters will be the same as before.

Commit migrated from https://github.com/mono/mono/commit/481b3005c63daa38d163e46ef5bb43288b1403b7

4 years ago[interp] Kill more instructions (mono/mono#17226)
Vlad Brezae [Thu, 10 Oct 2019 19:29:19 +0000 (22:29 +0300)]
[interp] Kill more instructions (mono/mono#17226)

* [interp] Replace STLOC to dead local with MINT_POP

* [interp] Optimize MINT_POP

It was only used for 0 and 1 values. The implementation for values larger than 1 was broken anyway.

* [interp] Remove unnecessary usage of MINT_POP1

When storing a static field from a CEE_STFLD instruction.

* [interp] Prevent optimizing away the stack, after a branch

We know the contents of the stack following a branch, so we could have optimized away some instructions preceding the branch. We shouldn't do this because the code we are branching to expects a certain stack size.

* [interp] Clear instructions which push unused values on stack

* [interp] Properly initialize stack when pushing local

Commit migrated from https://github.com/mono/mono/commit/165c114aaa68a52c5aa10ae1df93816f71061840

4 years ago[eglib] Add newline for failure check prints (mono/mono#17262)
Ryan Lucia [Thu, 10 Oct 2019 13:23:16 +0000 (09:23 -0400)]
[eglib] Add newline for failure check prints (mono/mono#17262)

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

4 years agoIncorrect constrained virtual call in method using gsharedvt for reference type....
Johan Lorensson [Thu, 10 Oct 2019 13:22:54 +0000 (15:22 +0200)]
Incorrect constrained virtual call in method using gsharedvt for reference type. (mono/mono#17227)

* Incorrect constrained virtual call in method using gsharedvt for reference type.

For generic constrained virtual calls using reference type's, the
virtual call will be dispatched using instance vtable. When the same
virtual call is taking place in a gsharedvt method, mono_gsharedvt_constrained_call
gets called that will assist making the call, the problem is that it will
use the constrained class for reference types meaning that it will not call
the most derived implementation of the method. This difference in the behavior
compared to none gsharedvt versions of methods, gives inconsistent results.

One way this will reproduce is by using Dictionary<Type, EmptyStruct>. For
methods that will take both Type (reference type) and EmptyStruct (value type)
like Add, calling that through IDictionary (hiding details from compiler) will
use the gsharedvt version of the method. Internally that method will call
Type.GetHashCode (), and since Type really is a RuntimeType it overrides
GetHashCode. But since mono_gsharedvt_constrained_call will use the constrained
class instead of the instance class, the called method will be
Object.GetHashCode, that gives a different result. When later ContainsKey
is called using the same Type, it only takes a reference value, so not
using a gsharedvt version of the method, then the most derived version of
GetHashCode will be called, given a different hash, not finding item
in dictionary.

Fix is to make sure behavior in mono_gsharedvt_constrained_call match
behavior for regular constrained virtual calls when having a reference type.
This makes sure we always call the most derived version of the method.

Commit also adds a test for this specific scenario using a dictionary.

* Updated to a more low-level test.

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

4 years ago[mini] trace snippet should restore return value (mono/mono#17251)
Bernhard Urban-Forster [Thu, 10 Oct 2019 09:21:23 +0000 (11:21 +0200)]
[mini] trace snippet should restore return value (mono/mono#17251)

* [mini] trace snippet should restore return value

This is a problem on architectures with a floating point stack (x86).

Without this PR and without `--trace` the managed-to-native wrapper for `Math.Ceiling` has a basic block like this at the end:

```
AFTER LOWER-VTYPE-OPTS  4: [IN:  BB6(5) BB3(1), OUT:  BB1(3) ]
 fmove R34 <- R16
 ldaddr R35 <- R10
 load_membase R37 <- [R35 + 0x0]
 store_membase_reg [R36] <- R37
 il_seq_point il: 0x2d
```

`R16` contains the return value. `ldaddr`/`load_membase`/`store_membase_reg` is the sequence for LMF popping.  `mono_spill_global_vars` does this with it:

```
 SPILL BLOCK 4:
 fmove R34 <- R16
         ff  34 16
        0  loadr8_membase R34 <- [%ebp + 0xffffffd4]
        1  nop
 ldaddr R35 <- R10
         ii  35 5
        1  add_imm R35 <- %ebp [-36] clobbers: 1
 load_membase R37 <- [R35 + 0x0]
         ii  37 35
        1  load_membase R37 <- [R35 + 0x0]
 store_membase_reg [R36] <- R37
          ii -1 37
        1  store_membase_reg [%edi] <- R37
 il_seq_point il: 0x2d
             -1
        1  il_seq_point il: 0x2d
```

The local register allocator takes care of the FP stack handling:

```
processing:     0  loadr8_membase %fr0 <- [%ebp + 0xffffffd4]
        [%fr0]
processing:     0  load_membase %eax <- [%ebp + 0xffffffdc]
        [%fr0]
processing:     0  store_membase_reg [%edi] <- %eax
        [%fr0]
processing:     0  il_seq_point il: 0x2d
        [%fr0]
```

At the end of the basic block we have one value left on the FP stack. That's good as we are in the `cfg->bb_exit` basic block, so this is ought to be the return value.

Let's enable `--trace=M:System.Math:Ceiling`. It will insert some code in order to copy arguments/return value to some datastructure that can then be printed by the trace code:

```
processing:     0  loadr8_membase %fr0 <- [%ebp + 0xffffffd4]
        [%fr0]
processing:     0  iconst %eax <- [11116832]
        [%fr0]
processing:     0  iconst %eax <- [52]
        [%fr0]
processing:     0  localloc_imm %eax <-
        [%fr0]
processing:     0  localloc_imm %ecx <-
        [%fr0]
processing:     0  store_membase_reg [%eax + 0x30] <- %ecx
        [%fr0]
processing:     0  x86_lea_membase %edx <- %ebp
        [%fr0]
processing:     0  store_membase_reg [%ecx] <- %edx
        [%fr0]
processing:     0  store_membase_imm [%eax + 0x28] <- [11116832]
        [%fr0]
processing:     0  storer8_membase_reg [%ebp + 0xffffffcc] <- %fr0
        []
processing:     0  x86_lea_membase %ecx <- %ebp
        []
processing:     0  store_membase_reg [%eax + 0x2c] <- %ecx
        []
processing:     0  store_membase_reg [%esp + 0x4] <- %eax
        []
processing:     0  store_membase_imm [%esp] <- [11116832]
        []
processing:     0  voidcall [mono_trace_leave_method] clobbers: c
        []
processing:     0  x86_lea_membase %eax <- %ebp
        []
processing:     0  load_membase %eax <- [%ebp + 0xffffffdc]
        []
processing:     0  store_membase_reg [%edi] <- %eax
        []
processing:     0  il_seq_point il: 0x2d
        []
```

At the very beginning we push some value on the FP stack, same as before. However the code inserted by the tracing code will pop that value. Now, when returning to the, it will pop again something from the FP stack, but alas it's gonna be garbage.

With this PR it looks like this:

```
processing:     0  loadr8_membase %fr0 <- [%ebp + 0xffffffd4]
        [%fr0]
processing:     0  iconst %eax <- [11116832]
        [%fr0]
processing:     0  iconst %eax <- [52]
        [%fr0]
processing:     0  localloc_imm %eax <-
        [%fr0]
processing:     0  localloc_imm %ecx <-
        [%fr0]
processing:     0  store_membase_reg [%eax + 0x30] <- %ecx
        [%fr0]
processing:     0  x86_lea_membase %edx <- %ebp
        [%fr0]
processing:     0  store_membase_reg [%ecx] <- %edx
        [%fr0]
processing:     0  store_membase_imm [%eax + 0x28] <- [11116832]
        [%fr0]
processing:     0  storer8_membase_reg [%ebp + 0xffffffcc] <- %fr0
        []
processing:     0  x86_lea_membase %ecx <- %ebp
        []
processing:     0  store_membase_reg [%eax + 0x2c] <- %ecx
        []
processing:     0  loadr8_membase %fr0 <- [%ebp + 0xffffffcc]
        [%fr0]
processing:     0  store_membase_reg [%esp + 0x4] <- %eax
        [%fr0]
processing:     0  store_membase_imm [%esp] <- [11116832]
        [%fr0]
processing:     0  voidcall [mono_trace_leave_method] clobbers: c
        [%fr0]
processing:     0  x86_lea_membase %eax <- %ebp
        [%fr0]
processing:     0  load_membase %eax <- [%ebp + 0xffffffdc]
        [%fr0]
processing:     0  store_membase_reg [%edi] <- %eax
        [%fr0]
processing:     0  il_seq_point il: 0x2d
        [%fr0]
```

Leaving us the return value on the FP stack before returning.

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

Commit migrated from https://github.com/mono/mono/commit/6ebf07f2cd4f71218c6a4a2ed5f855a5ac9ce9e3

4 years agoFix g_assert_not_reached message regression. (mono/mono#17263)
Jay Krell [Thu, 10 Oct 2019 08:26:14 +0000 (01:26 -0700)]
Fix g_assert_not_reached message regression. (mono/mono#17263)

Fix g_assert_not_reached message regression.

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

4 years agoRemove varargs from g_assert and g_assert_not_reachable. (mono/mono#17254)
Jay Krell [Wed, 9 Oct 2019 20:56:06 +0000 (13:56 -0700)]
Remove varargs from g_assert and g_assert_not_reachable. (mono/mono#17254)

Remove varargs from g_assert and g_assert_not_reachable (save 200+ bytes per frame in wasm interp).

g_assertf unchanged.

I have a strong suspicion, this will save approximately 432 - sizeof (InterpFrame) bytes of stack
per function call in the WebAssembly interpreter.

It will not significantly benefit or hurt any other system.
Systems with disabled asserts will receive a small size improvement.

WebAssembly has no provision for varargs.
Emscripten emulates it.
It appears the emulation allocates room in the frame per outgoing varargs call.
No stack packing.
So each g_assert takes space.

Alternative would be to discourage or disable or remove asserts.

Commit migrated from https://github.com/mono/mono/commit/8718b75b7a89f04e2423d11a009f11b37ef802df

4 years ago[mini] print inserted instruction in verbose logging (mono/mono#17249)
Bernhard Urban-Forster [Wed, 9 Oct 2019 18:16:04 +0000 (20:16 +0200)]
[mini] print inserted instruction in verbose logging (mono/mono#17249)

[mini] print inserted instruction in verbose logging

before:
```
 fmove R11 <- R9
         ff  11 9
        1  nop
```

after:
```
 fmove R11 <- R9
         ff  11 9
        0  loadr8_membase R11 <- [%ebp + 0x8]
        1  nop
```

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

4 years ago[mini] Fix check for FastAllocateString that used old name (mono/mono#17219)
Filip Navara [Wed, 9 Oct 2019 13:47:43 +0000 (15:47 +0200)]
[mini] Fix check for FastAllocateString that used old name (mono/mono#17219)

* Fix check for FastAllocateString that used old name

* Fix linker scripts

* Update the icall name for FastAllocateString to match managed name

* Update size check in managed allocator

* One more 64-bit target fix

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

4 years ago[sgen] Fix invalid value passed to write barrier (mono/mono#17236)
Vlad Brezae [Wed, 9 Oct 2019 11:37:41 +0000 (14:37 +0300)]
[sgen] Fix invalid value passed to write barrier (mono/mono#17236)

When doing memory copy dest is the destination address and src is the source address. If we are copying a single reference, we need to emit a write barrier and pass to the write barrier the value, not the pointer where the value is stored.

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

4 years agoRunning --enable-msvc-only didn't find jay.vcxproj. (mono/mono#17228)
Johan Lorensson [Wed, 9 Oct 2019 08:06:09 +0000 (10:06 +0200)]
Running --enable-msvc-only didn't find jay.vcxproj. (mono/mono#17228)

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

4 years ago[netcore] Fix NULL dereference when running LLVM JIT
Filip Navara [Tue, 8 Oct 2019 21:37:34 +0000 (23:37 +0200)]
[netcore] Fix NULL dereference when running LLVM JIT

Commit migrated from https://github.com/mono/mono/commit/28b3446d9eb433a23b595996d4a32dcea5f46b14

4 years agoRevert mono_runtime_set_main_args in mono/mono@44ff0597b835d0af62f526169dba3b365c9c34...
Jay Krell [Wed, 9 Oct 2019 04:54:44 +0000 (21:54 -0700)]
Revert mono_runtime_set_main_args in mono/mono@44ff0597b835d0af62f526169dba3b365c9c3411. (mono/mono#17233)

It breaks Xamarin.Android.

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

4 years ago[interp] Small cleanups (mono/mono#17229)
Vlad Brezae [Tue, 8 Oct 2019 22:08:44 +0000 (01:08 +0300)]
[interp] Small cleanups (mono/mono#17229)

* [intepr] Add define for constant

* [interp] Pass separately pop_vt_sp argument

Cleans up the code a bit. There is no need to do fancy bit operations for such a slow opcode.

Commit migrated from https://github.com/mono/mono/commit/579e385b96c5fd4d9e0b597d4820e3bd2e6cd24a

4 years ago[netcore] Port CoreCLR implementation of Exception.SetCurrentStackTrace (mono/mono...
Filip Navara [Tue, 8 Oct 2019 21:45:17 +0000 (23:45 +0200)]
[netcore] Port CoreCLR implementation of Exception.SetCurrentStackTrace (mono/mono#17243)

* Port CoreCLR implementation of Exception.SetCurrentStackTrace

* Update SerializationRemoteStackTraceString

* Update Exception.cs

Commit migrated from https://github.com/mono/mono/commit/63025d93fd36e834a5f0aca46b659cad0d01d2a2

4 years ago[netcore] Disable some SafeWaitHandle tests everywhere, not just Linux (mono/mono...
Alexander Köplinger [Tue, 8 Oct 2019 15:39:41 +0000 (17:39 +0200)]
[netcore] Disable some SafeWaitHandle tests everywhere, not just Linux (mono/mono#17230)

The tests are kinda bogus since they create a SafeWaitHandle from `new IntPtr(1)` which causes a crash during finalization when releasing that handle.

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

Commit migrated from https://github.com/mono/mono/commit/209c4bae3ec1827d1b0e4799b12a51e88012554c

4 years agoFix check in fix_libc_name to trigger only for libc, not or other names with same...
Filip Navara [Tue, 8 Oct 2019 11:06:38 +0000 (13:06 +0200)]
Fix check in fix_libc_name to trigger only for libc, not  or other names with same prefix (mono/mono#17222)

See https://github.com/mono/mono/pull/17210#pullrequestreview-298663220

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

4 years agoClean up map.c /map.h (mono/mono#16746)
Steffen Kieß [Tue, 8 Oct 2019 10:04:45 +0000 (12:04 +0200)]
Clean up map.c /map.h (mono/mono#16746)

* [Mono.Posix] Move Mono_Posix_{From,To}MremapFlags() to support/sys-mman.c

Since mono/mono@b522eab5ff5466debaacf9e971e26cfc464ebba5 Mono_Posix_FromMremapFlags()
and Mono_Posix_ToMremapFlags() contain manual changes for NetBSD. Move the
functions from support/map.c to support/sys-mman.c so that they won't be
overwritten when create-native-map is rerun.

* [Mono.Posix] Fix prototypes in support/stdio.c

In mono/mono@ed892ccf27849c082ce6ca46fa8b96d86ca7c329 wrapper functions for several
stdio functions were added, but the prototypes in map.h were manually
written, not using create-native-map. This commit changes the prototypes so
that they match the output of create-native-map.

* [Mono.Posix] Undefine HAVE_STRUCT_SOCKADDR_IN6 in support/map.c on MSVC

In mono/mono@22b6b9581418260397b701c17b16c3eb55136de7 a manual change to support/map.c
was added to prevent Mono_Posix_FromSockaddrIn6() and
Mono_Posix_ToSockaddrIn6() from being built for windows even if
HAVE_STRUCT_SOCKADDR_IN6 is defined. Instead undefine it in a header file
to avoid manual changes to map.c.

With this commit map.c, map.h and NativeConvert.generated.cs contain no
manual changes anymore.

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

4 years ago[netcore] Add libc name transition
Ryan Lucia [Mon, 7 Oct 2019 18:16:10 +0000 (14:16 -0400)]
[netcore] Add libc name transition

Commit migrated from https://github.com/mono/mono/commit/3355d2dd8115b3b2a412acc6efacd43fe0d63093

4 years agoRemove unused variable
Alexis Christoforides [Mon, 7 Oct 2019 22:05:13 +0000 (18:05 -0400)]
Remove unused variable

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

4 years ago[merp] Print missing status marker file for stage 1 (setup)
Alexis Christoforides [Mon, 7 Oct 2019 20:58:18 +0000 (16:58 -0400)]
[merp] Print missing status marker file for stage 1 (setup)

Commit migrated from https://github.com/mono/mono/commit/2ca93bd2f9f06b2bc6592b53b89a996691ecde4b

4 years agoZeroing is not necessary, snprintf() always null-terminates in this case
Alexis Christoforides [Mon, 7 Oct 2019 20:59:52 +0000 (16:59 -0400)]
Zeroing is not necessary, snprintf() always null-terminates in this case

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

4 years ago[interp] Rerun cprop pass if stloc.np intructions were eliminated
Vlad Brezae [Fri, 4 Oct 2019 11:22:13 +0000 (14:22 +0300)]
[interp] Rerun cprop pass if stloc.np intructions were eliminated

If we eliminate these instructions, it means we removed instructions that use the top of stack. Without them we might be able to optimize away that stack slot usage. If we retraverse the instruction stream, then we must handle movloc and stloc.np separately.

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

4 years ago[interp] Handle more cases for stloc.np optimization
Vlad Brezae [Fri, 4 Oct 2019 08:18:42 +0000 (11:18 +0300)]
[interp] Handle more cases for stloc.np optimization

We emit stloc.np if we have "stloc local; ldloc local". Bu we can also emit if we have "stloc loc1; ldloc loc2" and loc2 == loc1.

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

4 years ago[interp] Skip NOPs when checking previous instruction
Vlad Brezae [Fri, 4 Oct 2019 07:13:27 +0000 (10:13 +0300)]
[interp] Skip NOPs when checking previous instruction

When emitting stloc.np, which looks for stloc/ldloc pair.

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

4 years agodladdr shim for gmodule; try to enable crash reporter on AIX (mono/mono#15808)
Calvin Buckley [Mon, 7 Oct 2019 22:19:28 +0000 (19:19 -0300)]
dladdr shim for gmodule; try to enable crash reporter on AIX (mono/mono#15808)

* Introduce new dladdr wrapper in glib, AIX reimpl, and convert usage

Provides a wrapper around dladdr that should be platform-neutral.

Also provided is a reimplementation for AIX, which should enable
that platform to get some previously dladdr-specific functions like
the crash reporter. It is somewhat flawed in that it only gets info
for symbols in .text, returns non-constant allocated strings, and
allocates heap memory for buffers.

Then convert usages (except a macOS specific one) of dladdr to the
new eglib function. It has a different signature, which should
simplify intent and reduce structiness. Also free memory on AIX due
to limitations of its reimplmenetation.

* Enable (and fix build of) crash reporter on AIX

So far crashes don't seem any different, but the code for it is
built.

* typo fix (guess this isn't compiled on aix)

* attempt to fix macOS and win32 builds

* Implement more of g_module_address on Win32

Implements the filename stuff. Untested; don't have Windows.

* Look for backtrace_symbols in an IBM compat library for i

Enables i to natively dump a stack trace. (AIX "works" too if you
copy the compat lib's code and hack it in - it probably needs to be
in EGlib.) Unfortunately, it's not perfect. The backchain from the
signal handler is empty on i, and AIX sometimes mangles the stack
frame in a way that severely confuses the backtrace code, causing
it to dereference invalid memory by interpreting instructions as a
pointer. (I have seen somewhat similar for the sigaltstack case,
where the native memory dump attempts to read something it should
not.) Perhaps mincore could be used, but that feels like a sloppy
workaround, especially in the "AIX making an invalid stack frame"
case.

* If the file isn't an archive, don't format its name like one

* Fix up search for backtrace_symbols to look in libexecinfo

FreeBSD ships it in base and Haiku has a package; likely others too.

* Win32 suffers in g_module_address as well

* That should habe been guarded with AIX due to limitations

Otherwise seems to free things that shouldn't be freed

* Casting for win32

* Fix up Win32 impl of module address

* Free HMODULE to lower reference count after using it

* Change dladdr based impl to always dup for impl consistency

Means freeing afterwards shouldn't be ifdefable.

* probably shouldn't strdup NULL

Likely why macOS has failures.

* Don't dup/return const strs, but copy to caller-provided buffers

...which can be on the stack. This makes it far less risky to use
in a crash reporter scenario, because malloc can be hosed then.

Also fix profiler up better to work with this new reality.

Commit migrated from https://github.com/mono/mono/commit/01dd63c440d0ad09542b8d3b9301658a6e8a0d30

4 years agoBump version to 6.9 (mono/mono#17207)
Jo Shields [Mon, 7 Oct 2019 20:36:13 +0000 (16:36 -0400)]
Bump version to 6.9 (mono/mono#17207)

* Bump version to 6.9

* Add missing new linker source file

* [csproj] Update project files

* No monolinker on MCS mode, new linker version needs Roslyn

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

4 years agoDon't declare mono_get_module* on non-win32
Ryan Lucia [Thu, 3 Oct 2019 21:15:33 +0000 (17:15 -0400)]
Don't declare mono_get_module* on non-win32

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

4 years agoUse eglib win32 helper functions without MAX_PATH limit
Ryan Lucia [Wed, 18 Sep 2019 19:56:37 +0000 (15:56 -0400)]
Use eglib win32 helper functions without MAX_PATH limit

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

4 years agoEscape type namespaces, document that we aren't escaping names for now
Ryan Lucia [Tue, 17 Sep 2019 23:47:29 +0000 (19:47 -0400)]
Escape type namespaces, document that we aren't escaping names for now

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

4 years agoMake the mono identifier escape function work like unescape and public
Ryan Lucia [Tue, 17 Sep 2019 23:46:38 +0000 (19:46 -0400)]
Make the mono identifier escape function work like unescape and public

Commit migrated from https://github.com/mono/mono/commit/8760cd446cca20c8ba7f9a49cfacb20e653cc3dd

4 years agoUnescape type names in the managed parser
Ryan Lucia [Tue, 17 Sep 2019 21:20:17 +0000 (17:20 -0400)]
Unescape type names in the managed parser

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

4 years agoMake TypeNameParser consistently use tabs
Ryan Lucia [Tue, 17 Sep 2019 20:25:53 +0000 (16:25 -0400)]
Make TypeNameParser consistently use tabs

Is this worth the line damage? Unsure.

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

4 years agoPartially revert "Remove redundant function call of EscapeTypeName to make (mono...
Ryan Lucia [Tue, 17 Sep 2019 20:11:51 +0000 (16:11 -0400)]
Partially revert "Remove redundant function call of EscapeTypeName to make  (mono/mono#16425)"

This partially reverts commit mono/mono@abe48e3fd48407a5b76a6581ae7853c66d800b19.

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

4 years agoDo not zero localalloc if not asked. (mono/mono#16881)
Jay Krell [Mon, 7 Oct 2019 14:42:13 +0000 (07:42 -0700)]
Do not zero localalloc if not asked. (mono/mono#16881)

Note that we will still touch the pages (mono_emit_stack_alloc).

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

4 years ago[Coop] Convert Get/SetGenericValueImpl. (mono/mono#17034)
Jay Krell [Mon, 7 Oct 2019 14:40:22 +0000 (07:40 -0700)]
[Coop] Convert Get/SetGenericValueImpl. (mono/mono#17034)

This is an alternative to https://github.com/mono/mono/pull/16994
and does *not* depend on
   https://github.com/mono/mono/pull/16987
or https://github.com/mono/mono/pull/17009
or similar.

Commit migrated from https://github.com/mono/mono/commit/957e6fa4ddb9a4cdae818b49850a7b6949a5e6a2

4 years agoDefault --host in autogen.sh on cygwin when missing. (mono/mono#17164)
Alexander Köplinger [Mon, 7 Oct 2019 14:38:49 +0000 (16:38 +0200)]
Default --host in autogen.sh on cygwin when missing. (mono/mono#17164)

Commit migrated from https://github.com/mono/mono/commit/495b08a3c7e4fde49b919749a369e8805f5190c1

4 years ago[IO] Remove read-only logic in mono_w32_get_disk_free_space (mono/mono#17177)
Ryan Lucia [Mon, 7 Oct 2019 14:38:23 +0000 (10:38 -0400)]
[IO] Remove read-only logic in mono_w32_get_disk_free_space (mono/mono#17177)

This brings us in line with GetDiskFreeSpaceExW on Windows as well as .NET Core.

Commit migrated from https://github.com/mono/mono/commit/6f723639326f6c479b604c0d955991519d85ff2d

4 years ago[debugger][exception] Debugger breaks on handled exceptions (mono/mono#17106)
Thays Grazia [Mon, 7 Oct 2019 12:22:06 +0000 (08:22 -0400)]
[debugger][exception] Debugger breaks on handled exceptions (mono/mono#17106)

* If there is a perform_wait_callback in the stack there will be another catch generated by the owner thread, so we don't need to throw, we can continue and find the next catch.
Fixes mono/mono#17083

* Reverting unit test changed on commit 405d521.

* Fixing assert when calling mono_jit_info_get_method if it was a trampoline.

Commit migrated from https://github.com/mono/mono/commit/18fac0a24190cb3f90057d86232e773758bb1284

4 years ago[netcore] Optimize Buffer.BlockCopy and Buffer.IsPrimitiveArray (mono/mono#16692)
Egor Bogatov [Mon, 7 Oct 2019 10:29:22 +0000 (13:29 +0300)]
[netcore] Optimize Buffer.BlockCopy and Buffer.IsPrimitiveArray (mono/mono#16692)

* Optimize Buffer.BlockCopy and IsPrimitiveArray (make them icalls)

* wrap with ENABLE_NETCORE

* fix formatting

* fix check for "is primitive"

* use m_class_is_primitive

* fix build errors

* fix typo

* fix failing test

* use mono_error_set_argument_out_of_range

* fix argument names for exceptions

Commit migrated from https://github.com/mono/mono/commit/35c6b7691f4043fd49d8393b84224f0d1df1e7fe

4 years agoOptimize and extend System.Array intrinsic identification. (mono/mono#17047)
Jay Krell [Sun, 6 Oct 2019 08:27:42 +0000 (01:27 -0700)]
Optimize and extend System.Array intrinsic identification. (mono/mono#17047)

* Optimize and extend System.Array intrinsic identification.
i.e. do the strcmp last.
Add GetRawArrayData.

* Use [Intrinsic] attribute instead of comment.

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

4 years ago[mixed] Add interp entry wrappers for devirtualized calls as well. (mono/mono#17159)
Zoltan Varga [Sun, 6 Oct 2019 00:51:52 +0000 (20:51 -0400)]
[mixed] Add interp entry wrappers for devirtualized calls as well. (mono/mono#17159)

* [mixed] Add interp entry wrappers for devirtualized calls as well.

* [aot] Generate code for string:memcpy/memset/bzero even in profile mode, they are called by the generated code.

* [aot] Treat string:memcpy as always AOTed in mono_aot_can_enter_interp () as well.

* [aot] Always aot string ctors as well, the JIT doesn't generate interp entry code for them.

* [wasm] Update print-table.py.

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

4 years ago[merp] Put thread into async context before running summarizer (mono/mono#17194)
Aleksey Kliger (λgeek) [Sat, 5 Oct 2019 17:01:56 +0000 (13:01 -0400)]
[merp] Put thread into async context before running summarizer (mono/mono#17194)

Followup work for https://github.com/mono/mono/pull/17090

In order to get managed method info for unmanaged stacktraces, we call
mini_jit_info_table_find_ext which calls decode_exception_debug_info which may
allocate if it's not in async context.

Do the switch in mono_threads_summarize_execute so that non-supervising threads
all switch when they run the sigterm_signal_handler.  mono_threads_summarize
already does it for the supervisor thread.

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

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

4 years ago[merp] exit_status is 0 if we ran the uploader successfully (mono/mono#17185)
Aleksey Kliger (λgeek) [Sat, 5 Oct 2019 13:59:05 +0000 (09:59 -0400)]
[merp] exit_status is 0 if we ran the uploader successfully (mono/mono#17185)

Not 1 (TRUE)

Commit migrated from https://github.com/mono/mono/commit/2f7fd4f03e464946ea752800ca06aa2676e9d75f

4 years ago[System.Private.CoreLib] Fixes build
Marek Safar [Sat, 5 Oct 2019 07:16:00 +0000 (09:16 +0200)]
[System.Private.CoreLib] Fixes build

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

4 years ago[reflection] Only duplicate MonoMarshalSpec strings for custom types (mono/mono#17175)
Ryan Lucia [Fri, 4 Oct 2019 17:41:56 +0000 (13:41 -0400)]
[reflection] Only duplicate MonoMarshalSpec strings for custom types (mono/mono#17175)

* [reflection] only duplicate MonoMarshalSpec strings for custom types

* Add test

Commit migrated from https://github.com/mono/mono/commit/05217395db99f0d02a6737ed0491fa65db96632d

4 years ago[llvm] Propogate --enable-llvm-asserts to llvm/build.mk (mono/mono#17149)
Egor Bogatov [Fri, 4 Oct 2019 15:27:01 +0000 (18:27 +0300)]
[llvm] Propogate --enable-llvm-asserts to llvm/build.mk (mono/mono#17149)

* fix Enable llvm asserts

* fix chmod

Commit migrated from https://github.com/mono/mono/commit/26754eecff93d568f4531e31c7c1bce3202645b1

4 years ago[interp] Improve copy propagation (mono/mono#17154)
Vlad Brezae [Fri, 4 Oct 2019 11:20:52 +0000 (14:20 +0300)]
[interp] Improve copy propagation (mono/mono#17154)

* [interp] Refactor tracking of stack/local values

Previously we had just an InterpInst* inside StackContentInfo, which was representing the instruction that pushed a certain local/value on the stack. This makes many things awkward, since an instruction is logically different from a value, that a local or a stack slot have. If we clear an instruction, it doesn't necessarily mean that the value that the instruction produced can't be stored on stack or in a local.

This commit creates a new structure StackValue, which holds the value.

* [interp] Generalize contents of StackValue

StackValue contains an opcode and some data to enable reconstruction of the value. For example instead of doing a LDLOC for a local, we can see if the local has a known value and use it instead (this could be a LDLOC from another local, whose value was propagated, or in the future a LDC). This will make more sense when we also start to track constant values.

Also decouple MOVLOC instructions from the cprop pass. They serve no purpose there. They are useful though when we do deadce, since we currently don't know how to kill instructions that change the stack.

* [interp] Handle dup opcode during copy propagation

* [interp] Avoid losing track of stack values for some opcodes

For some opcodes, that access stack values below the top of the stack, we were assuming they pop everything and then push the stack back, in order to prevent optimizing away instructions that pushed some of these values, since the original instruction expects those values to reside on the stack. We handle these instruction separately and keep track of the values of the stack, so we can further propagate the stack values, even though we currently can't optimize away those instructions.

* [interp] Propagate values for ctor arguments

* [interp] MINT_CASTCLASS no longer clobbers top of stack

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

4 years agoAlways do copy_stack_data on entering GC safe/unsafe mode. (mono/mono#17150)
Johan Lorensson [Fri, 4 Oct 2019 07:16:05 +0000 (09:16 +0200)]
Always do copy_stack_data on entering GC safe/unsafe mode. (mono/mono#17150)

Commit migrated from https://github.com/mono/mono/commit/2aa7adb269c795b721a9fcbac98969efb5b4a006

4 years ago[merp] Don't overrun buffer in copy_summary_string_safe … (mono/mono#17176)
Aleksey Kliger (λgeek) [Fri, 4 Oct 2019 05:17:49 +0000 (01:17 -0400)]
[merp] Don't overrun buffer in copy_summary_string_safe … (mono/mono#17176)

* [merp] Don't overrun buffer in copy_summary_string_safe

MonoFrameSummary:str_destr is an array of MONO_MAX_SUMMARY_NAME_LEN bytes, not
MONO_MAX_SUMMARY_NAME_LEN + 1 bytes.

Fixes Coverity CID 1454563

* [merp] Use g_strlcpy for copy_summary_string_safe

Fixes Coverity CID 1454563

We would sometimes write to MonoSummaryFrame:str_descr which is
MONO_MAX_SUMMARY_NAME_LEN bytes long at index MONO_MAX_SUMMARY_NAME_LEN which
is one past the end of the array.

* nit: rename confusing parameter names

old names were confusing - we were copying from 'out' to 'in'.  Now we copy to
'dest' from 'src'

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

4 years ago[arm] Fix fetching of method addresses (mono/mono#17099)
Vlad Brezae [Thu, 3 Oct 2019 19:29:55 +0000 (22:29 +0300)]
[arm] Fix fetching of method addresses (mono/mono#17099)

After https://github.com/mono/mono/commit/9ff3b0d65ee4, in an aot image we can emit addresses either as bl offset (which uses 4 bytes) or as ldr pc, =<label>; <addr> (which uses 8 bytes). Before this commit we were dereferencing an instruction pointer, in get_call_table_entry, assuming 8 bytes per entry. This could overflow and crash if we used in fact only 4 bytes per entry. Fix this by including the entry size in the aot image.

Fixes random crashes on arm CI on full-aotmixed suite.

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

4 years ago[master] Update dependencies from dotnet/corefx (mono/mono#17166)
dotnet-maestro[bot] [Thu, 3 Oct 2019 18:45:29 +0000 (20:45 +0200)]
[master] Update dependencies from dotnet/corefx (mono/mono#17166)

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

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

* Reenable libgdiplus/System.Drawing.Common tests

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

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

Commit migrated from https://github.com/mono/mono/commit/06c3637681e4dc2d450c5f0296203493cc536387

4 years ago[netcore] Update .gitignore
Alexander Köplinger [Thu, 3 Oct 2019 16:45:14 +0000 (18:45 +0200)]
[netcore] Update .gitignore

Commit migrated from https://github.com/mono/mono/commit/43ccc6c26b07fcd4ed41df6d70248c9c3d961e20

4 years ago[netcore] Move ignored test to global ignore file instead of the Linux-specific
Alexander Köplinger [Thu, 3 Oct 2019 16:44:00 +0000 (18:44 +0200)]
[netcore] Move ignored test to global ignore file instead of the Linux-specific

It affects all platform

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

4 years agoMerge pull request mono/mono#17105 from naricc/naricc/UnitializedArray-Comment
Sam Patel [Thu, 3 Oct 2019 14:43:45 +0000 (10:43 -0400)]
Merge pull request mono/mono#17105 from naricc/naricc/UnitializedArray-Comment

Add a comment explaining why GC.AllocateUninitializedArray is not an icall

Commit migrated from https://github.com/mono/mono/commit/83a5343d125bfd874a70633419ef18f8dca28c55

4 years agoDefault --host in autogen.sh on cygwin when missing.
lateralusX [Thu, 3 Oct 2019 10:25:30 +0000 (12:25 +0200)]
Default --host in autogen.sh on cygwin when missing.

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

4 years agoOptional only build MSVC runtime using make file system on Windows. (mono/mono#16915)
Johan Lorensson [Thu, 3 Oct 2019 09:21:36 +0000 (11:21 +0200)]
Optional only build MSVC runtime using make file system on Windows. (mono/mono#16915)

* Build MSVC only runtime using make file system.

Add a new option to only build MSVC version of mono runtime and native
tools, --enable-msvc-only. In the past, --enable-msvc build both
mingw as well as MSVC runtime, this commit adds an option to only build
MSVC version of runtime and native tools using make file system.

Commit updates all native make file making sure mingw/gcc builds are
not done if --enable-msvc-only has been used. It also makes sure we
build and use MSVC based tools as part of build and tests.

Result will be a build without any mingw/gcc artifacts, but where all
existing make files still works with the MSVC build artifacts.

This commits is also preparing to switch the .NETCore build over to use
MSVC build runtime in order to get LLVM support, something that is
currently only supported on Windows MSVC build.

* Add link to mono-sgen.exe and clean windows binaries.

* Fix failures in mono/tests test-aot on Windows.

* Add fullaot-mixed tests on Windows x64.

* Run msbuild in parallel.

* Default to x64 mingw host on cygwin build.

Commit migrated from https://github.com/mono/mono/commit/55be8289ff1601824707bb2ef9d554b01123f713

4 years agoSpelling corrections.
Nathan Ricci [Wed, 2 Oct 2019 17:14:48 +0000 (13:14 -0400)]
Spelling corrections.

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

4 years agoFix missing corerun/ directory in `make dist` tarballs (mono/mono#17126)
Jo Shields [Wed, 2 Oct 2019 14:46:42 +0000 (10:46 -0400)]
Fix missing corerun/ directory in `make dist` tarballs (mono/mono#17126)

```
 configure.ac:6695: error: required file 'netcore/corerun/Makefile.in' not found
 Makefile.am:24: error: required directory ./netcore/corerun does not exist
```

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

4 years agoSome external_only/internal split, and inlining. (mono/mono#17012)
Jay Krell [Wed, 2 Oct 2019 10:59:45 +0000 (03:59 -0700)]
Some external_only/internal split, and inlining. (mono/mono#17012)

mono_type_get_type
 mono_type_get_signature
 mono_type_is_byref
 mono_type_get_class
 mono_type_get_array_type

Commit migrated from https://github.com/mono/mono/commit/6fb01aa269e7654db21f32c4d44df0d6e0a93e67

4 years ago[jit amd64] Add const and remove x87. (mono/mono#16700)
Jay Krell [Wed, 2 Oct 2019 09:51:59 +0000 (02:51 -0700)]
[jit amd64] Add const and remove x87. (mono/mono#16700)

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

4 years ago[mini] Use clr memory model by default (mono/mono#17136)
Vlad Brezae [Wed, 2 Oct 2019 07:23:45 +0000 (10:23 +0300)]
[mini] Use clr memory model by default (mono/mono#17136)

* [mini] Use clr memory model by default

Otherwise we can have potential crashes in the bcl on arm targets, since a lot of code that assumes this memory model is now shared with mono.

Keep the old clr-memory-model option alive for now, to avoid potential build problems, if building older mono with newer mono.

* [build] Remove clr-memory-model option

It is default now

* [man] Add entry for weak-memory-model

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

4 years ago[merp] Include any managed methods in the 'unmanaged_frames' portion … (mono/mono...
Alexis Christoforides [Wed, 2 Oct 2019 05:11:35 +0000 (01:11 -0400)]
[merp] Include any managed methods in the 'unmanaged_frames' portion … (mono/mono#17090)

* [merp] Include any managed methods in the 'unmanaged_frames' portion of the output also

This can help correlate the two lists when we have mixed managed & unmanaged stacks in our crash output.

* Wehn symbol/function address is not found, still output the IaP

* Don't set native_offset to ip, that's not what it means

* [merp] Bump protocol version

* Minor formatting fix

* Remove paths from assembly image names

* Remove unused var

* Refactor filling in managed info for stack frame

* Revert "Remove paths from assembly image names"

This reverts commit mono/mono@defe86b471f37e12fa66a104747cac932943dca1.

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

4 years ago[merp] Use macOS version not Darwin version in MERP reports (mono/mono#17130)
Kyle White [Wed, 2 Oct 2019 02:01:35 +0000 (22:01 -0400)]
[merp] Use macOS version not Darwin version in MERP reports (mono/mono#17130)

* Use macOS version not Darwin version in MERP

Fixes mono/mono#17004

* Update mono-merp.c

Ensure this is only for Mac

* Don't allocate in macos_version_string

Use a static buffer.

Also some formatting fixes.

Commit migrated from https://github.com/mono/mono/commit/0004522028ad30bfb7299a6e50cbab98a63ffeaf

4 years ago[sgen] Fix allocator spelling (mono/mono#17111)
Vlad Brezae [Tue, 1 Oct 2019 09:09:54 +0000 (12:09 +0300)]
[sgen] Fix allocator spelling (mono/mono#17111)

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

4 years ago[netcore] Update coreclr tests package name
Marek Safar [Tue, 1 Oct 2019 08:11:29 +0000 (10:11 +0200)]
[netcore] Update coreclr tests package name

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

4 years agoEnable hw intrinsics in AOT mode (mono/mono#17005)
Egor Bogatov [Tue, 1 Oct 2019 01:28:55 +0000 (04:28 +0300)]
Enable hw intrinsics in AOT mode (mono/mono#17005)

* Introduce -mattr flag

* fix build on arm targets

* remove mono_memory_barrier

* Address feedback

* Address feedback

* cleanup

* fix crash

* fix "bmi" (it's not "bmi1")

* cleanup

* ignore System.Drawing.Tests.IconTests.CorrectColorDepthExtracted test

* fix build on arm

* fix build

* fix build

Commit migrated from https://github.com/mono/mono/commit/5537a7c2ba6fca532c8b4e380278766d659981c0

4 years ago[sgen] Add stats for allocated gchandles (mono/mono#17074)
Vlad Brezae [Mon, 30 Sep 2019 18:15:42 +0000 (21:15 +0300)]
[sgen] Add stats for allocated gchandles (mono/mono#17074)

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

4 years ago[netcore] Disable System.Drawing.Tests.IconTests.CorrectColorDepthExtracted test
Alexander Köplinger [Mon, 30 Sep 2019 13:32:18 +0000 (15:32 +0200)]
[netcore] Disable System.Drawing.Tests.IconTests.CorrectColorDepthExtracted test

It is broken on newer libgdiplus.

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

4 years ago[netcore] Add target for running coreclr tests
Marek Safar [Fri, 27 Sep 2019 08:19:58 +0000 (10:19 +0200)]
[netcore] Add target for running coreclr tests

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

4 years agoUpdated comment in GC.cs about unitialized array.
Nathan Ricci [Fri, 27 Sep 2019 18:48:00 +0000 (14:48 -0400)]
Updated comment in GC.cs about unitialized array.

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

4 years ago[mini] Expand clr-memory-model effect (mono/mono#17093)
Vlad Brezae [Fri, 27 Sep 2019 09:36:04 +0000 (12:36 +0300)]
[mini] Expand clr-memory-model effect (mono/mono#17093)

* [mini] Add memory barriers to more stores inside objects

We should now have membars for all stores of an object ref inside another object (for the stores done by the jit). Used by clr-memory-model debug option.

* [mini] Add memory barrier for storing objref in static fields

For clr-memory-model debug option.

Commit migrated from https://github.com/mono/mono/commit/194506d495a2e2b7b2fad5dbb655f404cecb2c04

4 years ago[runtime] Respect runtime_version in mono_init_internal (mono/mono#17085)
Aleksey Kliger (λgeek) [Thu, 26 Sep 2019 21:30:37 +0000 (17:30 -0400)]
[runtime] Respect runtime_version in mono_init_internal (mono/mono#17085)

In mono/mono@6d2c77fb3373971b4c615a70fe43f3622e3c91d8 we changed the representation of
the runtimes that we will probe from a NULL-terminated array to a linked list.
Unfortunately we made a typo, and in the case where the caller of
mono_init_internal provided a runtime_version, we still picked
DEFAULT_RUNTIME_VERSION instead of the given runtime_version.

This is an issue for embedders like XA that use the "mobile" runtime - all
their assemblies are compiled with the "mobile" version number (2.0.5.0) but
Mono running with the default runtime configuration will remap to 4.0.0.0.  As
a result, when there are references to 2.0.5.0 assemblies, the load requests
will be remapped to 4.0.0.0 which will never see the already loaded 2.0.5.0
assemblies, and we will fall back on the embedder's preload hook or filesystem
probing every single time.  This is a performance fail.

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

4 years agoRevert "Inline TLS access. (mono/mono#16882)" (mono/mono#17092)
Alexander Köplinger [Thu, 26 Sep 2019 21:10:51 +0000 (23:10 +0200)]
Revert "Inline TLS access. (mono/mono#16882)" (mono/mono#17092)

Reverts mono/monomono/mono#16882

This broke the Mono Android SDKs build in master though for some reason it doesn't show up in the PR build:

```
[2019-09-26T03:19:55.366Z] Undefined symbols for architecture x86_64:
[2019-09-26T03:19:55.366Z]   "_mono_tls_key_jit_tls", referenced from:
[2019-09-26T03:19:55.366Z]       _mono_tls_get_jit_tls in libmain_a-main-sgen.o
[2019-09-26T03:19:55.366Z]   "_mono_tls_key_lmf_addr", referenced from:
[2019-09-26T03:19:55.366Z]       _mono_tls_get_lmf_addr in libmain_a-main-sgen.o
[2019-09-26T03:19:55.366Z] ld: symbol(s) not found for architecture x86_64
[2019-09-26T03:19:55.366Z] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[2019-09-26T03:19:55.366Z] gmake[6]: *** [Makefile:1634: mono-sgen] Error 1
[2019-09-26T03:19:55.366Z] gmake[6]: Leaving directory '/Users/builder/jenkins/workspace/archive-mono/master/android/debug/sdks/builds/android-host-Darwin-debug/mono/mini'
```.

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

4 years ago[sgen] Report roots from togglerefs (mono/mono#17063)
Vlad Brezae [Thu, 26 Sep 2019 19:38:59 +0000 (22:38 +0300)]
[sgen] Report roots from togglerefs (mono/mono#17063)

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

4 years ago[netcore] Correctly send exit code to the caller
Marek Safar [Thu, 26 Sep 2019 11:57:42 +0000 (13:57 +0200)]
[netcore] Correctly send exit code to the caller

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

4 years ago[sgen] Fix heavy binary protocol build (mono/mono#17037)
Vlad Brezae [Thu, 26 Sep 2019 17:16:04 +0000 (20:16 +0300)]
[sgen] Fix heavy binary protocol build (mono/mono#17037)

[sgen] Fix heavy binary protocol build

Commit migrated from https://github.com/mono/mono/commit/470e53f6b446f6adabb0ce4164b8540b9f65f09d

4 years agoMerge pull request mono/mono#17031 from EgorBo/bmi-mulx
imhameed [Thu, 26 Sep 2019 16:29:54 +0000 (09:29 -0700)]
Merge pull request mono/mono#17031 from EgorBo/bmi-mulx

[LLVM] Implement Bmi2.MultiplyNoFlags

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

4 years ago[crashing] Remove Mono signal handlers when starting to handle a crash
Alexis Christoforides [Mon, 23 Sep 2019 19:38:52 +0000 (15:38 -0400)]
[crashing] Remove Mono signal handlers when starting to handle a crash

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

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

4 years ago[merp] Output native library module name when 'whitelist all' mode is enabled (mono...
Alexis Christoforides [Thu, 26 Sep 2019 13:30:01 +0000 (09:30 -0400)]
[merp] Output native library module name when 'whitelist all' mode is enabled (mono/mono#16899)

Partially fixes https://github.com/mono/mono/issues/16689

Commit migrated from https://github.com/mono/mono/commit/4727b2475f89cf7343edbd095647635c0b26f67a

4 years ago[interp] always require GC Unsafe mode in exception checkpoint (mono/mono#17016)
Bernhard Urban [Thu, 26 Sep 2019 08:45:56 +0000 (10:45 +0200)]
[interp] always require GC Unsafe mode in exception checkpoint (mono/mono#17016)

[interp] always require GC Unsafe mode in exception checkpoint

Follow-up for https://github.com/mono/mono/pull/16955

/cc @BrzVlad

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

4 years ago[debugger] Properly close debugger thread when connection hangs
Vlad Brezae [Thu, 19 Sep 2019 14:46:11 +0000 (17:46 +0300)]
[debugger] Properly close debugger thread when connection hangs

When we detach from the debugger, we reset the state by starting a new debugger thread (why don't we just use the existing thread?). As per commit https://github.com/mono/mono/commit/mono/mono@540ef385faa230bc226c7a83bfabd0730520911e we should shut down the debugger thread when the connection drops. However, since that commit was acting as a Dispose command was sent instead, it would end up relentlessly spawning and closing new debugger threads up until the runtime is shut down. This commit makes sure we don't respawn once the connection hangs.

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

4 years agoLLVM: Add comments (string metadata) for calls (mono/mono#16956)
Egor Bogatov [Thu, 26 Sep 2019 07:51:36 +0000 (10:51 +0300)]
LLVM: Add comments (string metadata) for calls (mono/mono#16956)

* Add string metadata to all calls (comments)

* Update mini-llvm.c

* rename tramp_%d to full name too

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

4 years ago[threading] embedded mono hangs (mono/mono#16907)
Thays Grazia [Wed, 25 Sep 2019 20:12:33 +0000 (17:12 -0300)]
[threading] embedded mono hangs (mono/mono#16907)

* [threading] embedded mono hangs

When embedded mono is executing a C++ code, it didn't start to execute a C# code, we don't need to suspend the thread to run GC.
Fixes mono/mono#16192
Fixes mono/mono#14725

* Changing what was discussed with Aleksey during our 1on1

* Changing what was suggested by Aleksey

* Separating mono_init_version that is being used on tests from the embedded ones

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

4 years ago[Coop] Unconvert ves_icall_Mono_TlsProviderFactory_IsBtlsSupported. (mono/mono#16995)
Jay Krell [Wed, 25 Sep 2019 18:40:38 +0000 (11:40 -0700)]
[Coop] Unconvert ves_icall_Mono_TlsProviderFactory_IsBtlsSupported. (mono/mono#16995)

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

4 years ago[netcore] Disable annoying SourceLink warrnings (mono/mono#17055)
Egor Bogatov [Wed, 25 Sep 2019 16:28:53 +0000 (19:28 +0300)]
[netcore] Disable annoying SourceLink warrnings (mono/mono#17055)

Currently netcore-build doesn't need submodules (except LLVM) so a task somewhere in arcade/microsoft.build.tasks.git always complain if those are not cloned.

Set EnableSourceControlManagerQueries=false to ignore the warnings.

Commit migrated from https://github.com/mono/mono/commit/39ff579432fc6261469f9f0ce6304ca29a5ef141

4 years agorevise all X86 intrinsics
EgorBo [Wed, 25 Sep 2019 11:58:53 +0000 (14:58 +0300)]
revise all X86 intrinsics

Commit migrated from https://github.com/mono/mono/commit/2ceb062c9b3b250c8749ab28a976b23aedafccea

4 years agoFix comment about mono_thread_interruption_request_flag. (mono/mono#17036)
Jay Krell [Wed, 25 Sep 2019 10:30:27 +0000 (03:30 -0700)]
Fix comment about mono_thread_interruption_request_flag. (mono/mono#17036)

Fix https://github.com/mono/mono/pull/16906/files#r327660329.

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

4 years agoImplement Bmi2.MultiplyNoFlags
EgorBo [Wed, 25 Sep 2019 01:04:38 +0000 (04:04 +0300)]
Implement Bmi2.MultiplyNoFlags

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

4 years agoLLVM: Intrinsify MathF.Round (mono/mono#16840)
Egor Bogatov [Tue, 24 Sep 2019 18:53:23 +0000 (21:53 +0300)]
LLVM: Intrinsify MathF.Round (mono/mono#16840)

* improve MathF.Round

* prefer vroundss

* enable round only for jit

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

4 years ago[checked-build] update allowed thread states (mono/mono#16971)
Bernhard Urban [Tue, 24 Sep 2019 18:53:10 +0000 (20:53 +0200)]
[checked-build] update allowed thread states (mono/mono#16971)

Commit migrated from https://github.com/mono/mono/commit/153b5def01ae036ad1b9318cc54973a10919f0a7

4 years agoAdd loop related optimizations to LLVM JIT (mono/mono#16436)
Egor Bogatov [Tue, 24 Sep 2019 18:45:32 +0000 (21:45 +0300)]
Add loop related optimizations to LLVM JIT (mono/mono#16436)

* Add loop-related optimizations

* Update llvm-jit.cpp

* Update llvm-jit.cpp

* Update llvm-jit.cpp

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

4 years ago[netcore] Implement missing Bmi1/Bmi2 intrinsics (mono/mono#16919)
Egor Bogatov [Tue, 24 Sep 2019 18:44:03 +0000 (21:44 +0300)]
[netcore] Implement missing Bmi1/Bmi2 intrinsics (mono/mono#16919)

* Finalize BMI1

* cleanup

* Update simd-intrinsics-netcore.c

* Update simd-intrinsics-netcore.c

* fix LLVM-AOT

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