platform/upstream/dotnet/runtime.git
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

5 years ago[gitignore] Add crash dump files, .dylib.dSYM directories, and test-path (mono/mono...
Ryan Lucia [Wed, 8 May 2019 21:36:11 +0000 (14:36 -0700)]
[gitignore] Add crash dump files, .dylib.dSYM directories, and test-path (mono/mono#14408)

[gitignore] Add crash dump files, .dylib.dSYM directories, and test-path

Wasn't sure where in the file to best put the .dylib.dSYM stuff, so suggestions are welcome

Commit migrated from https://github.com/mono/mono/commit/2894e57ed72387a17db9f9ee01f56c320d82a819

5 years agoMerge pull request mono/mono#14203 from kjpou1/wasm-sdk-lower-version
Larry Ewing [Wed, 8 May 2019 16:44:03 +0000 (11:44 -0500)]
Merge pull request mono/mono#14203 from kjpou1/wasm-sdk-lower-version

[wasm][sdk] Fix warning NU1604, does not contain an inclusive lower b…

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

5 years ago[llvmonly] make local copy of trace_ips pointer from exception object (mono/mono...
Bernhard Urban [Wed, 8 May 2019 13:40:00 +0000 (15:40 +0200)]
[llvmonly] make local copy of trace_ips pointer from exception object (mono/mono#14400)

Fixes a race in llvmonly (watchOS):
```
Process 397 stopped
* thread %10, name = 'tid_8e2f', stop reason = EXC_BAD_ACCESS (code=1, address=0x28)
    frame %0: 0x0177f690 mscorlibtests`mono_llvm_load_exception at mini-exceptions.c:3886:23
   3883                 size_t upper = mono_array_length_internal (mono_ex->trace_ips);
   3884
   3885                 for (int i = 0; i < upper; i += TRACE_IP_ENTRY_SIZE) {
-> 3886                         gpointer curr_ip = mono_array_get_internal (mono_ex->trace_ips, gpointer, i);
   3887                         for (int j = 0; j < TRACE_IP_ENTRY_SIZE; ++j) {
   3888                                 gpointer p = mono_array_get_internal (mono_ex->trace_ips, gpointer, i + j);
   3889                                 trace_ips = g_list_append (trace_ips, p);
Target 0: (mscorlibtests) stopped.

(lldb) mbt
* thread %10
  * frame %0: 0x0177f690 mscorlibtests`mono_llvm_load_exception at mini-exceptions.c:3886:23
    frame %1: 0x00e23b7a mscorlibtests`mscorlibtests1_MonoTests_System_LazyTest__c__DisplayClass16_0__ConcurrentInitializationb__1 + 254
    frame %2: 0x0087af98 mscorlibtests`mscorlib_wrapper_delegate_invoke__Module_invoke_void + 610
    frame %3: 0x00368856 mscorlibtests`mscorlib_System_Threading_ThreadHelper_ThreadStart_Context_object + 448
  [...]
(lldb) p/x mono_ex
(MonoException *) $2 = 0x01d9e968
(lldb) p/x mono_ex->trace_ips
(MonoArray *) $3 = 0x00000000
(lldb) thread list
Process 397 stopped
  thread %1: tid = 0x38772, 0x018156aa mscorlibtests`jit_info_table_copy_and_split_chunk(table=0x17635a00, chunk=0x17b767f0) at jit-info.c:483:28, name = 'tid_303', queue = 'com.apple.main-thread'
  thread %3: tid = 0x387ad, 0x1c4f9764 libsystem_kernel.dylib`__psynch_cvwait + 24, name = 'SGen worker'
  thread %4: tid = 0x387b0, 0x1c4f1224 libsystem_kernel.dylib`semaphore_wait_trap + 8, name = 'Finalizer'
  thread %5: tid = 0x387b5, 0x1c4fa6cc libsystem_kernel.dylib`__workq_kernreturn + 8
  thread %6: tid = 0x387b6, 0x1c4f11d4 libsystem_kernel.dylib`mach_msg_trap + 20, name = 'com.apple.uikit.eventfetch-thread'
* thread %10: tid = 0x389a6, 0x0177f690 mscorlibtests`mono_llvm_load_exception at mini-exceptions.c:3886:23, name = 'tid_8e2f', stop reason = EXC_BAD_ACCESS (code=1, address=0x28)
  thread %11: tid = 0x38985, 0x1c4f9764 libsystem_kernel.dylib`__psynch_cvwait + 24, name = 'tid_8113'
  thread %12: tid = 0x38986, 0x1c4f123c libsystem_kernel.dylib`semaphore_timedwait_trap + 8, name = 'Thread Pool Worker'
  thread %13: tid = 0x38987, 0x1c4f123c libsystem_kernel.dylib`semaphore_timedwait_trap + 8, name = 'Thread Pool Worker'
  thread %14: tid = 0x389a3, 0x1c4f123c libsystem_kernel.dylib`semaphore_timedwait_trap + 8, name = 'Thread Pool Worker'
  thread %15: tid = 0x389a4, 0x1c4f123c libsystem_kernel.dylib`semaphore_timedwait_trap + 8, name = 'Thread Pool Worker'
  thread %16: tid = 0x389a5, 0x1c4f123c libsystem_kernel.dylib`semaphore_timedwait_trap + 8, name = 'Thread Pool Worker'
(lldb) thread select 1
* thread %1, name = 'tid_303', queue = 'com.apple.main-thread'
    frame %0: 0x018156aa mscorlibtests`jit_info_table_copy_and_split_chunk(table=0x17635a00, chunk=0x17b767f0) at jit-info.c:483:28
   480                          jit_info_table_split_chunk (chunk, &new_table->chunks [j], &new_table->chunks [j + 1]);
   481                          j += 2;
   482                  } else {
-> 483                          new_table->chunks [j] = table->chunks [i];
   484                          ++new_table->chunks [j]->refcount;
   485                          ++j;
   486                  }
(lldb) mbt
* thread %1
  * frame %0: 0x018156aa mscorlibtests`jit_info_table_copy_and_split_chunk(table=0x17635a00, chunk=0x17b767f0) at jit-info.c:483:28
    frame %1: 0x01815304 mscorlibtests`jit_info_table_chunk_overflow(table=0x17635a00, chunk=0x17b767f0) at jit-info.c:579:10
    frame %2: 0x018146ee mscorlibtests`jit_info_table_add(domain=0x16624cc0, table_ptr=0x16624d9c, ji=0x176f4428) at jit-info.c:614:33
    frame %3: 0x01814662 mscorlibtests`mono_jit_info_table_add(domain=0x16624cc0, ji=0x176f4428) at jit-info.c:674:2
    frame %4: 0x0175f5da mscorlibtests`mono_aot_find_jit_info(domain=0x16624cc0, image=0x16c07200, addr=0x00271ff1) at aot-runtime.c:3710:3
    frame %5: 0x0181443e mscorlibtests`mono_jit_info_table_find_internal(domain=0x16624cc0, addr=0x00271ff1, try_aot=1, allow_trampolines=0) at jit-info.c:306:9
    frame %6: 0x018145e0 mscorlibtests`mono_jit_info_table_find(domain=0x16624cc0, addr=0x00271ff1) at jit-info.c:335:9
    frame %7: 0x01780212 mscorlibtests`build_stack_trace(frame_ctx=0x01c2fb18, state=0x01c2ffb8) at mini-exceptions.c:392:31
    frame %8: 0x1c598aa2 libunwind.dylib`_Unwind_Backtrace + 232
    frame %9: 0x0177f4fc mscorlibtests`throw_exception(ex=0x01d9e968, rethrow=0) at mini-exceptions.c:3800:3
    frame %10: 0x0177f3c8 mscorlibtests`mono_llvm_throw_exception(ex=0x01d9e968) at mini-exceptions.c:3823:2
    frame %11: 0x00439ed0 mscorlibtests`mscorlib_System_Runtime_ExceptionServices_ExceptionDispatchInfo_Throw + 116
    frame %12: 0x00271ff0 mscorlibtests`mscorlib_System_LazyHelper_ThrowException + 98
    frame %13: 0x002730c2 mscorlibtests`mscorlib_System_Lazy_1_T_REF_CreateValue + 194
    frame %14: 0x00273390 mscorlibtests`mscorlib_System_Lazy_1_T_REF_get_Value + 128
    frame %15: 0x0027307a mscorlibtests`mscorlib_System_Lazy_1_T_REF_CreateValue + 122
    frame %16: 0x00273390 mscorlibtests`mscorlib_System_Lazy_1_T_REF_get_Value + 128
    frame %17: 0x00e22eb0 mscorlibtests`mscorlibtests1_MonoTests_System_LazyTest_ConcurrentInitialization + 1422
    frame %18: 0x008948e2 mscorlibtests`aot_wrapper_gsharedvt_out_sig_pinvoke_void_this_ + 28
    frame %19: 0x008664a2 mscorlibtests`mscorlib_wrapper_runtime_invoke_object_runtime_invoke_sig_void_intptr_intptr_object_intptr_intptr_intptr + 312
```

Commit migrated from https://github.com/mono/mono/commit/19f57ad0b82c73c2d56f98b56a32a07f84a0f6d0

5 years ago[runtime] Use MAP_JIT automatically when running under a hardened runtime on osx...
Zoltan Varga [Wed, 8 May 2019 11:20:55 +0000 (07:20 -0400)]
[runtime] Use MAP_JIT automatically when running under a hardened runtime on osx. (mono/mono#14395)

* [runtime] Use MAP_JIT automatically when running under a hardened runtime on osx.

* Fix memory ordering.

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

5 years agoMechanize strings in mini-runtime.c register_jit_icall. (mono/mono#14374)
Jay Krell [Wed, 8 May 2019 07:46:32 +0000 (00:46 -0700)]
Mechanize strings in mini-runtime.c register_jit_icall. (mono/mono#14374)

* Mechanism strings to register_dyn_icall in mini-runtime.c.
That is both, generate them kinda, and make them available for some later manipulation.

* Mechanize strings for JIT icall registration in mini-runtime.c.
Generate them slightly and make them amenable to crude preprocessor transforms later.

* Try to improve github diff presentation.

Commit migrated from https://github.com/mono/mono/commit/8928ed6fd89d03c26d3428cf390c1f5384e8686f

5 years ago[interp] Add tracing support. Return values are not yet supported. (mono/mono#14389)
Zoltan Varga [Wed, 8 May 2019 03:16:20 +0000 (23:16 -0400)]
[interp] Add tracing support. Return values are not yet supported. (mono/mono#14389)

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

5 years agoDon't apply MONO_ATTR_FORMAT_PRINTF to mono_error_set_argument (mono/mono#14385)
Jo Shields [Tue, 7 May 2019 19:52:35 +0000 (15:52 -0400)]
Don't apply MONO_ATTR_FORMAT_PRINTF to mono_error_set_argument (mono/mono#14385)

The constructor for mono_error_set_argument lacks a `const char *msg_format`
so clearly we shouldn't be applying formatting from an entirely
unrelated parameter.

This was flagged by `-Werror=format-security`

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

5 years agoRemapping should affect GAC search paths considered by the loader (mono/mono#14384)
Jo Shields [Tue, 7 May 2019 19:32:30 +0000 (15:32 -0400)]
Remapping should affect GAC search paths considered by the loader (mono/mono#14384)

Closes: mono/mono#14366

Fixes Mac package failures during IronRuby compilation

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

5 years agoMerge pull request mono/mono#14370 from lewing/mixed-sample
Larry Ewing [Tue, 7 May 2019 16:05:50 +0000 (11:05 -0500)]
Merge pull request mono/mono#14370 from lewing/mixed-sample

[wasm] Add a mixed target for sample

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

5 years agoMerge pull request mono/mono#14375 from lateralusX/lateralusX/fix-mutex-leak-on-gc
Johan Lorensson [Tue, 7 May 2019 11:57:05 +0000 (13:57 +0200)]
Merge pull request mono/mono#14375 from lateralusX/lateralusX/fix-mutex-leak-on-gc

Mutex memory leak on sgen GC (nursery, major).

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

5 years ago[arm] fix armv7k regression on struct passing (mono/mono#14362)
Bernhard Urban [Tue, 7 May 2019 09:24:55 +0000 (11:24 +0200)]
[arm] fix armv7k regression on struct passing (mono/mono#14362)

We can't use `slotsize=8` on `armv7k` as it leads to stack corruption.

Note that `mtouch` already calls the AOT compiler with `--aot=mtriple=arm64_32-ios`, so no changes are required there.

Regression introduced by https://github.com/mono/mono/pull/12992

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

Commit migrated from https://github.com/mono/mono/commit/8913a1a73e85c60a7d896832d0dac4cfea979e6a

5 years agoMutex memory leak on sgen GC (nursery, major).
lateralusX [Tue, 7 May 2019 08:02:10 +0000 (10:02 +0200)]
Mutex memory leak on sgen GC (nursery, major).

During GC we allocate a gray queue protected by a mutex, sgen_gray_object_queue_init.
This mutex is never destroyed when clearing up the object containing it,
sgen_gray_object_queue_dispose, so it will leak. Overtime this could cause
OOM on some systems depending on how memory related to system primitives are
handled and partitioned.

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

5 years agoMechanize strings in cominterop register_jit_icall. (mono/mono#14356)
Jay Krell [Mon, 6 May 2019 23:31:03 +0000 (16:31 -0700)]
Mechanize strings in cominterop register_jit_icall. (mono/mono#14356)

This reduces the current source code and will be useful in eliminating JIT icall hashing.

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

5 years agoMechanize strings in remoting.c register_icall. (mono/mono#14360)
Jay Krell [Mon, 6 May 2019 23:29:43 +0000 (16:29 -0700)]
Mechanize strings in remoting.c register_icall. (mono/mono#14360)

This will help remove/reduce JIT icall hashing, as the
name will also be a field name or token paste to an enum value.

Commit migrated from https://github.com/mono/mono/commit/072ff8fcfb75eefb3744f8b88f1965db3b275960

5 years agoA deadlock happens when during a process_suspend there is a pending invoke and then...
Thays Grazia [Mon, 6 May 2019 22:24:02 +0000 (19:24 -0300)]
A deadlock happens when during a process_suspend there is a pending invoke and then when it's calling the invoke there is another call to process_suspend in the same thread. (mono/mono#14368)

Commit migrated from https://github.com/mono/mono/commit/1294e4d0e5597d1174bddb19258b6cf47c905e19

5 years agoMake mono_fmod extern "C and not static, to simplify later (mono/mono#14355)
Jay Krell [Mon, 6 May 2019 21:49:29 +0000 (14:49 -0700)]
Make mono_fmod extern "C and not static, to simplify later (mono/mono#14355)

* Make mono_fmod extern "C and not static, to simplify later
removal of JIT icall hashing. Making it more consistent with other icalls.
Costing maybe one instruction in some slow paths.

* Move mono_fmod from mini-runtime.c to jit-icalls.c.

* Fix declaratoin of mono_fmod.

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

5 years agoRemove special casing (mono/mono#14155)
pedestrianlove [Mon, 6 May 2019 06:00:16 +0000 (14:00 +0800)]
Remove special casing (mono/mono#14155)

* match the parameter

* Removed special handling.

Removed special handling of TypedReference and RuntimeArgumentHandle

* Remove the whole special casing block

* Revert part of last commit

Restored the check for IsByRefLikeAttribute

* Corrected the function name

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

5 years agoMerge pull request mono/mono#14259 from jeromelaban/dev/jela/wasm-dlopen
Larry Ewing [Sun, 5 May 2019 21:39:52 +0000 (16:39 -0500)]
Merge pull request mono/mono#14259 from jeromelaban/dev/jela/wasm-dlopen

[Wasm] Add support for P/Invoke through dynamic linking

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

5 years agoAdd execute permissions on build scripts.
lateralusX [Sat, 4 May 2019 11:26:42 +0000 (13:26 +0200)]
Add execute permissions on build scripts.

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

5 years agoMerge pull request mono/mono#14331 from BrzVlad/feature-interp-ldsflda-opt
Larry Ewing [Sat, 4 May 2019 05:55:38 +0000 (00:55 -0500)]
Merge pull request mono/mono#14331 from BrzVlad/feature-interp-ldsflda-opt

[interp] Optimize ldsflda opcode

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

5 years ago[netcore] Fix CreateInstance_PublicOnlyValueTypeWithPrivateDefaultConstructor_T…...
Egor Bogatov [Sat, 4 May 2019 04:36:03 +0000 (07:36 +0300)]
[netcore] Fix CreateInstance_PublicOnlyValueTypeWithPrivateDefaultConstructor_T… (mono/mono#14321)

* Fix CreateInstance_PublicOnlyValueTypeWithPrivateDefaultConstructor_ThrowsMissingMethodException

* Update excludes-System.Runtime.Tests.rsp

* Update RuntimeType.cs

Commit migrated from https://github.com/mono/mono/commit/534c6883b1fd155113867f9b684863dffae98e04

5 years agoMerge pull request mono/mono#14340 from lewing/wasm-link-descriptor
Larry Ewing [Sat, 4 May 2019 03:56:13 +0000 (22:56 -0500)]
Merge pull request mono/mono#14340 from lewing/wasm-link-descriptor

[wasm] Add --link-descriptor arg to packager

Commit migrated from https://github.com/mono/mono/commit/887887a7fe3fb302cea267db760fed9dfb46209a

5 years agoRegenerate m2n trampolines
Jérôme Laban [Sat, 4 May 2019 00:42:10 +0000 (20:42 -0400)]
Regenerate m2n trampolines

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

5 years agoAdjust indentation
Jérôme Laban [Wed, 1 May 2019 18:55:54 +0000 (14:55 -0400)]
Adjust indentation

Commit migrated from https://github.com/mono/mono/commit/40981f0cfdfff290ae5000498724e252053339da

5 years agoAdd vifffff and viffffff trampolines
Jérôme Laban [Wed, 1 May 2019 15:41:51 +0000 (11:41 -0400)]
Add vifffff and viffffff trampolines

Commit migrated from https://github.com/mono/mono/commit/21743bd58da762558e04752882b2760d0b6c30e9

5 years agoMake wasm dlopen use only for release-dynamic configuration
Jérôme Laban [Wed, 1 May 2019 02:20:51 +0000 (22:20 -0400)]
Make wasm dlopen use only for release-dynamic configuration

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

5 years agoMake libmono_icall_table_la_LIBADD and libmono_ilgen_la_LIBADD conditional to wasm.
Jérôme Laban [Mon, 29 Apr 2019 20:04:03 +0000 (16:04 -0400)]
Make libmono_icall_table_la_LIBADD and libmono_ilgen_la_LIBADD conditional to wasm.

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

5 years agoFix indentation, spacing.
Jérôme Laban [Mon, 29 Apr 2019 20:03:29 +0000 (16:03 -0400)]
Fix indentation, spacing.

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

5 years agoGenerate m2n after update
Jérôme Laban [Mon, 29 Apr 2019 20:03:11 +0000 (16:03 -0400)]
Generate m2n after update

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

5 years agoFix indentation
Jérôme Laban [Mon, 29 Apr 2019 14:45:48 +0000 (10:45 -0400)]
Fix indentation

Commit migrated from https://github.com/mono/mono/commit/935bc21276cd3389caeae2b5ac175bef4a3b0eed

5 years agoAdd more driver cookies
Jérôme Laban [Mon, 29 Apr 2019 13:35:08 +0000 (09:35 -0400)]
Add more driver cookies

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

5 years agomono emscripten double loading issue
Jérôme Laban [Mon, 29 Apr 2019 12:29:32 +0000 (08:29 -0400)]
mono emscripten double loading issue

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

5 years agoWorkaround for second dlopen failure returns non-null
Jérôme Laban [Sun, 28 Apr 2019 01:22:40 +0000 (21:22 -0400)]
Workaround for second dlopen failure returns non-null

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

5 years agoAdd missing include
Jérôme Laban [Sat, 27 Apr 2019 12:18:21 +0000 (08:18 -0400)]
Add missing include

Commit migrated from https://github.com/mono/mono/commit/195e7f0b0506582d91db20752651638d42db0150

5 years agoAdd minimal dl support
Jérôme Laban [Sat, 27 Apr 2019 03:31:17 +0000 (23:31 -0400)]
Add minimal dl support

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

5 years agoEnable dynamic linking support for mono
Jérôme Laban [Fri, 26 Apr 2019 17:45:16 +0000 (13:45 -0400)]
Enable dynamic linking support for mono

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

5 years agoMerge pull request mono/mono#14309 from lewing/icall-branch
Larry Ewing [Fri, 3 May 2019 22:56:32 +0000 (17:56 -0500)]
Merge pull request mono/mono#14309 from lewing/icall-branch

[wasm] generate icall_trampoline_dispatch as nested branches

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

5 years agoMerge pull request mono/mono#14306 from radical/bump_msbuild_master
Larry Ewing [Fri, 3 May 2019 21:12:56 +0000 (16:12 -0500)]
Merge pull request mono/mono#14306 from radical/bump_msbuild_master

[msbuild] Bump to pick up test fixes

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

5 years ago[netcore] Unique Asset Manifest filenames per branch
Jo Shields [Fri, 3 May 2019 18:41:44 +0000 (14:41 -0400)]
[netcore] Unique Asset Manifest filenames per branch

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

5 years agoOrder the groupings preferentially by length to reduce the worst case
Larry Ewing [Thu, 2 May 2019 05:17:34 +0000 (00:17 -0500)]
Order the groupings preferentially by length to reduce the worst case

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

5 years agoAdd option to restore VS build env from file.
lateralusX [Fri, 3 May 2019 12:19:14 +0000 (14:19 +0200)]
Add option to restore VS build env from file.

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

5 years agoAdd support for cygwin and WSL in helper build scripts.
lateralusX [Thu, 2 May 2019 15:25:27 +0000 (17:25 +0200)]
Add support for cygwin and WSL in helper build scripts.

Commit migrated from https://github.com/mono/mono/commit/568813b93bdd3f5f000bc4bdbc88e71f8158d9ca

5 years agoAdd support to include external build LLVM binaries in Mono build output.
lateralusX [Thu, 2 May 2019 15:04:22 +0000 (17:04 +0200)]
Add support to include external build LLVM binaries in Mono build output.

Commit migrated from https://github.com/mono/mono/commit/488e15e8ab3245bd6faca4f8388f3844d3066314

5 years agoAdd LLVM SDK build/package support for Windows msvc build LLVM.
lateralusX [Tue, 30 Apr 2019 22:40:22 +0000 (00:40 +0200)]
Add LLVM SDK build/package support for Windows msvc build LLVM.

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

5 years ago[interp] Optimize ldsflda opcode
Vlad Brezae [Fri, 3 May 2019 10:45:58 +0000 (13:45 +0300)]
[interp] Optimize ldsflda opcode

2-4x speedup

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

5 years agold -Bsymboli so dynamic linker does not get betweem mono and itself. (mono/mono#14298)
Jay Krell [Fri, 3 May 2019 06:29:57 +0000 (23:29 -0700)]
ld -Bsymboli so dynamic linker does not get betweem mono and itself. (mono/mono#14298)

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

5 years ago[runtime] Fix the signature of the AppDomain:DoUnhandledException () icall. (mono...
Zoltan Varga [Fri, 3 May 2019 02:44:08 +0000 (22:44 -0400)]
[runtime] Fix the signature of the AppDomain:DoUnhandledException () icall. (mono/mono#14322)

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

5 years ago[arm] amend stack pointer properly in exception trampoline (mono/mono#14310)
Bernhard Urban [Thu, 2 May 2019 17:48:41 +0000 (19:48 +0200)]
[arm] amend stack pointer properly in exception trampoline (mono/mono#14310)

The previous attempt ( https://github.com/mono/mono/pull/14078 ) only fixed it for ABIs where the stack pointer alignment is 8 bytes. ABIs, such as watchOS, require 16 byte alignment.

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

5 years ago[llvm] Widen vector equality (OP_PCMPEQx) (mono/mono#14292)
Alexander Kyte [Thu, 2 May 2019 16:24:35 +0000 (12:24 -0400)]
[llvm] Widen vector equality (OP_PCMPEQx) (mono/mono#14292)

* [llvm] Widen vector equality (OP_PCMPEQx)

Fixes https://github.com/mono/mono/issues/14261
Fixes https://github.com/mono/mono/issues/14143

This was causing an issue when trying to inline
System.Numerics.Vectors.Vector`1<byte>:Equals into System.Span.IndexOf
from System.Memory.dll as provided by nuget. I believe that it is
comparing the result of a SIMD operation on two SIMD registers there with a
SIMD register full of zero bytes.

When we produce the Equals call (no inline), we spill the SIMD <4 x i32>
vector to the stack in the caller, and we then later load it
with the widened type used here <16 x i8>.

When we inline, we end up making the args into XMOV opcodes,
and then doing the "pcmpeqb" mini opcode with the return values
from those operations. This becomes a register to register no-op
copy, and the original <4 x i32> gets compared against the <16 x i8>
type:

```
  %116 = icmp eq <16 x i8> zeroinitializer, <4 x i32> %115
```

This does not go the way we want it to. It reliably leads to IndexOf
breaking and only finding the desired byte in the portion not processed
by the SIMD code (in the last few elements of the array).

This fix checks if the input dimensions differ, and does a conversion.
This produces the following IR:

```
  %114 = bitcast <4 x i32> %99 to <16 x i8>
  %115 = icmp eq <16 x i8> %114, %113
  %116 = sext <16 x i1> %115 to <16 x i8>
  %117 = icmp eq <16 x i8> zeroinitializer, %116
```

* [llvm] Widen vector greater-than

Here we do the same trick used in the above fix, but for the parallel greater-than operation.

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

5 years agoMove three trivial threadpool icalls to callers. (mono/mono#14296)
Jay Krell [Thu, 2 May 2019 14:25:58 +0000 (07:25 -0700)]
Move three trivial threadpool icalls to callers. (mono/mono#14296)

ves_icall_System_Threading_ThreadPool_PostQueuedCompletionStatus
 ves_icall_System_Threading_ThreadPool_BindIOCompletionCallbackNative
 ves_icall_System_Threading_ThreadPool_IsThreadPoolHosted

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

5 years ago[netcore] Onboard Arcade (mono/mono#14301)
Jo Shields [Thu, 2 May 2019 14:24:10 +0000 (10:24 -0400)]
[netcore] Onboard Arcade (mono/mono#14301)

Commit migrated from https://github.com/mono/mono/commit/748da2e4a93e820540f857ee8c6d3f752141f4de

5 years ago[netcore] clean up excludes-System.Runtime.Tests.rsp (mono/mono#14294)
Egor Bogatov [Thu, 2 May 2019 12:00:40 +0000 (15:00 +0300)]
[netcore] clean up excludes-System.Runtime.Tests.rsp (mono/mono#14294)

* update System.Runtime.Tests.rsp

* Update System.Private.CoreLib.csproj

* Update excludes-System.Runtime.Tests.rsp

* Invoke AppContext.OnProcessExit from runtime

* remove Utf16/Utf8 tests

* Implement LoadFromPath

* make NativeLibrary os specific

* Add missing LoadWithPartialName

* Update Assembly.cs

* Update Assembly.cs

* Update NativeLibrary.Unix.cs

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

5 years agoMerge pull request mono/mono#14295 from vargaz/mixed-eh-5
Larry Ewing [Thu, 2 May 2019 06:46:36 +0000 (01:46 -0500)]
Merge pull request mono/mono#14295 from vargaz/mixed-eh-5

[runtime] Fix some mixed EH problems.

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

5 years agoTry out a branching trampoline dispatch
Larry Ewing [Thu, 2 May 2019 03:31:40 +0000 (22:31 -0500)]
Try out a branching trampoline dispatch

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

5 years ago[runtime] Fix some mixed EH problems.
Zoltan Varga [Wed, 1 May 2019 06:00:56 +0000 (02:00 -0400)]
[runtime] Fix some mixed EH problems.

Commit migrated from https://github.com/mono/mono/commit/781d20bab4902bfad0ac29b9fb82c28812d7edc1

5 years ago[aot] Avoid passing -march=arm to llc when using thumb, it forces arm32 code generati...
Zoltan Varga [Wed, 1 May 2019 00:47:27 +0000 (20:47 -0400)]
[aot] Avoid passing -march=arm to llc when using thumb, it forces arm32 code generation. (mono/mono#14288)

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

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

5 years agoAdd minimal COM support into WinAOT BCL profile and Windows Mono runtime.
lateralusX [Mon, 29 Apr 2019 08:17:45 +0000 (10:17 +0200)]
Add minimal COM support into WinAOT BCL profile and Windows Mono runtime.

Technologies like SharpDX uses a minimal set of COM support from runtime
and System.Runtime.InteropServices.Marshal:

AddRef
Release
QueryInterface

All these are low level wrappers around methods in IUknown interface and
doesn't need any of the additional runtime COM support enabled to work.

Technologies like CoreRT includes these methods in their full AOT
profile, meaning that SharpDX can run on CoreRT on Windows platforms. Mono's
WinAOT profile and runtime currently don't, making it impossible  to use
SharpDX.

This PR adds the needed methods into WinAOT profile and also make
sure corresponding icalls always gets included on Windows build Mono runtime.

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

5 years agoMerge pull request mono/mono#14199 from kjpou1/wasm-sdk-cl-args
Larry Ewing [Mon, 29 Apr 2019 22:33:44 +0000 (17:33 -0500)]
Merge pull request mono/mono#14199 from kjpou1/wasm-sdk-cl-args

[wasm][sdk] Add command line quoting and escaping to WasmLinkAssembli…

Commit migrated from https://github.com/mono/mono/commit/498974d09ac841eb2ad62cb8f528a79490e9492d

5 years agoMirror changes from mono/coreclr,corefx,corert (mono/mono#14163)
Marek Safar [Mon, 29 Apr 2019 17:30:57 +0000 (19:30 +0200)]
Mirror changes from mono/coreclr,corefx,corert (mono/mono#14163)

Mirror changes from mono/coreclr,corefx,corert

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

5 years agoRemove libgcc_s_seh-1.dll dependency when targeting Win32 with gcc. (mono/mono#14251)
Jay Krell [Sun, 28 Apr 2019 01:57:17 +0000 (18:57 -0700)]
Remove libgcc_s_seh-1.dll dependency when targeting Win32 with gcc. (mono/mono#14251)

Don't use popcount intrinsic.
Alternative but not exactly contradictory to https://github.com/mono/mono/pull/14248.

Note that this is a single inlinable instruction on x86,
if you assume at least SSE4 from circa 2007, which I am avoiding here.

Commit migrated from https://github.com/mono/mono/commit/90a91429ae75240b4d0e791a563a9d553be09d56

5 years ago[interp] Optimize enum Hasflag (mono/mono#14173)
Vlad Brezae [Sat, 27 Apr 2019 09:14:16 +0000 (12:14 +0300)]
[interp] Optimize enum Hasflag (mono/mono#14173)

* [interp] Optimize enum.HasFlag for csc pattern

Avoid boxing and slow call. Makes it 100x faster.

* [interp] Optimize enum.HasFlag for mcs pattern

* [interp] Transform ldc.i4 + conv.i8 into ldc.i8

Simplifies code, making enum.HasFlag optimization work for long enums.

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

5 years ago[interp] Optimize special static field access (mono/mono#14202)
Vlad Brezae [Fri, 26 Apr 2019 21:28:12 +0000 (00:28 +0300)]
[interp] Optimize special static field access (mono/mono#14202)

* [interp] Optimize special static field access

3x faster. For value types 10x.

* [interp] Remove duplicated code

* [interp] Further optimize thread static field access

Provides an additional 50% perf gain.

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

5 years ago[interp] Don't change next_jit_code_hash during imethod transform (mono/mono#14240)
Vlad Brezae [Fri, 26 Apr 2019 15:20:33 +0000 (18:20 +0300)]
[interp] Don't change next_jit_code_hash during imethod transform (mono/mono#14240)

This field is used by the internal hash table to link nodes and it can be changed during hash table insertion of other imethods. Copying this field back was leading to random hangs in hash table lookup.

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

5 years ago[runtime] Add a python version of the offsets tool. (mono/mono#14229)
Zoltan Varga [Fri, 26 Apr 2019 15:12:24 +0000 (11:12 -0400)]
[runtime] Add a python version of the offsets tool. (mono/mono#14229)

* [runtime] Add a python version of the offsets tool.

This version only depends on python and libclang. It currently only
works on osx.

* [runtime] Add a dummy structure needed by the python version of the offsets tool.

* [offsets-tool-py] Change some argument names for compatibility.

* [wasm] Use the python offsets tool on osx, the c# version is 32 bit, and the 64 bit version doesn't work.

* [wasm] Fix the ordering of mono libraries on the link line.

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

5 years ago[netcore] Avoid touching or using submodules in coreonly mode
Jo Shields [Thu, 25 Apr 2019 20:47:01 +0000 (16:47 -0400)]
[netcore] Avoid touching or using submodules in coreonly mode

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

5 years ago[netcore] Smarter version numbering of nupkg (mono/mono#14011)
Jo Shields [Thu, 25 Apr 2019 19:42:56 +0000 (15:42 -0400)]
[netcore] Smarter version numbering of nupkg (mono/mono#14011)

The version number in version.h only shows e.g. "6.3.0", and we
want full version numbers ideally, to match what our Mac pkg files
show. This logic calculates that version number.

Commit migrated from https://github.com/mono/mono/commit/3521df4cf476ce459cdacd815f64876d8b3e5a94

5 years ago[netcore] Fix `make dist` following https://github.com/mono/mono/pull/14167 (mono...
Jo Shields [Thu, 25 Apr 2019 18:27:46 +0000 (14:27 -0400)]
[netcore] Fix `make dist` following https://github.com/mono/mono/pull/14167 (mono/mono#14233)

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

5 years agoFix arm32 tailcall_reg/tailcall_membase. (mono/mono#14187)
Jay Krell [Thu, 25 Apr 2019 17:10:06 +0000 (10:10 -0700)]
Fix arm32 tailcall_reg/tailcall_membase. (mono/mono#14187)

* Revert "[Tailcall] [arm] [jit] Fix moving tailcall parameters. (mono/mono#12701)"

This reverts commit mono/mono@257efc6374cbffb95d83dc9257b432d6ae3d80f6.

* When moving parameters for tailcall, and having pushed ip,
and adjusting the offset to account for that, split the adjustment
between sp and frame pointer, as frame pointer may or may not be sp.
This fixes https://github.com/mono/mono/issues/11489.

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