platform/upstream/dotnet/runtime.git
5 years ago[debugger][wasm] Display content of "this" (mono/mono#15528)
Thays Grazia [Wed, 3 Jul 2019 15:15:18 +0000 (12:15 -0300)]
[debugger][wasm] Display content of "this" (mono/mono#15528)

* Implementing watch of variable "this"
Fixes mono/mono#15446

* Fixing indentation.

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

5 years ago[interp] Simplify MINT_NEWOBJ_ARRAY
Vlad Brezae [Tue, 2 Jul 2019 15:02:25 +0000 (18:02 +0300)]
[interp] Simplify MINT_NEWOBJ_ARRAY

Commit migrated from https://github.com/mono/mono/commit/6136d51ae92e2e421f257e3c7939f12affc8deaf

5 years ago[interp] Make newarr lockfree
Vlad Brezae [Tue, 2 Jul 2019 14:42:24 +0000 (17:42 +0300)]
[interp] Make newarr lockfree

Before this commit, we were creating the array class from the element class during run time, also taking a lock in the meantime. This makes array allocation 2x faster. (on multithread much faster)

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

5 years agoAbort async suspend request on failure doing preemptive suspend. (mono/mono#15486)
Johan Lorensson [Wed, 3 Jul 2019 11:08:05 +0000 (13:08 +0200)]
Abort async suspend request on failure doing preemptive suspend. (mono/mono#15486)

When a preemptive suspend fails, state machine will get into an invalid
state and the thread is in an unknown state (running/self-suspended). In case of
failure in mono_threads_suspend_begin_async_suspend, a new method should be
called, mono_threads_transition_abort_async_suspend making sure state machine
reflects correct thread state as well as reporting correct result to initial
caller of mono_threads_suspend_begin_async_suspend.

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

5 years agoHAVE_DL_LOADER is never used so remove it. (mono/mono#15500)
Jay Krell [Wed, 3 Jul 2019 09:01:59 +0000 (02:01 -0700)]
HAVE_DL_LOADER is never used so remove it. (mono/mono#15500)

Commit migrated from https://github.com/mono/mono/commit/08feb423c1f214a5341fcb0132054cd0dcf9f891

5 years agoAC_DEFINE instead of AC_SUBST MONO_DL_NEED_USCORE. (mono/mono#15499)
Jay Krell [Wed, 3 Jul 2019 09:01:19 +0000 (02:01 -0700)]
AC_DEFINE instead of AC_SUBST MONO_DL_NEED_USCORE. (mono/mono#15499)

i.e. so it can be used in C instead of make.
i.e. so it can actually work.

The lone use is here:
```
C:\s\mono2\mono\utils\mono-dl.c(271):#if MONO_DL_NEED_USCORE
```

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

5 years agoDo not compile unused support/uncompr.c. (mono/mono#15516)
Jay Krell [Wed, 3 Jul 2019 08:59:38 +0000 (01:59 -0700)]
Do not compile unused support/uncompr.c. (mono/mono#15516)

Commit migrated from https://github.com/mono/mono/commit/177ae36c7a34ac331e8e38a40d4caa131f4d89f6

5 years ago[netcore] Clean up CoreFX.issues.rsp (mono/mono#15526)
Egor Bogatov [Wed, 3 Jul 2019 08:58:50 +0000 (11:58 +0300)]
[netcore] Clean up CoreFX.issues.rsp (mono/mono#15526)

Commit migrated from https://github.com/mono/mono/commit/57f362207c1b1caee96dd5a3ae0f1bd3a8d6461a

5 years agoCorrect MONO_DL_NEED_USCORE for C++, and memcpy is faster than strcpy. (mono/mono...
Jay Krell [Tue, 2 Jul 2019 15:09:32 +0000 (08:09 -0700)]
Correct MONO_DL_NEED_USCORE for C++, and memcpy is faster than strcpy. (mono/mono#15498)

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

5 years agoAdd support for TLS callbacks on Windows. (mono/mono#15423)
Johan Lorensson [Tue, 2 Jul 2019 12:06:57 +0000 (14:06 +0200)]
Add support for TLS callbacks on Windows. (mono/mono#15423)

* Add support for TLS callbacks on Windows.

Mono runtime depends on DllMain to be called by OS in order to correctly
detach threads from the runtime. If this doesn't happen,
threads from native thread pools (not owned by runtime) and attached
using native->managed callback, won't detach resulting in attached
threads no longer running. Since threads are still attached
to runtime, next GC will try to suspend the thread and that will fail
and that in turn will put the state machine in an incorrect state,
bringing down the runtime at next GC (when the thread state is revisited).

This problem is currently handled by DllMain, but since DllMain only exist
in DLL's, statically link Mono runtime will get us into the above scenario.

This commit add support to hook up a TLS callback using the same mechanism
used by MSVC linker and c-runtime (also available under MINGW). The
callback will be included in a section/segment of an object file and included
in final image (DLL or EXE) by linker and called by OS loader, solving the
problem with static linked Mono runtime not being able to detach terminating
threads.

The commit keeps current DllMain method when building a DLL but
includes a mechanism making sure we only use one of the callback techniques
at runtime, if both have been included in final image. This will simplify the build
of libmini since we can always build the object including the callback, regardless
how the library will be consumed.

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

5 years ago[stats] distinguish between mini and LLVM AOT method (mono/mono#15483)
Bernhard Urban [Tue, 2 Jul 2019 08:55:51 +0000 (10:55 +0200)]
[stats] distinguish between mini and LLVM AOT method (mono/mono#15483)

[stats] distinguish between mini and LLVM AOT method

Also print the stats on shutdown when configured with `--with-core=only`

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

5 years ago[netcore] Remove some unused SRE icalls. (mono/mono#15484)
Zoltan Varga [Tue, 2 Jul 2019 08:27:48 +0000 (04:27 -0400)]
[netcore] Remove some unused SRE icalls. (mono/mono#15484)

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

5 years agoFix const warning. (mono/mono#15478)
Jay Krell [Tue, 2 Jul 2019 07:08:06 +0000 (00:08 -0700)]
Fix const warning. (mono/mono#15478)

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

5 years agoMake codeman not public (mono/mono#15415)
Jay Krell [Tue, 2 Jul 2019 07:07:18 +0000 (00:07 -0700)]
Make codeman not public (mono/mono#15415)

Seems a bit obscure to be public, the header is not public.

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

5 years agoAdd back some stubs for the non-threads build.
Zoltan Varga [Fri, 28 Jun 2019 22:20:29 +0000 (18:20 -0400)]
Add back some stubs for the non-threads build.

Commit migrated from https://github.com/mono/mono/commit/3970c6112a03acdbd4cc01a3a8bbf973fecf1f8e

5 years ago[wasm] Implement pthreads support in the runtime.
Zoltan Varga [Fri, 28 Jun 2019 07:46:41 +0000 (03:46 -0400)]
[wasm] Implement pthreads support in the runtime.

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

5 years ago[runtime] Disable a a AC_TRY_RUN when cross-compiling.
Zoltan Varga [Tue, 25 Jun 2019 20:03:38 +0000 (16:03 -0400)]
[runtime] Disable a a AC_TRY_RUN when cross-compiling.

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

5 years ago[netcore] Remove IsByRef check on Reflection.Emit.DynamicMethod
Steve Pfister [Tue, 2 Jul 2019 01:12:06 +0000 (21:12 -0400)]
[netcore] Remove IsByRef check on Reflection.Emit.DynamicMethod

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

Removed check on the return type being by ref.

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

5 years agoDisable zlib on mingw Windows build to avoid dependency on zlib (mono/mono#15493)
Johan Lorensson [Mon, 1 Jul 2019 23:15:38 +0000 (01:15 +0200)]
Disable zlib on mingw Windows build to avoid dependency on zlib (mono/mono#15493)

mono/mono#4484 broke Windows mingw build due to new dependency, zlib1.dll not available in PATH on build bots. Disabling for now until we know how this should be handled (and also fixed for MSVC build runtime).

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

5 years ago[netcore] Bump Roslyn
Marek Safar [Mon, 1 Jul 2019 19:01:24 +0000 (21:01 +0200)]
[netcore] Bump Roslyn

Commit migrated from https://github.com/mono/mono/commit/71d1b10c3eb2d2da8a773004cc16e4a5e90c7db8

5 years ago[netcore] Fix Array.Copy* tests. Bump NETCORETESTS_VERSION ver… (mono/mono#15428)
Egor Bogatov [Mon, 1 Jul 2019 18:20:25 +0000 (21:20 +0300)]
[netcore] Fix Array.Copy* tests. Bump NETCORETESTS_VERSION ver… (mono/mono#15428)

* Fix Array.Copy* tests

* simplify code

* Add comments

* Address feedback

* Update CoreFX.issues.rsp

* Fix SRE tests

* Add comment

* bump versions again

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

5 years ago[metadata] Rename, null-initialize, and properly free *args variables (mono/mono...
Miguel de Icaza [Mon, 1 Jul 2019 16:11:02 +0000 (09:11 -0700)]
[metadata] Rename, null-initialize, and properly free *args variables (mono/mono#13855)

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

5 years agoRemove unused AMD64 JIT CALLCONV_IS_STDCALL. (mono/mono#15416)
Jay Krell [Mon, 1 Jul 2019 07:53:01 +0000 (00:53 -0700)]
Remove unused AMD64 JIT CALLCONV_IS_STDCALL. (mono/mono#15416)

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

5 years agoFix 32-bit build error when using C++ compiler.
lateralusX [Thu, 27 Jun 2019 09:30:06 +0000 (11:30 +0200)]
Fix 32-bit build error when using C++ compiler.

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

5 years agoDisable compiler server on darwin. Add force-enable option for compiler server. ...
Katelyn Gadd [Fri, 28 Jun 2019 22:24:09 +0000 (15:24 -0700)]
Disable compiler server on darwin. Add force-enable option for compiler server. (mono/mono#15450)

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

5 years agoAdd tests
Filip Navara [Thu, 27 Jun 2019 09:07:40 +0000 (11:07 +0200)]
Add tests

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

5 years agoFix marshalling bugs for StringBuilder parameters
Filip Navara [Tue, 25 Jun 2019 09:31:38 +0000 (11:31 +0200)]
Fix marshalling bugs for StringBuilder parameters

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

5 years ago[netcore] Fix Assembly.GetForwardedTypes() (mono/mono#15452)
Ryan Lucia [Fri, 28 Jun 2019 15:54:27 +0000 (11:54 -0400)]
[netcore] Fix Assembly.GetForwardedTypes() (mono/mono#15452)

* [netcore] Make GetForwardedTypes return nested types

* [netcore] Throw proper error in GetTopLevelForwardedTypes

* Remove unnecessary function

* Formatting

* Re-enable relevant tests

* Switch to REFERENCE_MISSING

* Use local error

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

5 years ago[runtime] Implement support for embedded ppdb, when the ppdb blob is compressed and...
Zoltan Varga [Tue, 7 Mar 2017 01:28:24 +0000 (20:28 -0500)]
[runtime] Implement support for embedded ppdb, when the ppdb blob is compressed and embedded into the pe image.

Commit migrated from https://github.com/mono/mono/commit/112297ef5c076a2716c020ddb0bbf1e0a2da7703

5 years agoFix year+ old MIPS compile break. (mono/mono#15459)
Jay Krell [Fri, 28 Jun 2019 09:28:06 +0000 (02:28 -0700)]
Fix year+ old MIPS compile break. (mono/mono#15459)

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

Commit migrated from https://github.com/mono/mono/commit/19681ad2d440de48e5b74ddeb4d12dcd0277990a

5 years agoReplace two more MONO_DEBUG=clr-memory-model env vars with commandline switches
Alexander Köplinger [Fri, 28 Jun 2019 08:19:16 +0000 (10:19 +0200)]
Replace two more MONO_DEBUG=clr-memory-model env vars with commandline switches

Follow up to https://github.com/mono/mono/pull/15447

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

5 years ago[netcore] Avoid calling mono_runtime_install_appctx_properties () in aot mode. (mono...
Zoltan Varga [Fri, 28 Jun 2019 03:16:47 +0000 (23:16 -0400)]
[netcore] Avoid calling mono_runtime_install_appctx_properties () in aot mode. (mono/mono#15448)

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

5 years ago[dim] Emit error when calling abstract methods (mono/mono#15433)
Thays Grazia [Fri, 28 Jun 2019 01:02:39 +0000 (22:02 -0300)]
[dim] Emit error when calling abstract methods (mono/mono#15433)

* Emitting bad image exception when a non virtual call is calling an abstract method.

* Fixing side-effect.
Implementing the same thing on interpreter.
Adding unit test.

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

5 years agoFIx id formatting to align with rest of code.
lateralusX [Thu, 27 Jun 2019 07:58:28 +0000 (09:58 +0200)]
FIx id formatting to align with rest of code.

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

5 years agoFix incorrect thread state on suspend thread failure.
lateralusX [Wed, 26 Jun 2019 15:43:02 +0000 (17:43 +0200)]
Fix incorrect thread state on suspend thread failure.

According to documentation of mono_threads_suspend_begin_async_suspend:

"If begin suspend fails the thread must be left uninterrupted and resumed."

Current implementation on Windows didn't resume thread in case GetThreadContext
fails, leaving a thread in suspended state on failure.

Fix is to resume thread if GetThreadContext fails.

Commit migrated from https://github.com/mono/mono/commit/56d38ca43053670a6b456ce6843900c334caf1d2

5 years agoFix use THREAD_SUSPEND_DEBUG macros on Windows.
lateralusX [Wed, 26 Jun 2019 15:39:21 +0000 (17:39 +0200)]
Fix use THREAD_SUSPEND_DEBUG macros on Windows.

Several errors in current implementation, both compile time errors as
well as warnings.

Commit migrated from https://github.com/mono/mono/commit/973f430d45e1a6fbd1429da649a24c3b0d5eadb0

5 years ago[netcore] Review and document netcore test failures that are skipped (mono/mono#15359)
Steve Pfister [Thu, 27 Jun 2019 12:14:02 +0000 (08:14 -0400)]
[netcore] Review and document netcore test failures that are skipped (mono/mono#15359)

* Went through the majority of corefx tests that were being skipped in CoreFX.issues.rsp.

For each failure, a github issue was logged and if possible, a more expanded
failure reason was specified.

Part of the https://github.com/mono/mono/issues/14787 epic work

* Cleaned up header that no longer had tests in it

* Pesky -method still around.  It'll ignore now

Commit migrated from https://github.com/mono/mono/commit/814d20db9155ec568009e7f4374f386bcfd32977

5 years agoCreateNLSocket and CloseNLSocket should return gpointer (mono/mono#15408)
Ryan Lucia [Wed, 26 Jun 2019 19:41:11 +0000 (15:41 -0400)]
CreateNLSocket and CloseNLSocket should return gpointer (mono/mono#15408)

In managed, these functions are used as `static external IntPtr`. This means that previously on arm64 the top bits of the return value were garbage. A comparison with 64-bit -1 like in LinuxNetworkChange.EnsureSocket would never be true, which was causing us to hit other assertions in the runtime.
Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
Commit migrated from https://github.com/mono/mono/commit/19bb89805ac2eb56b09fed40cab1dd342f97a5e3

5 years agoFix unused-function warning in main.c. (mono/mono#15424)
Johan Lorensson [Wed, 26 Jun 2019 17:16:11 +0000 (19:16 +0200)]
Fix unused-function warning in main.c. (mono/mono#15424)

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

5 years ago[sdks] dynamically link libmonosgen to mono-sgen for monodroid host builds (mono...
Aleksey Kliger (λgeek) [Wed, 26 Jun 2019 15:10:03 +0000 (11:10 -0400)]
[sdks] dynamically link libmonosgen to mono-sgen for monodroid host builds (mono/mono#15410)

* [configure] Cosmetic AC_MSG_WARN fix

* [runtime] Mark mono_file_map_error as MONO_API, always

Fixed the `--with-static_mono=no` build on non-Win32

* [sdks] dynamically link libmonosgen to mono-sgen for monodroid host builds

Commit migrated from https://github.com/mono/mono/commit/927c608184b86b6c03958ba9aecec02340cd0661

5 years agoRemove mono_tls_get_tls_getter.
Jay Krell [Sat, 22 Jun 2019 19:10:31 +0000 (12:10 -0700)]
Remove mono_tls_get_tls_getter.

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

5 years agoReplace MONO_PATCH_INFO_GET_TLS_TRAMP with MONO_PATCH_INFO_JIT_ICALL_ADDR_NOCALL.
Jay Krell [Mon, 17 Jun 2019 08:24:00 +0000 (01:24 -0700)]
Replace MONO_PATCH_INFO_GET_TLS_TRAMP with MONO_PATCH_INFO_JIT_ICALL_ADDR_NOCALL.

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

5 years ago[sgen] Fix crashes in sgen due to xdomain refs
Vlad Brezae [Tue, 25 Jun 2019 08:24:06 +0000 (11:24 +0300)]
[sgen] Fix crashes in sgen due to xdomain refs

CADMessages are passed directly between appdomains. When using contained data, we need to make sure we don't create any cross domain references.

When domains are unloaded, all threads executing code in that appdomain are aborted and the entire heap is traversed and objects in that appdomain are cleared. If any objects in other domains are directly referencing objects in the unloaded domain, they will reference junk. If any, cross domain refs should only be allowed when the referenced object is in the root domain which is never unloaded.

Commit migrated from https://github.com/mono/mono/commit/6359520633d2ba1d2032892fe562cf14d4f1c540

5 years ago[interp] Reduce computation under calc_section mutex
Vlad Brezae [Tue, 25 Jun 2019 15:43:25 +0000 (18:43 +0300)]
[interp] Reduce computation under calc_section mutex

Calc_section mutex is meant to be a lower level mutex used only for synchronization on InterpMethod contents. Before this commit we were taking the loader mutex which was leading to deadlocks.

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

5 years agoAdd xunit-summary.py (mono/mono#15373)
Egor Bogatov [Wed, 26 Jun 2019 09:49:24 +0000 (12:49 +0300)]
Add xunit-summary.py (mono/mono#15373)

Commit migrated from https://github.com/mono/mono/commit/78b9c66501113469e081066ad6b500595a727b66

5 years ago[profiler] Add helper.h to tarball
Alexander Köplinger [Wed, 26 Jun 2019 08:41:38 +0000 (10:41 +0200)]
[profiler] Add helper.h to tarball

Commit migrated from https://github.com/mono/mono/commit/6307f0156c4bb85b64bd3d48a7f9e7832fc1cd2c

5 years ago[netcore] Fix build.sh (mono/mono#15380)
Ryan Lucia [Wed, 26 Jun 2019 03:58:41 +0000 (23:58 -0400)]
[netcore] Fix build.sh (mono/mono#15380)

* [netcore] Revert changes to build.sh

It appears to have accidentally been changed in mono/mono#15215, and the script no longer works correctly as a result, so revert

* Strip call to make

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

5 years ago[aot] Save the number of locals into the aot debug info so the method header doesn...
Zoltan Varga [Tue, 25 Jun 2019 17:26:17 +0000 (13:26 -0400)]
[aot] Save the number of locals into the aot debug info so the method header doesn't have to be decoded when its loaded.

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

5 years agoFix tarball build and refresh monolite due to memory model change (mono/mono#15370)
Jay Krell [Tue, 25 Jun 2019 20:14:42 +0000 (13:14 -0700)]
Fix tarball build and refresh monolite due to memory model change (mono/mono#15370)

* Revise monolite due to memory model change.

* Fix tarball builds wrt netcore/config.make.

* Remove System.Private.CoreLib from mcs/class/Makefile, it was moved to netcore/

* Bump min_mono_version in basic-profile-check

The new MONO_DEBUG=clr-memory-model runtime option isn't available in earlier Mono versions.

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

5 years ago[threads] Define interlocked_mutex as non-recursive and on 32bit platforms only ...
Jay Krell [Tue, 25 Jun 2019 18:56:38 +0000 (11:56 -0700)]
[threads] Define interlocked_mutex as non-recursive and on 32bit platforms only  (mono/mono#15393)

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

5 years ago[profiler] Add helper.c to static sources where needed (mono/mono#15400)
Radek Doulik [Tue, 25 Jun 2019 18:04:16 +0000 (11:04 -0700)]
[profiler] Add helper.c to static sources where needed (mono/mono#15400)

This should fix broken `OS X x64 iOS SDK` build.

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

5 years agoAdd cooperative suspend aware threads for hybrid suspend. (mono/mono#15204)
Johan Lorensson [Tue, 25 Jun 2019 15:40:39 +0000 (17:40 +0200)]
Add cooperative suspend aware threads for hybrid suspend. (mono/mono#15204)

* Add cooperative suspend aware threads for hybrid suspend.

When running in hybrid suspend and having threads in blocking mode, GC Safe
mode, threads will still be preemptive suspended. This is done to make sure
compatibility is kept with embedders since current embedding API is not coop
aware. If, however the external attached threads promise to follow the coop
rules for a thread in Safe mode, it could still be possible to have them
running, making sure they won't be preempted when running STW. Unlocking this
possibility could have large performance wins if embedding threads runs a lot
of native code on threads attached to runtime.

This commit adds support for a new pair of API's where an external thread can
mark itself as cooperative suspend aware. Doing that guarantees the runtime
that it will follow all rules as dictated by cooperative suspend when a thread
is in safe mode. The change only goes one way since this is a lifetime commitment
for a thread. Once’s set, thread will be kept running when in safe mode.

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

5 years ago[runtime] Refactor mono-debug.c. (mono/mono#15381)
Zoltan Varga [Tue, 25 Jun 2019 13:35:21 +0000 (09:35 -0400)]
[runtime] Refactor mono-debug.c. (mono/mono#15381)

* [debug] Refactor the code in mono-debug.c.

Store the domain->debug info table mapping in MonoDomain to avoid a hashtable lookup.
Rename MonoDebugDataTable to DebugDomainInfo to better reflect its meaning.

* Remove some mono_ prefixes from static functions, along with the full/internal prefixes.

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

5 years ago[aot profiler] Listen for commands on given port (mono/mono#14936)
Radek Doulik [Tue, 25 Jun 2019 10:17:45 +0000 (03:17 -0700)]
[aot profiler] Listen for commands on given port (mono/mono#14936)

* [aot profiler] Listen for commands on given port

Extended the aot profiler so, that it can receive commands over the network.

Added new option `port=PORT`, which enables command server and specifies
the port the server should listen at.

We have 2 commands so far.

    save ... save the profile data to socket and close it
    quit ... quit the profiler. it also saves the profile to the file
             in case the output option was specified.

It makes the aot profiling much easier to use on Android as we don't need to
save the profile to a file on the device. That means we don't need to set
`<application android:debuggable="true"/>` flag, which changes the Android
app behavior and thus influence the profile itself. It is also convenient way
for IDEs to retrieve the aot profiles.

Example use for Xamarin.Android. Save and receive the profile data:

adb shell setprop debug.mono.profile aot:verbose,port=9999
adb forward tcp:9999 tcp:9999
nc -v 127.0.0.1 9999 > profile.aotprof
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
outif lo0
src 127.0.0.1 port 50398
dst 127.0.0.1 port 9999
rank info not available
TCP aux info available

Connection to 127.0.0.1 port 9999 [tcp/distinct] succeeded!
save

Check what we received:

aotprofile-tool -sd profile.aotprof
Modules:
132475FF-85AA-430D-913C-7642CBD8587E mscorlib
F7BDCAB5-83D3-4A0A-A33D-BBE94284667D Mono.Android
22897151-27C9-4064-B001-8A04F5847812 System
AA3FC224-D486-4304-A8C9-EBF316556B26 Java.Interop
00D98403-051B-4168-A391-F3F601637CBD System.Core
FD06519A-C321-426C-BDD8-C97777452057 xat_latests_and_greatest_vsmac_8._1
9ECB003E-D449-438B-BE35-58810DCBC917 Xamarin.Android.Support.v7.AppCompat
11659962-EFAC-400D-9F8D-AF925B26AE41 Xamarin.Android.Support.Fragment
48C436F7-611D-470D-9949-AC13FFDCF613 Xamarin.Essentials
2792D10D-7E13-46E6-BB4A-933C25635F48 Xamarin.Android.Support.Design
Summary:
Modules:         10
Types:          221
Methods:        932

* Try to fix WIN32 compilation

* Add helper.c to mono-profiler-log.vcxproj

* Add helper.c to mono-profiler-log.vcxproj.filters as well

Commit migrated from https://github.com/mono/mono/commit/858b2b8405407770c131c1519a2fa889f796577f

5 years agoIncrease max size of localloc and localloc_imm on amd64. (mono/mono#15374)
Johan Lorensson [Tue, 25 Jun 2019 08:46:33 +0000 (10:46 +0200)]
Increase max size of localloc and localloc_imm on amd64. (mono/mono#15374)

We hit the following assert when doing full AOT of some assemblies:

wrong maximal instruction length of instruction localloc (expected 96, got 99)
Assertion: should not be reached at mono\mono\mini\mini-amd64.c:6801

Turns out that that size could be hit when a couple of things happens as part
of lowering OP_LOCALLOC and OP_LOCALLOC_IMM:

sreg1 is not RAX, RCX or RDI
dreg is not RAX, RCX or RDI
cfg->param_area is bigger than 127

Fix is to increase max size of the instruction, from 96 -> 120 (same as x86).

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

5 years agoAdd support for Windows x64 Full AOT + LLVM + Interpreter on CI. (mono/mono#15276)
Johan Lorensson [Tue, 25 Jun 2019 06:20:25 +0000 (08:20 +0200)]
Add support for Windows x64 Full AOT + LLVM + Interpreter on CI. (mono/mono#15276)

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

5 years ago[System.Private.CoreLib] Add new shared string resource
Marek Safar [Mon, 24 Jun 2019 18:09:35 +0000 (20:09 +0200)]
[System.Private.CoreLib] Add new shared string resource

Commit migrated from https://github.com/mono/mono/commit/7066c05c3931c2cfea3c8db4b1d56fc448060eeb

5 years ago[netcore] Disable more runtime functionality. (mono/mono#15369)
Zoltan Varga [Mon, 24 Jun 2019 18:47:00 +0000 (14:47 -0400)]
[netcore] Disable more runtime functionality. (mono/mono#15369)

Commit migrated from https://github.com/mono/mono/commit/1150d4a3e97bdc2a8dbd509db79046e59c0bc08c

5 years ago[wasm][debugger] Adding support to debug local vars in async methods (mono/mono#15357)
Thays Grazia [Mon, 24 Jun 2019 13:34:42 +0000 (10:34 -0300)]
[wasm][debugger] Adding support to debug local vars in async methods (mono/mono#15357)

- Improving performance calling only once mono_wasm_get_var_info.
- Adding support to debug local vars in async methods. They are special in the way that local variables can be lifted to generated class fields.

Commit migrated from https://github.com/mono/mono/commit/057f51d833f3d103730ad88a427407e3de251f6d

5 years agoFix race related to final event signaling in RegisteredWaitHandle. (mono/mono#15280)
Johan Lorensson [Mon, 24 Jun 2019 08:56:21 +0000 (10:56 +0200)]
Fix race related to final event signaling in RegisteredWaitHandle. (mono/mono#15280)

We have seen sporadic failures in thread pool tests on CI related to
test case:

System.Threading.ThreadPools.Tests.ThreadPoolTests.QueueRegisterPositiveAndFlowTest [FAIL]
      Assert.Equal() Failure
      Expected: 0
      Actual:   1
      Stack Trace:
          at System.Threading.ThreadPools.Tests.ThreadPoolTests.QueueRegisterPositiveAndFlowTest () [0x00143] in D:\j\workspace\z3\label\w64\external\corefx\src\System.Threading.ThreadPool\tests\ThreadPoolTests.cs:337
          at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
          at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in D:\j\workspace\z3\label\w64\mcs\class\corlib\System.Reflection\RuntimeMethodInfo.cs:395

Finally managed to track down the issue to a race when using the same final
event in sequential calls to RegisterWaitForSingleObject. The event could, depending on
timing, get signaled multiple times for the same RegisterWaitHandle instance
causing a thread waiting for completion on another RegisterWaitHandle using same event
to be signaled before that callback was completed. That will cause the race seen in the
failing test above.

Fix make sure we only signal the final event one time per RegisterWaitHandle
instance.

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

5 years ago[arm] set exception handling model to dwarf for iOS
Bernhard Urban [Fri, 21 Jun 2019 14:26:24 +0000 (16:26 +0200)]
[arm] set exception handling model to dwarf for iOS

We recently switched the AOT compiler for iOS armv7 from 32bit host to 64bit host. At the same time we _also_ switched from LLVM 3.6 to the newer LLVM 6.0 fork we support.

In a Xamarin.iOS Release build for iOS armv7 exception handling would crash. Specifically the problem was that the exception object wasn't properly injected into the handler block. The way it works is, that the exception handler machinery passes the pointer to the exception object via `r0`.

With the newer LLVM the generated code of the exception handling block
looks like this:
```
LBB1_15:                                @ %EH_CLAUSE0_BB3
Ltmp8:
ldr r0, [sp, mono/mono#24]
str r0, [sp, mono/mono#4]
ldr r0, [sp, mono/mono#28]
ldr r0, [sp, mono/mono#12]
ldr r0, [r0]
cmp r0, mono/mono#0
beq LBB1_17
```
thus overwriting `r0`, so that the pointer to the exception object is lost.  With the older LLVM 3.6 the generated code looks like this:
```
LBB1_8:                                 @ %EH_CLAUSE0_BB3
Ltmp8:
str r0, [sp, mono/mono#4]
ldr r0, [r6]
cmp r0, mono/mono#0
beq LBB1_10
```
correctly storing the exception object into a stack slot for later usage.

After some time I figured out that there are _different_ exception handling models. Depending on the model, the exception pointer is passed in `r0` or not:
https://github.com/mono/llvm/blob/mono/mono@2bd2f1db1803f7b36687e5abf912c69baa848305/lib/Target/ARM/ARMISelLowering.cpp#L14416-L14428

`SjLj` stands for "SetJump / LongJump" and  means that exception handling is implemented with this. On iOS this is the default model that is used. We want `dwarf` instead, so we tell this `llc` now and the generated code handles it correctly.

So why was it working before? In our older LLVM 3.6 fork we hardcoded it:
https://github.com/mono/llvm/blob/mono/mono@f80899cb3eb75f7f5640b4519e83bd96991bffb8/lib/Target/ARM/ARMISelLowering.cpp#L756-L762

The `-exception-model=` option is also not available in LLVM 3.6.

Contributes to https://github.com/mono/mono/issues/15058 and https://github.com/mono/mono/issues/9621

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

5 years ago[netcore] Remove unused icalls.
Zoltan Varga [Sat, 22 Jun 2019 06:39:32 +0000 (02:39 -0400)]
[netcore] Remove unused icalls.

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

5 years ago[mini] Support tracing pointer return values. (mono/mono#15356)
Zebediah Figura [Sat, 22 Jun 2019 16:57:49 +0000 (11:57 -0500)]
[mini] Support tracing pointer return values. (mono/mono#15356)

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

5 years ago[aot] Fix a deadlock in init_plt () by calling create_trampoline () outside the lock...
Zoltan Varga [Sat, 22 Jun 2019 03:35:57 +0000 (23:35 -0400)]
[aot] Fix a deadlock in init_plt () by calling create_trampoline () outside the lock. (mono/mono#15332)

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

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

5 years ago[arm64] Add location of this and rgctx arg
Vlad Brezae [Thu, 20 Jun 2019 12:35:43 +0000 (15:35 +0300)]
[arm64] Add location of this and rgctx arg

Used to fetch the value from async suspend stack frame, during exception handling.

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

5 years ago[arm] Add location of this and rgctx arg
Vlad Brezae [Thu, 20 Jun 2019 12:17:19 +0000 (15:17 +0300)]
[arm] Add location of this and rgctx arg

Used to fetch the value from async suspend stack frame, during exception handling.

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

5 years ago[amd64] Fix location saving for *this*
Vlad Brezae [Thu, 20 Jun 2019 11:57:31 +0000 (14:57 +0300)]
[amd64] Fix location saving for *this*

With static methods we were saving location for irrelevant argument.

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

5 years agoRemove three seemingly unused functions:
Jay Krell [Sat, 13 Apr 2019 09:21:40 +0000 (02:21 -0700)]
Remove three seemingly unused functions:
  mono_aot_init_gshared_method_this
  mono_aot_init_gshared_method_mrgctx
  mono_aot_init_gshared_method_vtable

Update comments that refer to them, to refer to the renames.
 mini_llvm_init instead of mono_aot_init.

See mono/mono@80bc0069e494db1a67480ed25db8f6f6ad9fc605 and mono/mono@04d65f29866cc7cfdcfced9a04ec54b4d7e2637e.

I'm here because I broke something nearby in a work-in-progress PR
and the existance of these functions made me look into them.

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

5 years agoAdd basic implementation of Environment.FailFast (mono/mono#15279)
Filip Navara [Fri, 21 Jun 2019 16:52:13 +0000 (18:52 +0200)]
Add basic implementation of Environment.FailFast (mono/mono#15279)

* Add basic implementation of Environment.FailFast

* Add comment about __failfast on Windows 8+

* Re-add some test exclusions and clarify the comment around them

* Update icall.c

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

5 years ago[api] Add a mono/metadata/profiler-legacy.h header (mono/mono#15098)
Aleksey Kliger (λgeek) [Fri, 21 Jun 2019 16:47:26 +0000 (12:47 -0400)]
[api] Add a mono/metadata/profiler-legacy.h header (mono/mono#15098)

* [api] Add mono/metadata/profiler-legacy.h header

Add a header with the legacy Mono profiler API.  New code should use the API
from mono/metadata/profiler.h.

* [profiler] Mark the legacy profiler API with MONO_DEPRECATED

* [runtime] Don't install the profiler-legacy.h header

Make the decision later whether these should be in the set of public API headers

Commit migrated from https://github.com/mono/mono/commit/71ceefccf68a0dbcf2a2fe6aa4064e831dbdb413

5 years agoUpdate Makefile
Egor Bogatov [Fri, 21 Jun 2019 10:28:20 +0000 (13:28 +0300)]
Update Makefile

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

5 years agofix build-test-corefx command
EgorBo [Fri, 21 Jun 2019 08:18:35 +0000 (11:18 +0300)]
fix build-test-corefx command

Commit migrated from https://github.com/mono/mono/commit/44cba4e4423cdd2d15c63452c1bd63b11c1aadeb

5 years agoMake copy_stack_data support configurable.
lateralusX [Fri, 17 May 2019 16:33:09 +0000 (18:33 +0200)]
Make copy_stack_data support configurable.

By default when called through macros like MONO_ENTER_GC_UNSAFE
code will always dump current registers into stack space on hybrid/coop.
The registers will be scanned but only when hitting a GC and when running
in GC unsafe, that will only happen when we block in the enter or hit a safe
point at a later point in time. There are currently a couple of frequent
scenarios where we go into GC safe when thread won't be suspended and in
that case the copy of the registers will only reflect the state when
entering GC unsafe.

Commits add option to enable/disable copy_stack_data support in configure step:
--enable-copy-stack-data, --disable-copy-stack-data.

copy_stack_data is enabled by default on all platforms except desktop platforms
macos, linux and windows (both 32/64-bit), since these platforms already support
full context as well as capabilities to scan the stack of a running thread.

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

5 years agoMerge pull request mono/mono#15293 from lewing/wasm-clean
Larry Ewing [Fri, 21 Jun 2019 03:21:08 +0000 (22:21 -0500)]
Merge pull request mono/mono#15293 from lewing/wasm-clean

[wasm] Add some missing directories to the clean target

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

5 years agoMerge pull request mono/mono#15291 from lewing/doublecheck-290
Larry Ewing [Fri, 21 Jun 2019 01:46:39 +0000 (20:46 -0500)]
Merge pull request mono/mono#15291 from lewing/doublecheck-290

[wasm] Add an explicit test for https://github.com/dotnet/try/issues/290

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

5 years ago[loader] remap only System.Threading.Tasks.Dataflow older than 4.0.0.0 (mono/mono...
Aleksey Kliger (λgeek) [Thu, 20 Jun 2019 23:25:44 +0000 (19:25 -0400)]
[loader] remap only System.Threading.Tasks.Dataflow older than 4.0.0.0 (mono/mono#15266)

[loader] remap only System.Threading.Tasks.Dataflow older than 4.0.0.0

Allow through requests for newer versions unchanged.

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

5 years ago[debugger] Debugger doesn't break on unhandled exceptions (mono/mono#15234)
Thays Grazia [Thu, 20 Jun 2019 22:48:13 +0000 (19:48 -0300)]
[debugger] Debugger doesn't break on unhandled exceptions  (mono/mono#15234)

* When the catch found is in a MONO_WRAPPER_RUNTIME_INVOKE the exception should be treated as an UNHANDLED by the debugger.

* Adding unit test.

* trying to fix side effect.

* I've tested the MonoTests.DebuggerTests.UnhandledException_2 test on VsWin using .net Framework and I think the test is wrong because the first break is in throw and the next break will be on breakpoint.
In our implementation we were ignoring the unhandled exception and stopping only on breakpoint.

Commit migrated from https://github.com/mono/mono/commit/405d521149b8fe4caef2eaa3665e5f6020ef298b

5 years ago[jit] Make alias analysis properly handle alias cloberring (mono/mono#15255)
Vlad Brezae [Thu, 20 Jun 2019 18:35:18 +0000 (21:35 +0300)]
[jit] Make alias analysis properly handle alias cloberring (mono/mono#15255)

Alias analysis attempts to remove indirection when using OP_LDADDR (which fetches the address of a variable). For example :

ldaddr r1 <- r0
load_mem r2 <- r1

is equivalent to

mov r2 <- r0

The remembered r1 alias needs to be forgotten in case r1 is changed. We were handling this for direct assignment with MOV, but not for the more subtle case where an alias to r1 would be passed to a call, which could lead to changing r1.

https://github.com/mono/mono/issues/14872

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

5 years ago[jit] Add debug option for using clr memory model (mono/mono#15019)
Vlad Brezae [Thu, 20 Jun 2019 16:18:26 +0000 (19:18 +0300)]
[jit] Add debug option for using clr memory model (mono/mono#15019)

* [jit] Move value storing in a new write barrier emitting method

Brings together ref storing and the write barrier generation.

* [jit] Add debug option to attempt using the CLR memory model

Which prevents reordering of stores. Part of the way this is done on CoreCLR is by adding memory barriers to the write barrier, so we attempt a similar behavior.

This is not a complete implementation.

* [build] Add memory model flag to csc when building the bcl

This should prevent random crashes during the build

* [build] Add memory model flag to compiler server

* [build] Add memory model flag to test building

Commit migrated from https://github.com/mono/mono/commit/1120e823123d76a4c2a04fe06612f377978dc866

5 years ago[Coop] Establish handle frame in reflection_setup_internal_class. (mono/mono#15248)
Jay Krell [Thu, 20 Jun 2019 15:00:37 +0000 (08:00 -0700)]
[Coop] Establish handle frame in reflection_setup_internal_class. (mono/mono#15248)

It is called in a loop by ves_icall_TypeBuilder_create_runtime_class.
See https://github.com/mono/mono/issues/15247.

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

5 years agoWrite to the same union member that is later read. (mono/mono#15269)
Jay Krell [Thu, 20 Jun 2019 14:57:04 +0000 (07:57 -0700)]
Write to the same union member that is later read. (mono/mono#15269)

It should not matter in this case, but it is the usual practise,
and not strictly valid otherwise.

Commit migrated from https://github.com/mono/mono/commit/2104d1d957b95eca2793d2bb2e89083b0104d236

5 years ago[interp] Optimize CEE_MONO_TLS due their being only one live producer. (mono/mono...
Jay Krell [Thu, 20 Jun 2019 13:39:20 +0000 (06:39 -0700)]
[interp] Optimize CEE_MONO_TLS due their being only one live producer. (mono/mono#15245)

There is a dead producer in Boehm. (see https://github.com/mono/mono/pull/15241)
This combined with https://github.com/mono/mono/pull/15226
will leave no remaining uses of mono_tls_get_tls_getter.

If there were really multiple values of the enum, consider
doing the switch in transform instead of interp.

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

5 years agoFix arcade stuff
Egor Bogatov [Thu, 20 Jun 2019 09:32:04 +0000 (12:32 +0300)]
Fix arcade stuff

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

5 years agoAdd Windows x64 Full AOT Interpreter support on CI. (mono/mono#15127)
Johan Lorensson [Thu, 20 Jun 2019 07:23:39 +0000 (09:23 +0200)]
Add Windows x64 Full AOT Interpreter support on CI. (mono/mono#15127)

Add support to run full interpreter test suite on CI for Windows x64 Full AOT.
Since Windows x64 Full AOT uses a different full AOT profile WinAOT a separate
testing profile was setup for the interpreter testing. NOTE, this profile is
pure for testing, inline with the other testing profiles. It is also reusing
most of its sources from other sources files (mainly WinAOT) to reduce maintenance
of the profile.

Commit also includes some smaller adjustments needed in order to get full
pass rate for Windows x64 Full AOT + Interpreter on CI.

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

5 years ago[coop] Mark a few functions with MONO_PROFILER_API
Aleksey Kliger [Mon, 17 Jun 2019 22:10:34 +0000 (18:10 -0400)]
[coop] Mark a few functions with MONO_PROFILER_API

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

5 years ago[runtime] Don't do GC Unsafe transition in mono_gchandle_free
Aleksey Kliger [Mon, 17 Jun 2019 17:50:21 +0000 (13:50 -0400)]
[runtime] Don't do GC Unsafe transition in mono_gchandle_free

Xamarin.Mac can call back here from a native thread that isn't attached to the
runtime.  SGen gchandle code is lockfree, and the profiler event can fire
without involving Mono.

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

5 years ago[profiler] Don't switch to GC Safe when locking if thread isn't attached to the
Aleksey Kliger [Mon, 17 Jun 2019 17:47:42 +0000 (13:47 -0400)]
[profiler] Don't switch to GC Safe when locking if thread isn't attached to the
runtime.

Some profiler events (for example gc_handle_deleted) could be raised on threads
that aren't attached to the runtime.  Since the thread won't participate in
Mono's stop the world (since the runtime can't see it), there's no need to do
the transition to GC Safe while the thread is trying to grab the profiler
buffer lock.

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

5 years agoFix compiler warnings. (mono/mono#15196)
Jay Krell [Wed, 19 Jun 2019 22:18:32 +0000 (15:18 -0700)]
Fix compiler warnings. (mono/mono#15196)

* Fix compiler warnings.
 unused variable: save_sigint
 unused variable: mono_environ
 uprototyed function: mono_marshal_xdomain_copy_value

* add static

Commit migrated from https://github.com/mono/mono/commit/09869a9c8b6d2e78dffc7bab8d7845ff5c19cd0b

5 years agoRemove unused MONO_PATCH_INFO_SET_TLS_TRAMP, corresponding unused JIT icalls, etc...
Jay Krell [Wed, 19 Jun 2019 20:25:35 +0000 (13:25 -0700)]
Remove unused MONO_PATCH_INFO_SET_TLS_TRAMP, corresponding unused JIT icalls, etc. (mono/mono#15201)

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

5 years agoCorrectly set ReflectionType with inherited generic methods (mono/mono#15233)
Ryan Lucia [Wed, 19 Jun 2019 17:08:39 +0000 (13:08 -0400)]
Correctly set ReflectionType with inherited generic methods (mono/mono#15233)

* Correctly set ReflectionType with inherited generic methods

* Allow ValueType

* Re-enable relevant test

* Switch to mono_class_from_mono_type_internal

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

5 years ago[jit] Avoid calling mini_jit_info_table_find () in mini_add_method_trampoline ()...
Zoltan Varga [Wed, 19 Jun 2019 14:52:27 +0000 (10:52 -0400)]
[jit] Avoid calling mini_jit_info_table_find () in mini_add_method_trampoline () unless needed. (mono/mono#15239)

Commit migrated from https://github.com/mono/mono/commit/7341c9f6362bd9804507a72a2738ecc5f531e3f8

5 years ago[netcore] Update the checks for ByRef return type in reflection invocation (mono...
Filip Navara [Wed, 19 Jun 2019 06:51:44 +0000 (08:51 +0200)]
[netcore] Update the checks for ByRef return type in reflection invocation (mono/mono#14967)

* Update the checks for ByRef return type in reflection invocation to also check for IsByRefLike types. This was missed as part of mono/mono#13901 and noted in the description.

Fixes mono/mono#14959, mono/mono#14960, mono/mono#14961, mono/mono#14963

* Modify the reflection checks for IsByRef/IsByRefLike to check for same conditions as CoreCLR

* Handle reflection invocation with ref void return type

* Update test-ref-07 to have Main method that is valid to invoke through reflection (as the test runner does)

* Update expected IL

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

5 years ago[interp] Implement tracing of return values. Improve printing of arrays. (mono/mono...
Zoltan Varga [Wed, 19 Jun 2019 03:03:13 +0000 (23:03 -0400)]
[interp] Implement tracing of return values. Improve printing of arrays. (mono/mono#15217)

Commit migrated from https://github.com/mono/mono/commit/611ba9a0180ed40c161245c7e82e00063ef58d08

5 years ago[filewatcher] Fall back to default if a new instance cannot be created
Alexis Christoforides [Fri, 25 Jan 2019 22:02:25 +0000 (17:02 -0500)]
[filewatcher] Fall back to default if a new instance cannot be created

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

5 years ago[arm] fix some more host/target pointer size issues (mono/mono#15223)
Bernhard Urban [Tue, 18 Jun 2019 21:46:00 +0000 (23:46 +0200)]
[arm] fix some more host/target pointer size issues (mono/mono#15223)

[arm] fix some more host/target pointer size issues

As suggested by Jay in https://github.com/mono/mono/issues/15058#issuecomment-501995400

I haven't seen fixing it any specific issue, but we should still backport it to `2019-06` in order to avoid hard-to-debug regressions.

Contributes to https://github.com/mono/mono/issues/9621

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

5 years ago[mini] fix OP_SEQ_POINT of other backends regarding target pointer size (mono/mono...
Bernhard Urban [Tue, 18 Jun 2019 21:06:55 +0000 (23:06 +0200)]
[mini] fix OP_SEQ_POINT of other backends regarding target pointer size (mono/mono#15222)

See https://github.com/mono/mono/pull/15205#issuecomment-502925368

Theoretically fixes cross compilation on a 32bit host to a 64bit target.

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

5 years ago[netcore] Don't default to an empty array for a null publicKey
Ryan Lucia [Mon, 17 Jun 2019 17:44:44 +0000 (13:44 -0400)]
[netcore] Don't default to an empty array for a null publicKey

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

5 years ago[eglib] Don't escape chars in argv parsing enclosed in single quotes (mono/mono#15047)
Ryan Lucia [Tue, 18 Jun 2019 17:30:31 +0000 (13:30 -0400)]
[eglib] Don't escape chars in argv parsing enclosed in single quotes (mono/mono#15047)

Fixes mono/mono#14724

This may need to be reverted if customers are relying on the existing behavior, but we can cross that bridge when we come to it.

The larger issue of incompatibility with .NET Core should be addressed later.

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

5 years agoMirror changes from mono/corefx,corert,coreclr (mono/mono#15221)
Marek Safar [Tue, 18 Jun 2019 10:44:36 +0000 (12:44 +0200)]
Mirror changes from mono/corefx,corert,coreclr (mono/mono#15221)

Mirror changes from mono/corefx,corert,coreclr

Commit migrated from https://github.com/mono/mono/commit/3428cec00312570613ff8f8467ff2e6e6cd4e666

5 years ago[netcore] Excluded tests update
Marek Safar [Tue, 18 Jun 2019 09:25:51 +0000 (11:25 +0200)]
[netcore] Excluded tests update

Commit migrated from https://github.com/mono/mono/commit/7052e60600c9df87bab11574723673bd3a31a1c5