platform/upstream/dotnet/runtime.git
5 years agoMerge pull request mono/mono#14325 from HebaruSan/fix/listviewgroup-forecolor
Steve Pfister [Fri, 31 May 2019 02:05:37 +0000 (22:05 -0400)]
Merge pull request mono/mono#14325 from HebaruSan/fix/listviewgroup-forecolor

Fix light on light ListViewGroup headers on dark theme

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

5 years agoBatch of runtime warning fixes on Darwin (mono/mono#14713)
Ryan Lucia [Thu, 30 May 2019 20:35:48 +0000 (16:35 -0400)]
Batch of runtime warning fixes on Darwin (mono/mono#14713)

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

5 years agoRemove JIT icall hashing by name and AOT JIT icall hashing. (mono/mono#14644)
Jay Krell [Thu, 30 May 2019 10:39:56 +0000 (03:39 -0700)]
Remove JIT icall hashing by name and AOT JIT icall hashing. (mono/mono#14644)

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

5 years ago[netcore] Add a metapackage for all supported runtimes
Jo Shields [Wed, 29 May 2019 15:58:57 +0000 (11:58 -0400)]
[netcore] Add a metapackage for all supported runtimes

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

5 years agomono_mempool_alloc0: Don't give up the rest of the chunk (mono/mono#14671)
Jay Krell [Wed, 29 May 2019 23:11:46 +0000 (16:11 -0700)]
mono_mempool_alloc0: Don't give up the rest of the chunk (mono/mono#14671)

when the allocation does not fit, i.e. when it is >= MONO_MEMPOOL_PREFER_INDIVIDUAL_ALLOCATION_SIZE.

Or at least make the code clearer and smaller.

"fixes" https://github.com/mono/mono/issues/14669.

Commit migrated from https://github.com/mono/mono/commit/815cb9da1aae89abc421adc05917deb6b409e5ff

5 years agobump roslyn
Egor Bogatov [Wed, 29 May 2019 08:04:22 +0000 (11:04 +0300)]
bump roslyn

Commit migrated from https://github.com/mono/mono/commit/472465d6ba26d5cb9f98b2cad4b929e23adf2239

5 years agoUpdate THIRD-PARTY-NOTICES.TXT
Rich Lander [Fri, 24 May 2019 20:30:52 +0000 (13:30 -0700)]
Update THIRD-PARTY-NOTICES.TXT

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

5 years agoCreate THIRD-PARTY-NOTICES.TXT
Rich Lander [Fri, 24 May 2019 20:30:28 +0000 (13:30 -0700)]
Create THIRD-PARTY-NOTICES.TXT

TPN for https://github.com/mono/mono/blob/mono/mono@23e6f6f4b58d72800f4e27fa29a6b58806ff475f/mono/mini/bench.cs#L65

Commit migrated from https://github.com/mono/mono/commit/51d58cf80c555531ed979745a464bd6d5a7df9dc

5 years agoCreate THIRD-PARTY-NOTICES.TXT
Rich Lander [Fri, 24 May 2019 15:40:59 +0000 (08:40 -0700)]
Create THIRD-PARTY-NOTICES.TXT

TPN for https://github.com/mono/mono/blob/mono/mono@29ee4e15806848ff5131c4bdd23ded786f5bc186/mono/benchmark/zipmark.cs

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

5 years ago[interp] Make --interp= not override last set execution mode (mono/mono#14683)
Vlad Brezae [Wed, 29 May 2019 07:02:23 +0000 (10:02 +0300)]
[interp] Make --interp= not override last set execution mode (mono/mono#14683)

It makes sense to pass --interp (--interp=-inline) while having another execution mode previously set up (like --full-aot-interp).

Cleanup code a little bit by killing mono_enable_interp which doesn't do much.

Commit migrated from https://github.com/mono/mono/commit/04f4db7b87c8f0c2c1987e007b458849d5d46238

5 years agoInfrastructure support / fixes for making compiler server the default (mono/mono...
Katelyn Gadd [Wed, 29 May 2019 06:54:44 +0000 (23:54 -0700)]
Infrastructure support / fixes for making compiler server the default (mono/mono#14279)

* Fix enabling the compiler server using autogen, and force it off if mcs is being used

* autogen updates

* Formatting fixes

* Fix vbcs getting turned on if unspecified even if mcs was selected

* Dynamically evaluate ENABLE_COMPILER_SERVER each time we compile instead of evaluating it once at some arbitrary point during makefile evaluation

* More detailed comment based on testing

* Handle the /shared option in genproj so it doesn't fail

* Raise basic profile check requirement to 6.2 and hopefully assert that named pipes work

* Default compiler server to off for now.

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

5 years ago[interp] Share more wrappers for different interp in signatures (mono/mono#14596)
Vlad Brezae [Tue, 28 May 2019 15:46:49 +0000 (18:46 +0300)]
[interp] Share more wrappers for different interp in signatures (mono/mono#14596)

[interp] Share more wrappers for different interp in signatures

The passed arguments are already considered to be gpointer in interp_entry and the real value is obtained using stackval_from_data. For types that are passed by value in a register the wrappers will be identical and we can share them.

This commit reduces the size used by interp_in wrappers (in fullaot-interp) by half. These wrappers still take a fair amount of size, which comes mainly from signatures including value types, which aren't shared.

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

5 years ago[sdks] Build static binaries for Android SDK and LLVM with MXE (mono/mono#14283)
Aleksey Kliger (λgeek) [Tue, 28 May 2019 12:56:51 +0000 (08:56 -0400)]
[sdks] Build static binaries for Android SDK and LLVM with MXE (mono/mono#14283)

We used to use the static MXE toolchain, but after switching to Homebrew, we
have to explicitly pass flags to build binaries that don't depend on the
MinGW32 GCC support libraries (libstdc++-6.dll, libwinpthread-1.dll and others)
when building the LLVM and Mono binaries.

The simplest approach is just to pass CMAKE_EXE_LINKER_FLAGS=-static to cmake
and LDFLAGS=-all-static to libtool.  The rest of the changes are just to make
it easier to do that by adding a configure flag and updating the SDKs
infrastructure.

We will also need an LLVM bump to actually build a new llvm archive with the
new build flags; until then, building Mono will provision an old build of LLVM
with the old build flags that still depends on libstdc++-6.dll.

---

An alternative approach instead of passing -all-static and -static would be to
probe for the assorted -static-libXYZ flags to GCC at configure time.  (For the
LLVM build we would need to hardcode them as that build doesn't go through
autoconf).  Right now Mono doesn't have any other DLL dependencies (other than
the core windows DLLs), so -all-static works just as well and is simpler.

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

5 years agoReduce stack size used by interpreter frame on Windows MSVC. (mono/mono#14659)
Johan Lorensson [Mon, 27 May 2019 21:55:52 +0000 (23:55 +0200)]
Reduce stack size used by interpreter frame on Windows MSVC. (mono/mono#14659)

Reduce stack size used by interpreter frame on Windows MSVC.

Interpreter frame was 1248 bytes in size under Windows MSVC. This was almost double the size of other platforms ~670 bytes. After investigating different constructs in interpreter switch statement in interp_exec_method_full, it turns out that local declared errors couldn't be reused over different case statements and added ~100 bytes each. Switching local declared errors to shared one, reduce the stack size down to ~670 bytes under Windows MSVC.

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

5 years agoIntroduce g_static_assert. (mono/mono#14651)
Jay Krell [Mon, 27 May 2019 19:33:46 +0000 (12:33 -0700)]
Introduce g_static_assert. (mono/mono#14651)

ifdef __cplusplus
define g_static_assert(x) static_assert (x, "")
else
define g_static_assert(x) g_assert (x)
endif

It is, granted, C++11, not C++98, and some C variations.

Commit migrated from https://github.com/mono/mono/commit/07c5ecdf7ba1987dc181d9b31ecbadd95224de91

5 years agowarning: 'emit_load' defined but not used [-Wunused-function] (mono/mono#14646)
Jay Krell [Mon, 27 May 2019 18:18:57 +0000 (11:18 -0700)]
warning: 'emit_load' defined but not used [-Wunused-function] (mono/mono#14646)

Rename emit_load_general to emit_load

Commit migrated from https://github.com/mono/mono/commit/15eb9f7ba1b7de945e78c8f35a89eb98b947c428

5 years agoMerge pull request mono/mono#14628 from lateralusX/lateralusX/interpreter-windows...
Johan Lorensson [Mon, 27 May 2019 15:00:06 +0000 (17:00 +0200)]
Merge pull request mono/mono#14628 from lateralusX/lateralusX/interpreter-windows-x64-mini-regression-support

Fix interpreter mini regression test on Windows x64.

Commit migrated from https://github.com/mono/mono/commit/164c257bb97c56bb89ea0d2c8b0eee3a44d99c0a

5 years agoBump roslyn dependency
Marek Safar [Mon, 27 May 2019 10:29:41 +0000 (12:29 +0200)]
Bump roslyn dependency

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

5 years agoAdd missing new files to Makefile.am, fix tarball build (mono/mono#14656)
Alexander Köplinger [Mon, 27 May 2019 13:21:26 +0000 (15:21 +0200)]
Add missing new files to Makefile.am, fix tarball build (mono/mono#14656)

They were added in https://github.com/mono/mono/pull/14427

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

5 years agoReview feedback.
lateralusX [Mon, 27 May 2019 07:23:02 +0000 (09:23 +0200)]
Review feedback.

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

5 years agoWiden MonoJumpInfo union to pointer-sized so mono_add_patch_info can just use target...
Jay Krell [Sun, 26 May 2019 16:30:18 +0000 (09:30 -0700)]
Widen MonoJumpInfo union to pointer-sized so mono_add_patch_info can just use target field blindly. (mono/mono#14642)

just use target field blindly.

Commit migrated from https://github.com/mono/mono/commit/393d7ef616dcabab70df06dda9efa8e2e9493321

5 years agoRemove MONO_PATCH_INFO_METHOD_REL. (mono/mono#14643)
Jay Krell [Sat, 25 May 2019 14:30:53 +0000 (07:30 -0700)]
Remove MONO_PATCH_INFO_METHOD_REL. (mono/mono#14643)

It is not used, and it had a larger than pointer field
where a pointer was required, at least for 32bit hosted cross builds.

Commit migrated from https://github.com/mono/mono/commit/489c40a548c656e83e36daab5f17c4128fa21f1c

5 years ago[jit] Also allow System.Runtime.CompilerServices.Unsafe intrinsics from the System...
Zoltan Varga [Sat, 25 May 2019 14:30:04 +0000 (10:30 -0400)]
[jit] Also allow System.Runtime.CompilerServices.Unsafe intrinsics from the System.Runtime.CompilerServices assembly, not just corlib. (mono/mono#14618)

* [jit] Also allow System.Runtime.CompilerServices.Unsafe intrinsics from the System.Runtime.CompilerServices assembly, not just corlib.

* [jit] Fix Unsafe.RefIsAddressLessThan()/RefIsAddressGreaterThan().

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

5 years ago[build] Provide in-tree llvm to mono correctly (mono/mono#14607)
Alexander Kyte [Sat, 25 May 2019 08:10:22 +0000 (04:10 -0400)]
[build] Provide in-tree llvm to mono correctly (mono/mono#14607)

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

5 years ago[coop] Transition various public APIs into an external/internal form to avoid unneces...
Ryan Lucia [Fri, 24 May 2019 23:09:00 +0000 (19:09 -0400)]
[coop] Transition various public APIs into an external/internal form to avoid unnecessary GC-unsafe calls (mono/mono#14427)

Relevant issue: mono/mono#14376

There are potentially more functions this can apply to, but this covers the ones listed in the issue and an extra one I found in the process.

Functions were either broken off into an external-only and internal version, or such a pair already existed and the internal version was moved from the source file to a separate `-internals` header, similarly to in mono/mono@3c74df566776f468366d96dd164dd1a6b3d780cc.

This gets slightly complicated with `mono_domain_set` and `mono_domain_set_internal`, both of which are currently public (thanks to mono/mono@4beada28924879ede55f3bf8b3f5b798d0f4637e) and have different signatures. Additionally, the latter does not actually include the gc-unsafe transition despite being public.
I've opted to introduce `mono_domain_set_fast` as the 'internal' version of `mono_domain_set`, to add the proper gc-unsafe transition to `mono_domain_set_internal`, and then to migrate internal usage to `mono_domain_set_internal_with_options`. As part of that I've marked `mono_domain_set_internal` as external only, which is unfortunate naming-wise but I believe the best option here without introducing API breakage.

Commit migrated from https://github.com/mono/mono/commit/96b1fd837d6caf1be1b657c0726af3b8caae7060

5 years ago[llvm] Use CoreCLR GC interop configuration (mono/mono#14598)
Alexander Kyte [Fri, 24 May 2019 20:55:50 +0000 (16:55 -0400)]
[llvm] Use CoreCLR GC interop configuration (mono/mono#14598)

[llvm] Use CoreCLR GC interop configuration

Since they're identical right now, we can use the coreclr configuration
to make our IR more easily analyzed by tools built around LLVM.

```
class CoreCLRGC : public GCStrategy {
public:
  CoreCLRGC() {
    UseStatepoints = true;
    // These options are all gc.root specific, we specify them so that the
    // gc.root lowering code doesn't run.
    InitRoots = false;
    NeededSafePoints = 0;
    UsesMetadata = false;
    CustomRoots = false;
  }

  Optional<bool> isGCManagedPointer(const Type *Ty) const override {
    // Method is only valid on pointer typed values.
    const PointerType *PT = cast<PointerType>(Ty);
    // We pick addrspace(1) as our GC managed heap.
    return (1 == PT->getAddressSpace());
  }
};

/// A GCStrategy for the Mono Runtime.
class MonoGC : public GCStrategy {
public:
  MonoGC() {
    UseStatepoints = true;
    // These options are all gc.root specific, we specify them so that the
    // gc.root lowering code doesn't run.
    InitRoots = false;
    NeededSafePoints = 0;
    UsesMetadata = false;
    CustomRoots = false;
  }
};
```

Source: https://github.com/mono/llvm/blob/mono/mono@64c0343537016c153894dc60316bd7b316b812c8/lib/CodeGen/BuiltinGCs.cpp#L105-L137

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

5 years agoCleanup: load_function_full -- avoid a string alloc/copy and cast. (mono/mono#14625)
Jay Krell [Fri, 24 May 2019 20:36:00 +0000 (13:36 -0700)]
Cleanup: load_function_full -- avoid a string alloc/copy and cast. (mono/mono#14625)

Cleanup: load_function_full -- avoid a string alloc/copy and cast.

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

5 years agoFix build warning for orig_method (mono/mono#14603)
Ryan Lucia [Fri, 24 May 2019 19:34:23 +0000 (15:34 -0400)]
Fix build warning for orig_method (mono/mono#14603)

Variable is only used here: https://github.com/mono/mono/blob/mono/mono@82a993124888d470d1057eae9546e5be76524dad/mono/mini/mini-trampolines.c#L743

Commit migrated from https://github.com/mono/mono/commit/76c45bc2cbbcbc3a6beafaeb477c7c42c1069af9

5 years ago[llvm] Remove JIT support for older llvm versions. (mono/mono#14605)
Zoltan Varga [Fri, 24 May 2019 18:56:01 +0000 (14:56 -0400)]
[llvm] Remove JIT support for older llvm versions. (mono/mono#14605)

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

5 years ago[merp] Don't leak g_getenv return value (mono/mono#14602)
Aleksey Kliger (λgeek) [Fri, 24 May 2019 17:55:54 +0000 (13:55 -0400)]
[merp] Don't leak g_getenv return value (mono/mono#14602)

[merp] Don't leak g_getenv return value

Coverity said:
```
     CID 1445100:  Resource leaks  (RESOURCE_LEAK)
     Failing to save or free storage allocated by "monoeg_g_getenv("MONO_CRASH_NOFILE")" leaks it.
```

Commit migrated from https://github.com/mono/mono/commit/94adfce7351093e0e726fea857c52f69062abb12

5 years ago[interp] Fix warning with coverity (mono/mono#14613)
Vlad Brezae [Fri, 24 May 2019 17:36:10 +0000 (20:36 +0300)]
[interp] Fix warning with coverity (mono/mono#14613)

[interp] Fix warning with coverity

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

5 years ago[merp] Add assertions against initing dumper from signal handler (mono/mono#13851)
Alexander Kyte [Fri, 24 May 2019 16:17:38 +0000 (12:17 -0400)]
[merp] Add assertions against initing dumper from signal handler (mono/mono#13851)

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

5 years agoFix interpreter mini regression test on Windows x64.
lateralusX [Fri, 24 May 2019 10:11:03 +0000 (12:11 +0200)]
Fix interpreter mini regression test on Windows x64.

First set of fixes to get the following tests working under interpreter
on Windows x64:

* mono/mini richeck
* mono/mini mixedcheck
* mono/mini fullaotmixedcheck
* mono/tests winx64structs.exe

Fixes are primarily related to Windows x64 ABI support in interpreter. Fixes
also makes sure our interpreter trampolines get unwind info making it possible
to debug through the trampolines on Windows x64.

Several fixes related to value types was needed, also fixed support for return
value types not fitting into registers, current implementation didn't return
passed in value type address in return register as mandated by both
System V and Win x64 ABI's.

Identified and fixed memory leak on every pinvoke from interpreter that needs stack.
Since Windows x64 ABI always use 32 bytes of stack allocated by caller, the
memory leak was hit on every pinvoke call.

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

5 years ago[loaded LLVM] Add several missing MONO_LLVM_INTERNAL (mono/mono#14589)
Jay Krell [Fri, 24 May 2019 09:58:26 +0000 (02:58 -0700)]
[loaded LLVM] Add several missing MONO_LLVM_INTERNAL (mono/mono#14589)

* [llvm] Remove unused default_mono_llvm_unhandled_exception.
It references mono_gchandle_get_target_internal which is not marked MONO_LLVM_INTERNAL
so attempts to run it will fail.

This is caught by linking wit -z now (https://github.com/mono/mono/pull/14562).

* [loaded LLVM] mono_debug_get_seq_points and mono_class_enum_basetype_internak MONO_LLVM_INTERNAL

* Mark mono_debug_method_lookup_location MONO_LLVM_INTERNAL.
Found by linking with -z now (https://github.com/mono/mono/pull/14562)
which we should probably do for this and other reasons.

* #include mono-compiler.h for MONO_LLVM_INTERNAL.

* [loaded LLVM] Mark mini_is_gsharedvt_variable_signature as MONO_LLVM_INTERNAL.
Found by https://github.com/mono/mono/pull/14562.

* Mark mono_print_ins MONO_LLVM_INTERNAL.

* mono_rgctx_info_type_to_str MONO_LLVM_INTERNAL

* [loaded LLVM] mono_compile_create_var MONO_LLVM_INTERNAL

* ifdef around use of MONO_LLVM_INTERNAL and hope

* remove include mono-compiler.h from public header to internal header

* MONO_API_NO_EXTERN_C mono_debug_method_lookup_location() instead of mono_debug_method_lookup_location() MONO_LLVM_INTERNAL to workaround possible lack of MONO_LLVM_INTERNAL.

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

5 years agoMake function pointers readonly. (mono/mono#14470)
Jay Krell [Fri, 24 May 2019 09:58:03 +0000 (02:58 -0700)]
Make function pointers readonly. (mono/mono#14470)

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

5 years ago[interp] set correct stack type on op_Implicit/op_Explicit intrinsics for native...
Bernhard Urban [Thu, 23 May 2019 16:56:16 +0000 (09:56 -0700)]
[interp] set correct stack type on op_Implicit/op_Explicit intrinsics for native types (mono/mono#14575)

[interp] set correct stack type on op_Implicit/op_Explicit intrinsics for native types

Needs some additional conversions which happen to be included by accident previously.

This fixes those warnings on amd64:
```
Test run:
image=/Users/lewurm/work/mono-dim-call/mono/mini/builtin-types.exe
BuiltinTests.test_0_nuint_fieldload: Store local stack type mismatch 0 1
BuiltinTests.test_0_much_casting: Store local stack type mismatch 0 1
Results: total tests: 84, all pass
Elapsed time: 0.026546 secs (0.026546, 0.000000)
```

and those warnings on armv7:
```
Test run: image=/mono/mono/mini/builtin-types.exe
BuiltinTests.test_0_nint_inc: 0011 arith type mismatch add.i4 0 1
BuiltinTests.test_0_nint_dec: 0011 arith type mismatch sub.i4 0 1
BuiltinTests.test_0_nint_implicit_decimal: 0034 arith type mismatch
add.i4 0 1
BuiltinTests.test_0_nuint_inc: 0011 arith type mismatch add.i4 0 1
BuiltinTests.test_0_nuint_dec: 0011 arith type mismatch sub.i4 0 1
BuiltinTests.test_0_nuint_implicit_decimal: 0034 arith type mismatch
add.i4 0 1
Results: total tests: 84, all pass
Elapsed time: 0.039214 secs (0.039214, 0.000000)
```

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

5 years ago[Android] Fix runtime loading of DSOs for 64-bit processes (mono/mono#14577)
monojenkins [Thu, 23 May 2019 14:56:37 +0000 (10:56 -0400)]
[Android] Fix runtime loading of DSOs for 64-bit processes (mono/mono#14577)

[Android] Fix runtime loading of DSOs for 64-bit processes

Context: https://github.com/xamarin/xamarin-android/issues/2780

On Android the executable for the application is going to be
`/system/bin/app_process{32,64}` depending on the application's architecture.
However, libraries for the different architectures live in different
subdirectories of `/system`: `lib` for 32-bit apps and `lib64` for 64-bit ones.
Thus appending `/lib` below will fail to load the DSO for a 64-bit app, even if
it exists there, because it will have a different architecture. The quickest fix
is to use `lib64` explicitly for 64-bit Android apps.

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

Backport of mono/mono#13281.

/cc @lambdageek @grendello

Commit migrated from https://github.com/mono/mono/commit/72eb2ee84a4f397c5887159e288894778ea316a9

5 years ago[netcore] add some intrinsics for interpreter (mono/mono#14547)
Bernhard Urban [Thu, 23 May 2019 14:00:49 +0000 (07:00 -0700)]
[netcore] add some intrinsics for interpreter (mono/mono#14547)

[netcore] add some intrinsics for interpreter

```console
$ MONO_ENV_OPTIONS='--interp' make -C netcore xtest-System.Runtime.Tests
Microsoft.DotNet.XUnitConsoleRunner v2.5.0 (64-bit .NET Core 3.0.0-preview5-27620-01)
  Discovering: System.Runtime.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Runtime.Tests (found 5266 of 5402 test cases)
  Starting:    System.Runtime.Tests (parallel test collections = on, max threads = 16)
[...]
  Finished:    System.Runtime.Tests
=== TEST EXECUTION SUMMARY ===
   System.Runtime.Tests  Total: 32485, Errors: 0, Failed: 23, Skipped: 2, Time: 126.432s
```
See failures here: https://gist.github.com/lewurm/c8372b0c7ba6a78cf8b7b7b8c7090820

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

5 years agoMerge pull request mono/mono#14549 from lateralusX/lateralusX/add-coop-config-windows
Johan Lorensson [Thu, 23 May 2019 07:21:43 +0000 (09:21 +0200)]
Merge pull request mono/mono#14549 from lateralusX/lateralusX/add-coop-config-windows

Add ability to use cooperative suspend in configure step.

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

5 years agoFix decoding of WRAPPER_SUBTYPE_ICALL_WRAPPER and WRAPPER_SUBTYPE_INTERP_LMF. (mono...
Jay Krell [Thu, 23 May 2019 05:43:19 +0000 (22:43 -0700)]
Fix decoding of WRAPPER_SUBTYPE_ICALL_WRAPPER and WRAPPER_SUBTYPE_INTERP_LMF. (mono/mono#14546)

Commit migrated from https://github.com/mono/mono/commit/8804dbac2752969105cf6e0a9939e0fd79531dec

5 years agoFix warning: (mono/mono#14529)
Jay Krell [Thu, 23 May 2019 05:43:05 +0000 (22:43 -0700)]
Fix warning: (mono/mono#14529)

aot-compiler.c: In function 'arch_init':
aot-compiler.c:1092:11: warning: unused variable 'has_custom_args' [-Wunused-variable]
  gboolean has_custom_args = !!acfg->aot_opts.llvm_llc;

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

5 years agoPlug leak of CustomAttribute initializer name (mono/mono#14544)
Marius Ungureanu [Thu, 23 May 2019 02:59:20 +0000 (05:59 +0300)]
Plug leak of CustomAttribute initializer name (mono/mono#14544)

* Plug leak of CustomAttribute initializer name

All the CustomAttribute initializer names (fields, property) except the last were leaked. Ensure all names are freed.

Fixes mono/mono#14543

* Apply suggestions from code review

Co-Authored-By: Martin Baulig <mabaul@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/fe74f621408d9fc822ec3b334f1bdb0a2b488cf2

5 years agoMerge pull request mono/mono#14552 from lewurm/interp-dimcall-fix
Larry Ewing [Thu, 23 May 2019 01:30:01 +0000 (20:30 -0500)]
Merge pull request mono/mono#14552 from lewurm/interp-dimcall-fix

[interp] add missing enum check on constrained callvirt

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

5 years agoClose two race conditions. (mono/mono#14510)
Jay Krell [Wed, 22 May 2019 23:47:29 +0000 (16:47 -0700)]
Close two race conditions. (mono/mono#14510)

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

5 years ago[driver] add --version=number (mono/mono#14538)
Bernhard Urban [Wed, 22 May 2019 16:49:38 +0000 (09:49 -0700)]
[driver] add --version=number (mono/mono#14538)

* [driver] add --version-number

Useful for third parties consuming the version number of mono.

* s/--version-number/--version=number/g

* add man page entry

Commit migrated from https://github.com/mono/mono/commit/574d87ca9ff47c99456174884b4625a406e7590c

5 years agoMore information to PowerPC assertion failure. (mono/mono#14569)
Jay Krell [Wed, 22 May 2019 12:27:40 +0000 (05:27 -0700)]
More information to PowerPC assertion failure. (mono/mono#14569)

Commit migrated from https://github.com/mono/mono/commit/5334e32de968993725896162e22c1760ad31418f

5 years agoAdd more information to a stackless faulting community line. (mono/mono#14566)
Jay Krell [Wed, 22 May 2019 11:17:53 +0000 (04:17 -0700)]
Add more information to a stackless faulting community line. (mono/mono#14566)

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

5 years ago[PowerPC] Fix compile error. (mono/mono#14564)
Jay Krell [Wed, 22 May 2019 11:15:28 +0000 (04:15 -0700)]
[PowerPC] Fix compile error. (mono/mono#14564)

Commit migrated from https://github.com/mono/mono/commit/74faf3997129465aad7b188903d95f7b33f2822c

5 years ago[netcore] Add Microsoft.Private.CoreFx.OOB package to corefx-restore.csproj (mono...
Egor Bogatov [Wed, 22 May 2019 10:32:05 +0000 (03:32 -0700)]
[netcore] Add Microsoft.Private.CoreFx.OOB package to corefx-restore.csproj  (mono/mono#14559)

* Add Microsoft.Private.CoreFx.OOB package

* Add GC.GetTotalAllocatedBytes stub

* Add missing icalls

* Add more tests to ignore

* Update GC.cs

* Add more tests to ignore

* Update Monitor.cs

Commit migrated from https://github.com/mono/mono/commit/64fe6a054ca3702677bd001056388341c87bbd91

5 years ago[netcore] Set System.Private.Corlib AssemblyVersion to 4.0.0.0 (mono/mono#14556)
Egor Bogatov [Wed, 22 May 2019 07:37:17 +0000 (00:37 -0700)]
[netcore] Set System.Private.Corlib AssemblyVersion to 4.0.0.0 (mono/mono#14556)

* clean up

* cleanup

* bump assembly version

Commit migrated from https://github.com/mono/mono/commit/36193f53781399a299a7d7a4032f32dc532ea37e

5 years ago[netcore] Fix PointerTests (mono/mono#14557)
Egor Bogatov [Wed, 22 May 2019 06:24:40 +0000 (23:24 -0700)]
[netcore] Fix PointerTests (mono/mono#14557)

* Fix PointerTests

* Update CoreFX.issues.rsp

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

5 years ago[jit] Fix signed/unsigned comparisons in JitHelpers.EnumCompareTo () intrinsic. ...
Zoltan Varga [Wed, 22 May 2019 00:17:50 +0000 (20:17 -0400)]
[jit] Fix signed/unsigned comparisons in JitHelpers.EnumCompareTo () intrinsic. (mono/mono#14553)

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

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

5 years agoMONO_PATCH_INFO_JIT_ICALL cleanup (mono/mono#14545)
Jay Krell [Tue, 21 May 2019 21:04:02 +0000 (14:04 -0700)]
MONO_PATCH_INFO_JIT_ICALL cleanup (mono/mono#14545)

The most important point of the "temporary" aspect, esp. given
the complete conversion, is renaming MONO_PATCH_INFO_JIT_ICALL to MONO_PATCH_INFO_JIT_ICALL_ID.
Any accidental or merged MONO_PATCH_INFO_JIT_ICALL will fail to compile.

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

5 years ago[crash] Don't waitpid() if fork() fails (mono/mono#14539)
Alexander Kyte [Tue, 21 May 2019 20:20:30 +0000 (16:20 -0400)]
[crash] Don't waitpid() if fork() fails (mono/mono#14539)

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

5 years ago[crash] Handle OOM/blocked allocation during crash dumper (mono/mono#14540)
Alexander Kyte [Tue, 21 May 2019 20:20:15 +0000 (16:20 -0400)]
[crash] Handle OOM/blocked allocation during crash dumper (mono/mono#14540)

* [crash] Remove typo from crash sub-header

* [crash] Use error path that returns nonzero status

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

5 years ago[interp] add missing enum check on constrained callvirt
Bernhard Urban [Tue, 21 May 2019 14:31:11 +0000 (16:31 +0200)]
[interp] add missing enum check on constrained callvirt

This detail got lost when the code was duplicated here: https://github.com/mono/mono/pull/13154/files#diff-f115ce23fba6528256a47e2b7e8b0a19R1611

Fixes `mono/tests/dim-constrainedcall.il` on the interpreter. This PR will enable it: https://github.com/mono/mono/pull/14166

Commit migrated from https://github.com/mono/mono/commit/539e3f8546b77fec2b5888d66b1e05bfa6bcbde8

5 years agoInitial icall-def.h / icall-def-netcore.h split. (mono/mono#14489)
Jay Krell [Tue, 21 May 2019 12:50:09 +0000 (05:50 -0700)]
Initial icall-def.h / icall-def-netcore.h split. (mono/mono#14489)

* Copy icall-def.h to icall-def-core.h.

* Manually preprocess icall-def.h vs. icall-def-core.h.
The only common part in this construction is the JIT icalls at the end.
There much overlap, now duplicated.

* Remove JIT icalls fro icall-def-core.h.

* Merge icall-def-core.h with master.

* Merge icall-def.h with master.

* Rename icall-def-core.h to icall-def-netcore.h.

* Remove more unused icalls

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

5 years agoAdd ability to use cooperative suspend in configure step.
lateralusX [Tue, 21 May 2019 11:48:29 +0000 (13:48 +0200)]
Add ability to use cooperative suspend in configure step.

Needed in order to setup CI lanes using --enable-cooperative-suspend.

Commit migrated from https://github.com/mono/mono/commit/70b26c9bc3f53fc503ba3d009a00c16f645d991f

5 years agoRemoving some remoting and multi-appdomain APIs on wasm and the AOT test profiles.
Martin Baulig [Tue, 14 May 2019 23:30:01 +0000 (16:30 -0700)]
Removing some remoting and multi-appdomain APIs on wasm and the AOT test profiles.

Build / profile changes:
------------------------

* `build/profiles/testing_aot_common.make`: define `DISABLE_REMOTING = yes` and
  `NO_MULTIPLE_APPDOMAINS = yes`.

* `mcs/class/corlib/Makefile`: check `DISABLE_REMOTING` when setting
  `REFERENCE_SOURCES_FLAGS` (and don't define `FEATURE_REMOTING`, `MONO_COM`
   and `FEATURE_COMINTEROP`).

* added new `testing_aot_common_corlib.dll.exclude.sources`.  Several types in
  the `System.Runtime.Remoting.Messaging` namespace are used by the runtime in
  non-remoting scenarios, so those need to be preserved.
  For all other remoting namespaces, we only need a few stripped down stub versions
  of the some of the types; those have been added to a new `legacy` directory, so
  we can wildcard-exclude all the files here.

* added new `testing_aot_common_corlib.dll.sources`; this currently only contains
  `legacy/*.cs` to list above mentioned stub versions.

* added new `testing_aot_common_corlib_test.dll.exclude.sources` as a common test
  excludes file.

API Changes (conditional to `DISABLE_REMOTING`):
------------------------------------------------

* `mcs/class/corlib/legacy/`: add stub-versions for some of the remoting-related
  classes that are used by the runtime (so we can't completely remove those types):

  - `System.MarshalByRefObject`.
  - `System.Runtime.Remoting.IRemotingTypeInfo`.
  - `System.Runtime.Remoting.ObjectHandle`.
  - `System.Runtime.Remoting.RemotingServices`.
  - `System.Runtime.Remoting.Activation.ActivationServices`.
  - `System.Runtime.Remoting.Contexts.Context`.
  - `System.Runtime.Remoting.Messaging.ILogicalThreadAffinative`.
  - `System.Runtime.Remoting.Messaging.LogicalCallContext`.
  - `System.Runtime.Remoting.Proxies.TransparentProxy`.
  - `System.Runtime.Remoting.Proxies.RealProxy`.

  some of these have fields that need to be preserved; these are marked with
  appropriate `#region` pragmas.

All changes below are conditional to `DISABLE_REMOTING`.

* `System.Runtime.Remoting.Messaging.AsyncResult`: this class is used by some of
  the async code, so we can't completely remove it.  However, we can remove the
  `MonoMethodMessage call_message` field when `DISABLE_REMOTING`.

* `System.Runtime.Remoting.Messaging.MonoMethodMessage`: this class is also used
  by some runtime code and thus needs to be preserved. However, when `DISABLE_REMOTING`
  is defined, then we make some changes to it:
  - remove all iterfaces (`IMethodCallMessage`, `IMethodReturnMessage`, and `IInternalMessage`).
  - `Properties` throws `PlatformNotSupportedException`.

* `System.Runtime.InteropServices.Marshal`: disable some COM-related code.

* `System.Threading.Thread`: remove `CurrentContext` property.

* `System.Threading.ExecutionContext`: adjust conditional logic; don't define
  `FEATURE_REMOTING` if `DISABLE_REMOTING`.

* `System.Activator`: add `DISABLE_REMOTING` to the existing
   `#if FEATURE_REMOTING || MOBILE_LEGACY` conditional in this class.

* `System.AppDomain`: since we only have one domain, `DefaultDomain` will always
   return the root domain; comment out the call to `RemotingServices.GetDomainProxy`
   as well as some internal methods.

* `System.__ComObject`: stub out on `DISABLE_REMOTING` as well as `!FULL_AOT_RUNTIME`.

* `System.Runtime.Serialization.Formatters.Binary.BinaryFormatter`: adjust `IFormatter`
  versus `IRemotingFormatter` interface logic to use the former when `DISABLE_REMOTING`.

* `System.Runtime.Serialization.Formatters.Binary.BinaryObjectReader`: adjust existing
  `#if FEATURE_REMOTING || MOBILE_LEGACY` conditional to add `DISABLE_REMOTING` to it.

* `System.Diagnostics.CorrelationManager`: comment out some `CallContext.LogicalGetData()`
  and `CallContext.LogicalSetData`.

* `System.Diagnostics.TraceEventCache`: likewise.

Test changes:
-------------

* `mono/tests/Makefile.am`: conditionally disable some remoting tests.

* `corlib/Test/System.Runtime.Serialization/SerializationTest.cs`: conditionally
   disable all tests requiring remoting.

* `corlib/Test/System/ActivatorTest.cs`: same; trying to preserve as much as possible
  in this test.

* added some `DISABLE_REMOTING` and `DISABLE_SECURITY` conditionals to some of the tests.

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

5 years agoReplace string/hash-based MONO_PATCH_INFO_JIT_ICALL with enum-based MONO_PATCH_INFO_J...
Jay Krell [Tue, 21 May 2019 04:16:36 +0000 (21:16 -0700)]
Replace string/hash-based MONO_PATCH_INFO_JIT_ICALL with enum-based MONO_PATCH_INFO_JIT_ICALL_ID. (mono/mono#14512)

* Replace string/hash-based MONO_PATCH_INFO_JIT_ICALL with enum-based MONO_PATCH_INFO_JIT_ICALL_ID.

* Reconvert mono-llvm.c after merge with master.

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

5 years agoFix leak in mono_parse_options (mono/mono#14533)
Marius Ungureanu [Mon, 20 May 2019 22:25:55 +0000 (01:25 +0300)]
Fix leak in mono_parse_options (mono/mono#14533)

Fix leak in mono_parse_options

When MONO_ENV_OPTIONS is null, we would leak the array and buffer

<!--
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/57a3b24f750b4d4509b5a2a7c8fcc25f72d732d8

5 years ago[llvm] Fix patching of calls from LLVM JITted code. (mono/mono#14520)
Zoltan Varga [Mon, 20 May 2019 14:22:26 +0000 (10:22 -0400)]
[llvm] Fix patching of calls from LLVM JITted code. (mono/mono#14520)

* [runtime] Fix mono_icall_get_wrapper_full () to always compile the wrapper even if a trampoline was created previously.

* [jit] Add a mini_patch_llvm_jit_callees () function to patch callsite variables for LLVM JIT.

* [llvm] Patch LLVM JIT callees in trampolines as well. Patching after a method is compiled is not enough, since new callsites can be created after a method has been compiled.

* [llvm] Cleanup calls from JITted code. Compile referenced jit icall wrappers immediately, since the calls will not be patched.

* Add a missing MONO_LLVM_INTERNAL.

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

5 years ago[arm] one more attempt to fix slotsize issue on llvmonly (mono/mono#14444)
Bernhard Urban [Mon, 20 May 2019 10:09:35 +0000 (03:09 -0700)]
[arm] one more attempt to fix slotsize issue on llvmonly (mono/mono#14444)

* [arm] one more attempt to fix slotsize issue on llvmonly

Regression of https://github.com/mono/mono/pull/12992 & https://github.com/mono/mono/pull/14362

In the end, the actual fix boils down to:
```patch
--- a/mono/mini/mini-arm.c
+++ b/mono/mini/mini-arm.c
@@ -2374,7 +2374,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig)
                                lainfo->nslots = ALIGN_TO (ainfo->struct_size, 8) / 8;
                                lainfo->esize = 8;
                        } else {
-                               lainfo->nslots = ainfo->struct_size / sizeof (target_mgreg_t);
+                               lainfo->nslots = ALIGN_TO (ainfo->struct_size, sizeof (target_mgreg_t)) / sizeof (target_mgreg_t);
                                lainfo->esize = 4;
                        }
                        break;
```

Tested on `xamarin-macios/arm64_32-v3` branch:
* mscorlib
* mini
* dont link
* monotouch tests
* and a modified version of https://github.com/mono/mono/issues/8486#issuecomment-414365860 (added larger structs too)

with each device, Watch Series 3 (`armv7k`) and Watch Series 4 (`arm64_32`).

I hope that is the last iteration on this.

* remove arm64_32_abi

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

5 years agoWork toward JIT icall hash removal. (mono/mono#14508)
Jay Krell [Sun, 19 May 2019 21:15:08 +0000 (14:15 -0700)]
Work toward JIT icall hash removal. (mono/mono#14508)

i.e. when CEE_MONO_JIT_ICALL_ADDR takes enum instead of func.

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

5 years ago[netcore] Merge all *.rsp files into CoreFX.issues.rsp (mono/mono#14513)
Egor Bogatov [Sun, 19 May 2019 05:15:32 +0000 (22:15 -0700)]
[netcore] Merge all *.rsp files into CoreFX.issues.rsp (mono/mono#14513)

* merge rsp files into CoreFX.issues.rsp

* Update CoreFX.issues.rsp

* Update CoreFX.issues.rsp

* clean up

* Update CoreFX.issues.rsp

* download OS specific tests

* Update Makefile

* Add comments for build-local-corefx-test-% rule

Commit migrated from https://github.com/mono/mono/commit/616e06225a462e6749901f70a76ad4a3a845c009

5 years ago[netcore] Fix Math.ILogB corner cases (mono/mono#14500)
Egor Bogatov [Sun, 19 May 2019 03:59:38 +0000 (20:59 -0700)]
[netcore] Fix Math.ILogB corner cases (mono/mono#14500)

* Fix ILogb corner cases

* remove redundant tabs

* Add RSP for S.R.Extensions

* remove autotools magic

* add more comments

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

5 years ago[netcore] Respect attributes defined on parameters in Delegates (mono/mono#14468)
Egor Bogatov [Sun, 19 May 2019 03:58:20 +0000 (20:58 -0700)]
[netcore] Respect attributes defined on parameters in Delegates (mono/mono#14468)

* Respect attributes defined on Delegates

* remove 'var's

* Unwrap System.Reflection.Tests.PointerTests.*

Commit migrated from https://github.com/mono/mono/commit/29938ada1f2b28b4b79070d889e44dbfd3056d47

5 years agoMake mono_jit_icall_info MONO_LLVM_INTERNAL. (mono/mono#14525)
Jay Krell [Sun, 19 May 2019 03:38:46 +0000 (20:38 -0700)]
Make mono_jit_icall_info MONO_LLVM_INTERNAL. (mono/mono#14525)

Commit migrated from https://github.com/mono/mono/commit/7601045796a805bac4265577c15c0a90c1c7003e

5 years agoAdd missing dependency on $(srcdir)/genmdesc.py. (mono/mono#14515)
Jay Krell [Sat, 18 May 2019 21:18:47 +0000 (14:18 -0700)]
Add missing dependency on $(srcdir)/genmdesc.py. (mono/mono#14515)

Commit migrated from https://github.com/mono/mono/commit/24c0f17b1ca2560886737651bbb5a3b202ca7ee5

5 years agoMerge pull request mono/mono#14490 from vargaz/bump-emsdk
Larry Ewing [Sat, 18 May 2019 20:31:55 +0000 (13:31 -0700)]
Merge pull request mono/mono#14490 from vargaz/bump-emsdk

[wasm] Bump emscripten to 1.38.31.

Commit migrated from https://github.com/mono/mono/commit/73baf1b2912aff20ea09a29b693f6e4f9640cab6

5 years ago[interp] disable inlining for built-in types (mono/mono#14501)
Bernhard Urban [Sat, 18 May 2019 18:45:58 +0000 (11:45 -0700)]
[interp] disable inlining for built-in types (mono/mono#14501)

[interp] disable inlining for built-in types

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

Commit migrated from https://github.com/mono/mono/commit/45a1c98df895195dd86d7912aed857984484aef8

5 years agoReduce JIT icall hash use. (mono/mono#14507)
Jay Krell [Sat, 18 May 2019 14:05:58 +0000 (07:05 -0700)]
Reduce JIT icall hash use. (mono/mono#14507)

* Reduce JIT icall hash use.

* PR: Rename mono_jit_icall_info_at to mono_find_jit_icall_info.

* Use enum instead of int, and update comment to reality (the assert is arguably leniently off by one.)

* Cast integer to enum for C++.

* More int vs. enum, and use two variables, and const.

* Undo a little fishing for CI failure.

Commit migrated from https://github.com/mono/mono/commit/3142f7d54dcdffd46e56e27a9976279092dcadc9

5 years agoMerge pull request mono/mono#14488 from jeromelaban/dev/jela/wasm-dlopen
Larry Ewing [Fri, 17 May 2019 20:11:31 +0000 (13:11 -0700)]
Merge pull request mono/mono#14488 from jeromelaban/dev/jela/wasm-dlopen

[Wasm] Expand support for dynamic linking

Commit migrated from https://github.com/mono/mono/commit/63b16ae32f376fbd39997a893ba8028d9471f987

5 years agoMerge pull request mono/mono#14498 from lateralusX/lateralusX/fix-llvm-build-error
Johan Lorensson [Fri, 17 May 2019 16:26:37 +0000 (09:26 -0700)]
Merge pull request mono/mono#14498 from lateralusX/lateralusX/fix-llvm-build-error

Fix Windows Mono LLVM build error on nightly master build.

Commit migrated from https://github.com/mono/mono/commit/42bc7daeb86535478d0c5957440842fd5843ebc8

5 years ago[wasm] Avoid sharing C icall functions between icalls, in wasm to avoid calling them...
Zoltan Varga [Fri, 17 May 2019 04:53:55 +0000 (00:53 -0400)]
[wasm] Avoid sharing C icall functions between icalls, in wasm to avoid calling them with incorrect signatures. (mono/mono#14493)

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

5 years ago[netcore] Build/upload Windows runtime nupkg (mono/mono#14506)
Jo Shields [Fri, 17 May 2019 00:36:31 +0000 (17:36 -0700)]
[netcore] Build/upload Windows runtime nupkg (mono/mono#14506)

* [netcore] Switch build properties from /p: to -p: due to MSYS2/dotnet bug

* [netcore] Switch from nuget pack to dotnet pack

* [netcore] Add Windows x64 build

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

5 years agoWork towards removing JIT icall hashing. (mono/mono#14474)
Jay Krell [Thu, 16 May 2019 14:12:34 +0000 (07:12 -0700)]
Work towards removing JIT icall hashing. (mono/mono#14474)

* Work towards removing JIT icall hashing.

* PR: Use enums instead of pointers.

* Fix int/enum mismatch.

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

5 years agoFix Windows Mono LLVM build error on nightly master build.
lateralusX [Thu, 16 May 2019 00:47:57 +0000 (02:47 +0200)]
Fix Windows Mono LLVM build error on nightly master build.

Commit migrated from https://github.com/mono/mono/commit/142d1a9ca02d407b2fe385c78b08cbda897b694e

5 years ago[netcore] Exclude some unused icalls (mono/mono#14475)
Filip Navara [Wed, 15 May 2019 22:29:01 +0000 (00:29 +0200)]
[netcore] Exclude some unused icalls (mono/mono#14475)

* [netcore] Exclude unused native locale icalls

* Fix builds with mono_feature_disable_sockets, currently not enabled by configure script

* [netcore] Don't compile in System.IO icall in netcore profile

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

5 years agoMake genmdesc output better typed and more readable. (mono/mono#14477)
Jay Krell [Wed, 15 May 2019 17:16:25 +0000 (10:16 -0700)]
Make genmdesc output better typed and more readable. (mono/mono#14477)

* Make genmdesc output better typed and more readable -- almost hand-maintainable
but no clear route to actually hand-maintainable.

* Replace != with < and undo debug code.

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

5 years agoAdd two asserts to mono_emit_jit_icall. (mono/mono#14459)
Jay Krell [Tue, 14 May 2019 06:22:27 +0000 (23:22 -0700)]
Add two asserts to mono_emit_jit_icall. (mono/mono#14459)

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

5 years ago[merp] Add an env var to disable all mono_crash files (mono/mono#14407)
Alexander Kyte [Mon, 13 May 2019 13:36:43 +0000 (09:36 -0400)]
[merp] Add an env var to disable all mono_crash files (mono/mono#14407)

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

5 years agoconfigure: check for c++ availability (mono/mono#14461)
Angelo Compagnucci [Sun, 12 May 2019 22:43:01 +0000 (00:43 +0200)]
configure: check for c++ availability (mono/mono#14461)

Since commit d8af775, c++ compiler is required to compile.
This patch checks if the c++ compiler is available as soon as possible
and returns an error in case it is not found.

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

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Commit migrated from https://github.com/mono/mono/commit/f29eae3e354b6d94b69d60fa6b7b59c229bc893e

5 years agoConvert rest of JIT icall registration to static info. (mono/mono#14455)
Jay Krell [Sun, 12 May 2019 01:42:05 +0000 (18:42 -0700)]
Convert rest of JIT icall registration to static info. (mono/mono#14455)

* Convert rest of JIT icall registration to static storage.

* PR: Expand macros manually (they can actually emcompass more, not less, another time).

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

5 years agohide props
Egor Bogatov [Fri, 10 May 2019 17:14:46 +0000 (20:14 +0300)]
hide props

Commit migrated from https://github.com/mono/mono/commit/1049f06668e5190def796b47404ed03f163c0a86

5 years ago[arm64] set MONO_ARCH_HAVE_UNWIND_BACKTRACE for watch4 (mono/mono#14440)
Bernhard Urban [Fri, 10 May 2019 18:05:54 +0000 (20:05 +0200)]
[arm64] set MONO_ARCH_HAVE_UNWIND_BACKTRACE for watch4 (mono/mono#14440)

[arm64] set MONO_ARCH_HAVE_UNWIND_BACKTRACE for watch4

Fixes a couple of mscorlib test failures, failing with
> Stack walks are not supported on this platform

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

5 years agoRemove some malloc from JIT icall registration. (mono/mono#14431)
Jay Krell [Fri, 10 May 2019 12:36:30 +0000 (05:36 -0700)]
Remove some malloc from JIT icall registration. (mono/mono#14431)

Disallow duplicate JIT icall registration (by name, address, or new static info storage).

Commit migrated from https://github.com/mono/mono/commit/04252ff72451b0dd21ba4cdd3056ab0bd84151d0

5 years agoMerge pull request mono/mono#14425 from lateralusX/lateralusX/fix-profiler-on-windows
Johan Lorensson [Fri, 10 May 2019 10:50:28 +0000 (12:50 +0200)]
Merge pull request mono/mono#14425 from lateralusX/lateralusX/fix-profiler-on-windows

Add log profiler support to Mono MSVC build.

Commit migrated from https://github.com/mono/mono/commit/991c7b6a61101b0d7eb955b4287d116ec99ba2b8

5 years agoMerge pull request mono/mono#14332 from lateralusX/lateralusX/add-llvm-windows-msvc...
Johan Lorensson [Fri, 10 May 2019 08:33:43 +0000 (10:33 +0200)]
Merge pull request mono/mono#14332 from lateralusX/lateralusX/add-llvm-windows-msvc-build-packaging-support

Add LLVM Windows MSVC build/packaging/archive/download support.

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

5 years ago[netcore] Enable MSVC builds of Mono w/ ENABLE_NETCORE (mono/mono#14418)
Filip Navara [Fri, 10 May 2019 08:26:44 +0000 (10:26 +0200)]
[netcore] Enable MSVC builds of Mono w/ ENABLE_NETCORE (mono/mono#14418)

* Enable MSVC builds of Mono w/ ENABLE_NETCORE

* Fix non-netcore build

* Move the ENABLE_NETCORE definition to config.h where it belongs

* Replace .def with linker #pragmas

* TARGET_WIN32 -> HOST_WIN32 && HOST_X86

* Pick up MONO_ENABLE_NETCORE from cygconfig.h

* Make `./configure --with-core=only` MSVC builds working

* Include netcore sources unconditionally, move the condition into the .c file

* Fix MSVC C++ netcore build on Win32

Commit migrated from https://github.com/mono/mono/commit/643b2ebfc6ad8a7cb2c21d3cac1a89ca3ceb3c9f

5 years agoFix minor build warning (mono/mono#14426)
Ryan Lucia [Fri, 10 May 2019 08:06:00 +0000 (04:06 -0400)]
Fix minor build warning (mono/mono#14426)

Fix minor build warning

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

5 years ago[corlib] Change the RuntimeModule.GetGuid and RuntimeAssembly.GetAotId icalls to...
Zoltan Varga [Fri, 10 May 2019 00:34:55 +0000 (20:34 -0400)]
[corlib] Change the RuntimeModule.GetGuid and RuntimeAssembly.GetAotId icalls to return a byte array. (mono/mono#14393)

* [corlib] Change the RuntimeModule.GetGuid and RuntimeAssembly.GetAotId icalls to return a byte array instead of a string, so it doesn't have to be parsed by the Guid ctor. Also allocate the arrays in the c# code and pass them to the icalls.

Commit migrated from https://github.com/mono/mono/commit/29fb43eb0905ec7a9968f3ea08325a2c61fba82c

5 years agoDo not allocate handles in ReleaseMutex. (mono/mono#14403)
Jay Krell [Thu, 9 May 2019 18:54:56 +0000 (11:54 -0700)]
Do not allocate handles in ReleaseMutex. (mono/mono#14403)

* Do not allocate handles in ReleaseMutex.
Take advantage of thread/internal_thread maturity/pinning.

There are arguments for and against this.

It is arguably better to use handles everywhere.
But it is dubious to require an allocation to release a lock.
Releasing a lock should be infallible.
And surviving low memory shouldn't be a lost cause, imho..

This diff could also be viewed as an opportunistic cycle/size optimization
and be placed under ifdef -- ifdef THREAD_ALWAYS_PINNED orsuch.

This is an alternative to https://github.com/mono/mono/pull/14397.

* PR: Move comments.

Commit migrated from https://github.com/mono/mono/commit/77ab9ee0b884854e877f50f131620ecd7191e4a2

5 years agoAdd log profiler support to Mono MSVC build.
lateralusX [Thu, 9 May 2019 16:33:00 +0000 (18:33 +0200)]
Add log profiler support to Mono MSVC build.

Several fixes to the log profiler in order to work on Windows.

* Add new dynamic library project to build log profiler on Windows MSVC.
* Fix dependecy between log profiler and Mono.
* Rewrite command pipe logic on Windows since it's not supported to select
  on both sockets and pipes.
* Several additional socket fixes needed for log profiler to work on Windows.

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

5 years ago[netcore] Fix HideDetectionHappensBeforeBindingFlagChecks (mono/mono#14336)
Egor Bogatov [Thu, 9 May 2019 16:27:24 +0000 (19:27 +0300)]
[netcore] Fix HideDetectionHappensBeforeBindingFlagChecks (mono/mono#14336)

* Hide public property in Base if there is a private in Derived

* Update excludes-System.Runtime.Tests.rsp

* Update RuntimePropertyInfo.cs

Commit migrated from https://github.com/mono/mono/commit/735489b10bc6f839ddde7d8debea92c70d506b67

5 years ago[metadata] use handle stack in mono_runtime_object_init_handle (mono/mono#14399)
Bernhard Urban [Thu, 9 May 2019 15:31:24 +0000 (17:31 +0200)]
[metadata] use handle stack in mono_runtime_object_init_handle (mono/mono#14399)

Fixes this crash on watchOS with llvmonly:
```
(lldb) bt 35
* thread %1, name = 'tid_303', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x4d55545c)
  * frame %0: 0x01ab81de mscorlibtests`sgen_vtable_get_descriptor(vtable=0x4d555458) at sgen-client-mono.h:29:33
    frame %1: 0x01a9e278 mscorlibtests`major_copy_or_mark_object_canonical at sgen-marksweep-drain-gray-stack.h:158:10
    frame %2: 0x01a9debc mscorlibtests`major_copy_or_mark_object_canonical(ptr=0x182f260c, queue=0x01dd4894) at sgen-marksweep.c:1363
    frame %3: 0x019d31f2 mscorlibtests`mono_handle_stack_scan(stack=0x17e200b0, func=(mscorlibtests`major_copy_or_mark_object_canonical + 1 at sgen-marksweep.c:1362), gc_data=0x01dd4894, precise=1, check=1) at handle.c:340:5
    frame %4: 0x01a45680 mscorlibtests`sgen_client_scan_thread_data(start_nursery=0x00000000, end_nursery=0xffffffff, precise=1, ctx=ScanCopyContext @ 0x01dd4580) at sgen-mono.c:2254:5
    frame %5: 0x01a93e80 mscorlibtests`job_scan_thread_data(worker_data_untyped=0x00000000, job=0x0511c004) at sgen-gc.c:1416:2
    frame %6: 0x01adef0a mscorlibtests`sgen_workers_enqueue_job(generation=1, job=0x0511c004, enqueue=0) at sgen-workers.c:184:3
    frame %7: 0x01a9334a mscorlibtests`enqueue_scan_from_roots_jobs(gc_thread_gray_queue=0x01dd4894, heap_start=0x00000000, heap_end="", ops=0x01c6aaac, enqueue=0) at sgen-gc.c:1661:2
    frame %8: 0x01a94d16 mscorlibtests`major_copy_or_mark_from_roots(gc_thread_gray_queue=0x01dd4894, old_next_pin_slot=0x01dd4864, mode=COPY_OR_MARK_FROM_ROOTS_SERIAL, object_ops_nopar=0x01c6aaac, object_ops_par=0x00000000) at sgen-gc.c:2070:2
    frame %9: 0x01a95658 mscorlibtests`major_start_collection(gc_thread_gray_queue=0x01dd4894, reason="LOS overflow", concurrent=0, old_next_pin_slot=0x01dd4864) at sgen-gc.c:2189:2
    frame %10: 0x01a92ccc mscorlibtests`major_do_collection(reason="LOS overflow", is_overflow=0, forced=1) at sgen-gc.c:2362:2
    frame %11: 0x01a8e9ce mscorlibtests`sgen_perform_collection_inner(requested_size=21616, generation_to_collect=1, reason="LOS overflow", forced_serial=1, stw=1) at sgen-gc.c:2563:14
    frame %12: 0x01a8e76c mscorlibtests`sgen_perform_collection(requested_size=21616, generation_to_collect=1, reason="LOS overflow", forced_serial=1, stw=1) at sgen-gc.c:2640:2
    frame %13: 0x01a8e73e mscorlibtests`sgen_ensure_free_space(size=21616, generation=1) at sgen-gc.c:2514:2
    frame %14: 0x01a99184 mscorlibtests`sgen_los_alloc_large_inner(vtable=0x185749d0, size=21616) at sgen-los.c:380:2
    frame %15: 0x01a81c0a mscorlibtests`sgen_alloc_obj_nolock(vtable=0x185749d0, size=21616) at sgen-alloc.c:172:16
    frame %16: 0x01a44940 mscorlibtests`mono_gc_alloc_vector(vtable=0x185749d0, size=21616, max_length=900) at sgen-mono.c:1317:20
    frame %17: 0x00a5b408 mscorlibtests`aot_wrapper_icall_mono_gc_alloc_vector + 102
    frame %18: 0x00a56818 mscorlibtests`mscorlib_wrapper_alloc_object_AllocVector_intptr_intptr + 324
    frame %19: 0x01092b26 mscorlibtests`mscorlibtests1_MonoTests_System_DecimalTest2__ctor + 7286
    frame %20: 0x00a78912 mscorlibtests`aot_wrapper_gsharedvt_out_sig_pinvoke_void_this_ + 28
    frame %21: 0x00a4a4d2 mscorlibtests`mscorlib_wrapper_runtime_invoke_object_runtime_invoke_sig_void_intptr_intptr_object_intptr_intptr_intptr + 312
```

The hint here was that the crash happened in `mono_handle_stack_scan ()` and inspecting the handle stack there. After enabling `MONO_HANDLE_TRACK_OWNER` and `MONO_HANDLE_TRACK_SP` in `handle.h`, I got this:
```
warning: Handle 0x17886a0c (object = 0x16e73fd0) (allocated from "../../../../../mono/metadata/object.c:3182") is leaking.

    frame %1: 0x019833ba mscorlibtests`mono_handle_new(obj=0x01f194a0, info=0x17882600, owner="../../../../../mono/metadata/gc.c:1337") at handle.c:183:2
    frame %2: 0x019823c0 mscorlibtests`mono_gc_alloc_handle_string(vtable=0x17888760, size=24, len=5) at gc.c:1337:9
    frame %3: 0x019de896 mscorlibtests`mono_string_new_size_handle(domain=0x16e73fd0, len=5, error=0x01dc804c) at object.c:6643:6
    frame %4: 0x019d6fc4 mscorlibtests`mono_string_new_size_checked(domain=0x16e73fd0, length=5, error=0x01dc804c) at object.c:6655:2
    frame %5: 0x019de64e mscorlibtests`mono_string_new_utf16_checked(domain=0x16e73fd0, text=0x1842ab10, len=5, error=0x01dc804c) at object.c:6536:6
    frame %6: 0x019debc2 mscorlibtests`mono_string_new_checked(domain=0x16e73fd0, text="ar-SA", error=0x01dc804c) at object.c:6778:7
    frame %7: 0x019b06a8 mscorlibtests`construct_culture(this_obj=0x01f19428, ci=0x01b2d878, error=0x01dc804c) at locales.c:357:2
    frame %8: 0x019b0e3a mscorlibtests`ves_icall_System_Globalization_CultureInfo_internal_get_cultures(neutral='\0', specific='\x01', installed='\0') at locales.c:714:9
    frame %9: 0x007061f0 mscorlibtests`aot_wrapper___System_dot_Globalization_System_dot_Globalization_dot_CultureInfo__internal_get_cultures_pinvoke_cl2a_System_2eGlobalization_2eCultureInfo_5b_5d__cl4_bool_cl4_bool_cl4_bool_cl2a_System_2eGlobalization_2eCultureInfo_5b_5d__cl4_bool_cl4_bool_cl4_bool_ + 100
    frame %10: 0x00704fb2 mscorlibtests`mscorlib_System_Globalization_CultureInfo_GetCultures_System_Globalization_CultureTypes + 192
    frame %11: 0x0100f422 mscorlibtests`mscorlibtests1_MonoTests_System_DateTimeTest_Parse_Bug53023b + 192
    frame %12: 0x00a28702 mscorlibtests`aot_wrapper_gsharedvt_out_sig_pinvoke_void_this_ + 28
    frame %13: 0x009fa2c2 mscorlibtests`mscorlib_wrapper_runtime_invoke_object_runtime_invoke_sig_void_intptr_intptr_object_intptr_intptr_intptr + 312
    frame %14: 0x019278f2 mscorlibtests`mono_llvmonly_runtime_invoke(method=0x17953820, info=0x1842a9a0, obj=0x053b7c40, params=0x00000000, exc=0x01dc8550, error=0x01dc88a4) at mini-runtime.c:3000:2
```

@lambdageek suggested this fix after showing this trace to him. As far as I understand we do _not_ know the root cause yet. The handle leak happens in this trace:
```
(lldb) mbt
* thread %1
  * frame %0: 0x0176192c mscorlibtests`do_debug_me_please_kkthx at object.c:128:2
    frame %1: 0x01761a62 mscorlibtests`mono_runtime_object_init_handle(this_obj=MonoObjectHandle @ 0x01b53fbc, error=0x01b5404c) at object.c:146:3
    frame %2: 0x0176191e mscorlibtests`mono_runtime_object_init_checked(this_obj_raw=0x01fde880, error=0x01b5404c) at object.c:176:2
    frame %3: 0x0173ce32 mscorlibtests`ves_icall_System_Globalization_CultureInfo_internal_get_cultures(neutral='\0', specific='\x01', installed='\0') at locales.c:712:4
    frame %4: 0x004931d8 mscorlibtests`aot_wrapper___System_dot_Globalization_System_dot_Globalization_dot_CultureInfo__internal_get_cultures_pinvoke_cl2a_System_2eGlobalization_2eCultureInfo_5b_5d__cl4_bool_cl4_bool_cl4_bool_cl2a_System_2eGlobalization_2eCultureInfo_5b_5d__cl4_bool_cl4_bool_cl4_bool_ + 100
    frame %5: 0x00491f9a mscorlibtests`mscorlib_System_Globalization_CultureInfo_GetCultures_System_Globalization_CultureTypes + 192
    frame %6: 0x00d9b8f4 mscorlibtests`mscorlibtests1_MonoTests_System_DateTimeTest_Parse_Bug53023b + 192
    frame %7: 0x007b56ea mscorlibtests`aot_wrapper_gsharedvt_out_sig_pinvoke_void_this_ + 28
```
`mono_runtime_object_init_checked ()` already should take care of the handle stack 😕

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

5 years agoUsually do not create a handle in mono_runtime_invoke_handle. (mono/mono#14404)
Jay Krell [Thu, 9 May 2019 14:13:21 +0000 (07:13 -0700)]
Usually do not create a handle in mono_runtime_invoke_handle. (mono/mono#14404)

Use mono_runtime_invoke_handle_void instead.

Commit migrated from https://github.com/mono/mono/commit/2524d5613be83c6b6e3f4c1800b5a0f4eb2450aa

5 years ago[netcore] Set of workarounds for ArrayTests (mono/mono#14369)
Egor Bogatov [Thu, 9 May 2019 12:36:44 +0000 (15:36 +0300)]
[netcore] Set of workarounds for ArrayTests (mono/mono#14369)

* Fix ushort to char conversion

* fix one more test

* Enable more Array tests

* fix comment

* Fix CreateInstance_NotSupportedType_ThrowsNotSupportedException

* Address feedback

* Update ArraySortHelper.cs

* fix compilation error?

* bump corefx-tests, fix one more array.copy issue

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

5 years agoMechanize strings in marshal.c register_icall and cleanup a little. (mono/mono#14357)
Jay Krell [Thu, 9 May 2019 08:03:55 +0000 (01:03 -0700)]
Mechanize strings in marshal.c register_icall and cleanup a little. (mono/mono#14357)

The less mechical parts:
 - spell out monoeg_g_free
 - register_dyn_icall not used, remove
 - register_icall_no_wrapper only used once, spell it out instead

This is nice cosmetically on its own and will help remove JIT icall hashing.

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

5 years agoIntroduce enum and static data for JIT icalls, that are currently hashed (mono/mono...
Jay Krell [Thu, 9 May 2019 06:06:52 +0000 (23:06 -0700)]
Introduce enum and static data for JIT icalls, that are currently hashed (mono/mono#14359)

* Introduce enum and static data for JIT icalls, that are currently hashed
by string and address and use dynamic allocation.

These will be used shortly.

* PR: Move MONO_JIT_ICALLS content from class-internals.h to jit-icall-reg.h.
Not clear what is the best name but moving along.

Commit migrated from https://github.com/mono/mono/commit/997190c12c5826364874208a57b0e0334a02b59d