Marek Safar [Mon, 17 Jun 2019 18:19:40 +0000 (20:19 +0200)]
[System.Private.CoreLib] Align on CA naming for easier sharing
Commit migrated from https://github.com/mono/mono/commit/
879c8501c946571d4c9e0bdfa70662d1aa2c249a
naricc [Tue, 18 Jun 2019 07:08:21 +0000 (03:08 -0400)]
Implement GC.GetAllocatedBytes (mono/mono#14779)
Commit migrated from https://github.com/mono/mono/commit/
ac2894920ac4b6f7b384ac73756b744215dc05a5
Bernhard Urban [Tue, 18 Jun 2019 06:46:01 +0000 (08:46 +0200)]
[arm] use target_mgreg_t instead of plain pointer type in sdb breakpoint (mono/mono#15205)
[arm] use target_mgreg_t instead of plain pointer type in sdb breakpoint
Fixes Debug mode for iOS 32bit.
Contributes to https://github.com/mono/mono/issues/15058 & https://github.com/mono/mono/issues/9621
Diff before (left old cross32, right new cross32 running on amd64 host _before_ this fix):
<img width="1257" alt="Screenshot 2019-06-17 at 14 09 51" src="https://user-images.githubusercontent.com/75403/
59603413-
a9bd4f00-9109-11e9-8f18-
aa7b4ca5817f.png">
/cc @mandel-macaque
Commit migrated from https://github.com/mono/mono/commit/
d5a35798c620ebd47d7a317014c4f32974d0a748
Jay Krell [Mon, 17 Jun 2019 08:09:57 +0000 (01:09 -0700)]
Allocate MonoJumpInfo instead of MonoAotCompile.
Commit migrated from https://github.com/mono/mono/commit/
fc74334e20ac1149959aaffe8a6befa8a671e48f
Jay Krell [Fri, 14 Jun 2019 04:38:43 +0000 (21:38 -0700)]
Revert "threads.c:6403:6: warning: 'current_idx' may be used uninitialized in this function [-Wmaybe-uninitialized]"
This reverts commit mono/mono@
bf2f1abe01978102c22d76b4a10996e8d8b50b0f.
The logic is not clear as to if there is a bug, so leave the warning.
There are two uses of the possibly uninitialized variable.
One is guarded and not a bug.
The other is not clear, and don't want to blindly use 0.
Commit migrated from https://github.com/mono/mono/commit/
a97408ac1e9b1e0dedbd67424ca0b0a6fc7b73b6
Jay Krell [Fri, 14 Jun 2019 04:36:41 +0000 (21:36 -0700)]
PR: Restore nearby unusual formatting.
Commit migrated from https://github.com/mono/mono/commit/
af2c235f318999b820fee48208916ce3e9de75c4
Jay Krell [Thu, 13 Jun 2019 09:09:58 +0000 (02:09 -0700)]
intrinsics.c: In function 'mini_emit_inst_for_method':
intrinsics.c:1580:11: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
*dest = result;
~~~~~~^~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
9c70b53cc39bd1347ed714e7a2e567a0c761246a
Jay Krell [Thu, 13 Jun 2019 09:05:18 +0000 (02:05 -0700)]
debugger-engine.c: In function 'set_bp_in_method':
debugger-engine.c:354:11: warning: variable 'code' set but not used [-Wunused-but-set-variable]
gpointer code;
^~~~
Commit migrated from https://github.com/mono/mono/commit/
6e19637797f6b30087d945b87df3248a8fc65daa
Jay Krell [Thu, 13 Jun 2019 09:04:24 +0000 (02:04 -0700)]
tramp-arm64-gsharedvt.c: In function 'mono_arch_get_gsharedvt_trampoline':
tramp-arm64-gsharedvt.c:217:54: warning: variable 'callee_stack_area_offset' set but not used [-Wunused-but-set-variable]
int caller_reg_area_offset, callee_reg_area_offset, callee_stack_area_offset;
^~~~~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
496cb4cfce595d13cb333f09e47ceb710c4f7c06
Jay Krell [Thu, 13 Jun 2019 09:01:57 +0000 (02:01 -0700)]
mini-arm64-gsharedvt.c: In function 'mono_arch_get_gsharedvt_call_info':
mini-arm64-gsharedvt.c:142:29: warning: variable 'gsig' set but not used [-Wunused-but-set-variable]
MonoMethodSignature *sig, *gsig;
^~~~
Commit migrated from https://github.com/mono/mono/commit/
179b5e85cf58c6f6653c2e184706a9515c3216af
Jay Krell [Thu, 13 Jun 2019 08:59:35 +0000 (01:59 -0700)]
interp/mintops.c: In function 'mono_interp_dis_mintop':
interp/mintops.c:87:37: warning: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Wformat=]
g_string_append_printf (str, " %lld", (gint64)READ64 (ip + 1));
Commit migrated from https://github.com/mono/mono/commit/
b504d7e6d89c94ae7b00145afd3ff0b06813553b
Jay Krell [Thu, 13 Jun 2019 08:58:12 +0000 (01:58 -0700)]
In file included from object.c:40:0:
object.c: In function 'mono_class_proxy_vtable':
../../mono/metadata/profiler-private.h:191:4: warning: 'pvt' may be used uninitialized in this function [-Wmaybe-uninitialized]
mono_profiler_raise_ ## name args; \
^~~~~~~~~~~~~~~~~~~~
object.c:2338:19: note: 'pvt' was declared here
MonoVTable *vt, *pvt;
^~~
Commit migrated from https://github.com/mono/mono/commit/
452209414ea9f9863758e63c4d0307572e45f755
Jay Krell [Thu, 13 Jun 2019 08:56:33 +0000 (01:56 -0700)]
w32file-unix.c: In function 'mono_w32file_get_file_size':
w32file-unix.c:4994:19: warning: 'length_hi' may be used uninitialized in this function [-Wmaybe-uninitialized]
return length | ((gint64)length_hi << 32);
^~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
bdb20ebd803c4ffa2317cdae949a4259e77ebbfd
Jay Krell [Thu, 13 Jun 2019 08:54:40 +0000 (01:54 -0700)]
interp/interp.c: In function 'interp_entry.constprop':
interp/interp.c:1847:3: warning: 'orig_domain' may be used uninitialized in this function [-Wmaybe-uninitialized]
mono_threads_detach_coop (orig_domain, &attach_cookie);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
457d0f02c5a39c268394f09d8f545db6123d4ae7
Jay Krell [Thu, 13 Jun 2019 08:52:20 +0000 (01:52 -0700)]
image.c:1351:20: warning: variable 'header' set but not used [-Wunused-but-set-variable]
MonoDotNetHeader *header;
^~~~~~
Commit migrated from https://github.com/mono/mono/commit/
3357a1a6119ddf1bed961d8ac5b578ec08c2015d
Jay Krell [Thu, 13 Jun 2019 08:50:36 +0000 (01:50 -0700)]
exception.c:747:1: warning: 'mono_new_exception_argument_out_of_range' defined but not used [-Wunused-function]
mono_new_exception_argument_out_of_range (const char *arg, MonoError *error)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
00570db6a4d7bf5c87e5508c0e4f097fde6c04aa
Jay Krell [Thu, 13 Jun 2019 08:49:29 +0000 (01:49 -0700)]
os-event-unix.c: In function 'mono_os_event_wait_multiple':
os-event-unix.c:195:12: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
elapsed = mono_msec_ticks () - start;
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
bc5d1a48d802fff39383f54b601d9e5fdab6a1df
Jay Krell [Thu, 13 Jun 2019 08:47:52 +0000 (01:47 -0700)]
In file included from ../../mono/eglib/glib.h:45:0,
from os-event.h:9,
from os-event-unix.c:11:
../../mono/eglib/eglib-remap.h:146:25: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]
#define g_ptr_array_add monoeg_g_ptr_array_add
^~~~~~~~~~~~~~~~~~~~~~
os-event-unix.c:121:19: note: 'data' was declared here
OSEventWaitData *data;
^~~~
Commit migrated from https://github.com/mono/mono/commit/
96129ba873ef4a31212a90be8f3137f39f9ead56
Jay Krell [Thu, 13 Jun 2019 08:46:19 +0000 (01:46 -0700)]
marshal.c: In function 'mono_marshal_get_runtime_invoke_full':
marshal.c:2662:8: warning: 'sig_cache' may be used uninitialized in this function [-Wmaybe-uninitialized]
res = (MonoMethod *)g_hash_table_lookup (sig_cache, sig_key);
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
faadb64774f9db09b2e026c43e3682b9268d9a25
Jay Krell [Thu, 13 Jun 2019 08:44:53 +0000 (01:44 -0700)]
sgen-mono.c:260:1: warning: 'install_noilgen' defined but not used [-Wunused-function]
install_noilgen (void)
Commit migrated from https://github.com/mono/mono/commit/
64c321293b42823e4a798fd7490359de6ab1abd6
Jay Krell [Thu, 13 Jun 2019 08:43:47 +0000 (01:43 -0700)]
In file included from sgen-new-bridge.c:31:0:
sgen-dynarray.h:331:1: warning: 'dyn_array_ptr_set_all' defined but not used [-Wunused-function]
dyn_array_ptr_set_all (DynPtrArray *dst, DynPtrArray *src)
^~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
0b5b42f6c7fbf13dcd30681271f11db252f5a651
Jay Krell [Thu, 13 Jun 2019 08:41:30 +0000 (01:41 -0700)]
threads.c:6403:6: warning: 'current_idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (i == current_idx)
^
threads.c:6549:6: note: 'current_idx' was declared here
int current_idx;
^~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
e94887a18ce1c0e0b6d240bd111a15ada01982d8
Jay Krell [Thu, 13 Jun 2019 08:41:01 +0000 (01:41 -0700)]
sgen-dynarray.h:248:1: warning: 'dyn_array_ptr_set' defined but not used [-Wunused-function]
dyn_array_ptr_set (DynPtrArray *da, int x, void *ptr)
^~~~~~~~~~~~~~~~~
sgen-dynarray.h:202:1: warning: 'dyn_array_ptr_init' defined but not used [-Wunused-function]
dyn_array_ptr_init (DynPtrArray *da)
^~~~~~~~~~~~~~~~~~
sgen-dynarray.h:194:1: warning: 'dyn_array_int_is_copy' defined but not used [-Wunused-function]
dyn_array_int_is_copy (DynIntArray *da)
^~~~~~~~~~~~~~~~~~~~~
sgen-dynarray.h:188:1: warning: 'dyn_array_int_copy' defined but not used [-Wunused-function]
dyn_array_int_copy (DynIntArray *dst, DynIntArray *src)
^~~~~~~~~~~~~~~~~~
sgen-dynarray.h:182:1: warning: 'dyn_array_int_ensure_independent' defined but not used [-Wunused-function]
dyn_array_int_ensure_independent (DynIntArray *da)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sgen-dynarray.h:168:1: warning: 'dyn_array_int_get' defined but not used [-Wunused-function]
dyn_array_int_get (DynIntArray *da, int x)
^~~~~~~~~~~~~~~~~
sgen-dynarray.h:161:1: warning: 'dyn_array_int_add' defined but not used [-Wunused-function]
dyn_array_int_add (DynIntArray *da, int x)
^~~~~~~~~~~~~~~~~
sgen-dynarray.h:147:1: warning: 'dyn_array_int_size' defined but not used [-Wunused-function]
dyn_array_int_size (DynIntArray *da)
^~~~~~~~~~~~~~~~~~
sgen-dynarray.h:141:1: warning: 'dyn_array_int_uninit' defined but not used [-Wunused-function]
dyn_array_int_uninit (DynIntArray *da)
^~~~~~~~~~~~~~~~~~~~
sgen-dynarray.h:135:1: warning: 'dyn_array_int_init' defined but not used [-Wunused-function]
dyn_array_int_init (DynIntArray *da)
^~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
67680a2e81a5da19750fe0f0442fb02b905b2629
Jay Krell [Thu, 13 Jun 2019 08:34:58 +0000 (01:34 -0700)]
In file included from sre.c:30:0:
../../mono/metadata/reflection-cache.h:43:1: warning: 'free_reflected_entry' defined but not used [-Wunused-function]
free_reflected_entry (ReflectedEntry *entry)
^~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
ae357bebbd2c072c3b9485e458216b1076fae342
Jay Krell [Thu, 13 Jun 2019 08:33:41 +0000 (01:33 -0700)]
sre.c:2067:1: warning: 'is_sr_mono_field' defined but not used [-Wunused-function]
is_sr_mono_field (MonoClass *klass)
^~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
cc60fe04d0f5befd33b453e78c53f16490455540
Jay Krell [Thu, 13 Jun 2019 08:32:04 +0000 (01:32 -0700)]
w32handle.c: In function 'mono_w32handle_wait_multiple':
w32handle.c:1146:13: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
elapsed = mono_msec_ticks () - start;
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
54366ee658c62f2eb49863450a4110ca1db8c109
Jay Krell [Thu, 13 Jun 2019 08:30:50 +0000 (01:30 -0700)]
custom-attrs.c:269:1: warning: 'load_cattr_type_object' defined but not used [-Wunused-function]
load_cattr_type_object (MonoImage *image, MonoType *t, gboolean header, const char *p, const char *boundp, const char **end, MonoError *error, guint32 *slen)
^~~~~~~~~~~~~~~~~~~~~~
Commit migrated from https://github.com/mono/mono/commit/
f2f5c45d9d7255800f08d19ee397efff681c5da4
Jay Krell [Thu, 13 Jun 2019 08:29:45 +0000 (01:29 -0700)]
sre-save.c:114:1: warning: 'swap_with_size' defined but not used [-Wunused-function]
swap_with_size (char *dest, const char* val, int len, int nelem) {
Commit migrated from https://github.com/mono/mono/commit/
267a75f3656418c84eef65df653bda5b5843ee37
Jay Krell [Thu, 13 Jun 2019 08:25:57 +0000 (01:25 -0700)]
mono-mmap.c: In function 'mono_file_map_error':
mono-mmap.c:401:82: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type 'guint64 {aka long unsigned int}' [-Wformat=]
*error_message = g_strdup_printf ("%s failed file:%s length:0x%zX offset:0x%lluX error:%s(0x%X)\n",
Commit migrated from https://github.com/mono/mono/commit/
404a03b87e92eeb500d68c55465248737d609d9d
Jay Krell [Thu, 13 Jun 2019 08:24:12 +0000 (01:24 -0700)]
threadpool.c: In function 'mono_threadpool_remove_domain_jobs':
threadpool.c:571:91: warning: 'end' may be used uninitialized in this function [-Wmaybe-uninitialized]
res = mono_coop_cond_timedwait (&tpdomain->cleanup_cond, &threadpool.domains_lock, end - now);
Commit migrated from https://github.com/mono/mono/commit/
a37f71a4ea64703100f89ba4108fce661ebae317
Egor Bogatov [Mon, 17 Jun 2019 18:01:13 +0000 (21:01 +0300)]
fix RuntimeType.cs
Commit migrated from https://github.com/mono/mono/commit/
c04dc84a9f65e6f67ff70032db6faaf7a391de0c
Jay Krell [Fri, 14 Jun 2019 07:52:48 +0000 (00:52 -0700)]
Fix race conditions in mono_lazy_initialize,
which is meant to be all about handling race conditions.
1. Less severe:
Add missing read barrier to mono_lazy_initialize().
This is unfortunate.
The general pattern of:
if initialized
use the data
else:
initialize the data, possibly with lots of locks and barriers
mark initialized
is racy, because "use the data" can be scheduled ahead of "if initialized".
"Barriers come in pairs" generally, and this was missing one.
It depends somewhat. If the data is all pointers, initialized in the else path,
from null to non-null, and use includes dereferencing, which is a common
but not universal case, then it is ok on all non-Alpha processors, due
to "data dependency".
But if the data includes reading globals, then there is a race.
This is a bit of a slow down on fast paths on arm, and possibly
other architectures.
There are barrier-free ways to solve this, involving a thread local,
that should seriously be considered, and applied throughout the runtime.
The runtime has a lot of on-demand initialization and a lot of looks racy.
See www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm.
Which would have to be adopted to be coop-friendly which should not be difficult.
Notice that the existing "lazy" mechanism is also not coop-friendly.
That is not changed by this PR.
2. Change `status` to `*lazy_init` to fix severe race condition.
Commit migrated from https://github.com/mono/mono/commit/
7d824dc2ae19e8bfb712ee057a3ccdf1c08564bd
Jay Krell [Mon, 17 Jun 2019 05:25:53 +0000 (22:25 -0700)]
Replace MONO_PATCH_INFO_TRAMPOLINE_FUNC_ADDR with MONO_PATCH_INFO_JIT_ICALL_ADDR. (mono/mono#15053)
* Replace MONO_PATCH_INFO_TRAMPOLINE_FUNC_ADDR with MONO_PATCH_INFO_JIT_ICALL_ADDR.
* PR: Abstract the TrampolineType / jit_icall_id translation.
Commit migrated from https://github.com/mono/mono/commit/
8966528c211b549cb682ae5157fc40d013080d0c
Vlad Brezae [Sat, 15 Jun 2019 21:25:06 +0000 (00:25 +0300)]
[interp] Prefer interp_in wrappers over trampolines (mono/mono#14684)
[interp] Prefer interp_in wrappers over trampolines
Commit migrated from https://github.com/mono/mono/commit/
fd089b6e4deef849d5def3a1c6efe8046052846e
Aleksey Kliger [Mon, 8 Apr 2019 19:50:38 +0000 (15:50 -0400)]
[debugger-agent] Ignore thread_end event if thread is detached
The thread_stopped profiler event can be raised by the thread_info_key_dtor tls
key destructor when the thread is already doesn't have a domain set. In that
case, don't call process_profiler_event since it cannot handle a thread with
null TLS values.
Addresses https://github.com/xamarin/xamarin-android/issues/2920
with the following stack trace
```
* thread mono/mono#20, name = 'Filter', stop reason = signal SIGSEGV: invalid address (fault address: 0xbc)
* frame mono/mono#0: libmonosgen-2.0.so`mono_class_vtable_checked(domain=0x0000000000000000, klass=0x0000007200230648, error=0x00000071e92f9178) at object.c:1890
frame mono/mono#1: libmonosgen-2.0.so`get_current_thread_ptr_for_domain(domain=0x0000000000000000, thread=0x00000071ebfec508) at threads.c:595
frame mono/mono#2: libmonosgen-2.0.so`mono_thread_current at threads.c:1939
frame mono/mono#3: libmonosgen-2.0.so`process_event(event=<unavailable>, arg=<unavailable>, il_offset=<unavailable>, ctx=<unavailable>, events=<unavailable>, suspend_policy=<unavailable>) at debugger-agent.c:3715
frame mono/mono#4: libmonosgen-2.0.so`thread_end [inlined] process_profiler_event(event=EVENT_KIND_THREAD_DEATH, arg=0x00000071ebfec508) at debugger-agent.c:3875
frame mono/mono#5: libmonosgen-2.0.so`thread_end(prof=<unavailable>, tid=<unavailable>) at debugger-agent.c:3991
frame mono/mono#6: libmonosgen-2.0.so`mono_profiler_raise_thread_stopped(tid=<unavailable>) at profiler-events.h:105
frame mono/mono#7: libmonosgen-2.0.so`mono_thread_detach_internal(thread=<unavailable>) at threads.c:979
frame mono/mono#8: libmonosgen-2.0.so`thread_detach(info=0x00000071e949a000) at threads.c:3215
frame mono/mono#9: libmonosgen-2.0.so`unregister_thread(arg=<unavailable>) at mono-threads.c:544
frame mono/mono#10: libmonosgen-2.0.so`thread_info_key_dtor(arg=0x00000071e949a000) at mono-threads.c:774
frame mono/mono#11: 0x00000072899c58e8 libc.so`pthread_key_clean_all() + 124
frame mono/mono#12: 0x00000072899c5374 libc.so`pthread_exit + 76
frame mono/mono#13: 0x00000072899c5264 libc.so`__pthread_start(void*) + 44
frame mono/mono#14: 0x000000728996617c libc.so`__start_thread + 72
```
Commit migrated from https://github.com/mono/mono/commit/
8a0495ea3b973ae9cc2ab8662e0f815f3d08195b
Marek Safar [Fri, 14 Jun 2019 19:34:05 +0000 (21:34 +0200)]
[System.Private.CoreLib] Extract RuntimeType for easier refactoring
Commit migrated from https://github.com/mono/mono/commit/
b5b58d67cf6fd4f5431ae2b6c3e3fc4ec71f91b3
Egor Bogatov [Sat, 15 Jun 2019 07:27:15 +0000 (10:27 +0300)]
[netcore] Fix CI build script (mono/mono#15130)
Commit migrated from https://github.com/mono/mono/commit/
26f022228439ac05644c6aaa46ab6ca635a55679
Jay Krell [Tue, 11 Jun 2019 07:21:35 +0000 (00:21 -0700)]
Read only interp callbacks, option 4, without ordering sensitivity.
Commit migrated from https://github.com/mono/mono/commit/
eafcbfd6eda561e5ba1d08330807841a5ad74807
Jay Krell [Sat, 8 Jun 2019 01:06:22 +0000 (18:06 -0700)]
Cleanup AIX code a little.
Commit migrated from https://github.com/mono/mono/commit/
1fe336691eca6811173731b8b30367fb2b64d9d1
Marek Safar [Fri, 14 Jun 2019 19:18:21 +0000 (21:18 +0200)]
[netcore] Arcade does not yet have CLSCompliant support, revert to manual settings
Commit migrated from https://github.com/mono/mono/commit/
ef4c8bbbb05ffbcb37e6b2a725b34d4de32f88df
Thays Grazia [Fri, 14 Jun 2019 19:15:38 +0000 (16:15 -0300)]
Implementing reabstraction of default interface methods. (mono/mono#14790)
Implementing reabstraction of default interface methods.
Fix mono/mono#14495
Commit migrated from https://github.com/mono/mono/commit/
a81cc6732716f4f53b110777d4aa700708d27663
Marek Safar [Fri, 14 Jun 2019 17:52:02 +0000 (19:52 +0200)]
[netcore] Add more Arcade magic for signing
Commit migrated from https://github.com/mono/mono/commit/
49dc99be58d66f53809b5cda2c7b8e2b9aeaaf96
Alexander Kyte [Fri, 14 Jun 2019 18:38:09 +0000 (14:38 -0400)]
[metadata] Move problematic image out-param usage (mono/mono#15131)
Commit migrated from https://github.com/mono/mono/commit/
877a2b65488199dd3e1802e44a5eef3bf932ba4f
Aleksey Kliger (λgeek) [Fri, 14 Jun 2019 15:33:11 +0000 (11:33 -0400)]
[mini] Move some MONO_API functions to public header (mono/mono#15105)
* [mini] Move some MONO_API functions to public header
And mark them all MONO_RT_EXTERNAL_ONLY.
mono_set_use_llvm is new - Xamarin.Android previously assigned to mono_use_llvm
directly.
Commit migrated from https://github.com/mono/mono/commit/
0e0f1b9be08ff14b192fdadc66efb6bb763867a4
Egor Bogatov [Fri, 14 Jun 2019 10:15:02 +0000 (13:15 +0300)]
Fix csproj
Commit migrated from https://github.com/mono/mono/commit/
4212270b231bcc158f75fd19a4503eac979032ec
Johan Lorensson [Fri, 14 Jun 2019 09:20:28 +0000 (11:20 +0200)]
Deadlock in loader when using bundling. (mono/mono#15061)
We can hit the following deadlock when loading assemblies (using reflection)
together with bundling:
One thread calls mono_assembly_open_from_bundle, that will take assemblies lock
and then try to load assembly. If this race with a different load of the
same assemblies, one will lose, and that method will call mono_image_close that
in turn will call unload hook (mono_class_unregister_image_generic_subclasses)
that will take loader lock.
If we at the same time have a different thread that calls mono_class_create_from_typedef
, it will take loader lock and then it might end up calling mono_assembly_load_reference
that will take assemblies lock, but since that thread takes the locks
in different order compare to first thread, they could deadlock.
Looking into the use of assemblies lock in mono_assembly_open_from_bundle it
uses a static variable, bundles, that is not protected in other scenarios
and only set by mono_register_bundled_assemblies, normally called during
boot. The method called in the loop mono_image_open_from_data_internal is called
at several places without locks (and looks internal using image lock), so that
doesn't need to be protected. The rest is local data access and the only thing the
lock could do is serialize the whole loop between threads (but that shouldn't be needed).
Fix will remove the locking and also eliminating the incorrect lock order
causing the deadlock.
Commit migrated from https://github.com/mono/mono/commit/
a382edc9e1106dd0ab2af87bd6a981f3b08916ec
Marek Safar [Thu, 13 Jun 2019 10:03:42 +0000 (12:03 +0200)]
[netcore] Clean up netcore build
Commit migrated from https://github.com/mono/mono/commit/
9010d2f290d28dc97ac276e0c0d32a2932b7550f
Jay Krell [Fri, 14 Jun 2019 05:37:06 +0000 (22:37 -0700)]
Fix S390x compile since mono/mono#14870 and a warning. (mono/mono#15056)
Commit migrated from https://github.com/mono/mono/commit/
467fd6516bc964d4076702c90203ff31dddc848e
Larry Ewing [Fri, 24 May 2019 04:42:26 +0000 (23:42 -0500)]
[wasm] fix most cases of numeric debugging for wasm
Fix the signededness of numeric types and use double
for the display of everthing since we are stuck with that
on the js side.
Commit migrated from https://github.com/mono/mono/commit/
56e27ca309f45a4baf5e18632bc28b2abf9f7f9f
imhameed [Thu, 13 Jun 2019 17:56:07 +0000 (10:56 -0700)]
Don't create a cycle when translating IL `break` to IR. (mono/mono#14980)
Don't create a cycle when translating IL `break` to IR.
`mono_emit_jit_icall` adds the instruction it generates to the current
basic block, and the redundant use of `MONO_ADD_INS` on an instruction
that has already been added to a BB will create a cycle in the `prev`
link chain.
Fixes mono/mono#9706.
Commit migrated from https://github.com/mono/mono/commit/
e6e9d5f6eb5488d9f87ab39727d76fb2ca81702c
Ryan Lucia [Thu, 13 Jun 2019 15:03:35 +0000 (11:03 -0400)]
Propagate error in mono_unicode_to_external (mono/mono#14879)
* Add internal version of mono_unicode_to_external to propagate error
* Migrate things to _error version where sensible
* Remove redundant goto
* Print input string when conversion fails
* Remove todos
* Switch everything to MonoError
* Naming: err -> error
* Actually print out *filename correctly
Commit migrated from https://github.com/mono/mono/commit/
20d83c24d6fe412a6afe62652b671526ab7d12cf
Marek Safar [Thu, 13 Jun 2019 07:42:00 +0000 (09:42 +0200)]
[netcore] Bump roslyn version
Commit migrated from https://github.com/mono/mono/commit/
f2c74837d289042a477835373d6e32f8b5ed280c
Alexander Kyte [Thu, 13 Jun 2019 07:07:10 +0000 (03:07 -0400)]
[crash] Print native module name when crash privacy disabled (mono/mono#14986)
This makes it so that disabling crash privacy ensures we get the full native symbols printed regardless of allow and deny lists.
Before: https://gist.github.com/alexanderkyte/
2b1f38a880c61ea15aa4c851e44af578
After: https://gist.github.com/alexanderkyte/
ce80788a51761d91890d812874fa2da2
Commit migrated from https://github.com/mono/mono/commit/
4ba594ad2550192936a1f8a8cf2d0976fc775660
Egor Bogatov [Wed, 12 Jun 2019 16:55:45 +0000 (19:55 +0300)]
[netcore] Enable CoreFX tests on CI for Linux (mono/mono#15015)
* Enable CoreFX tests on CI for Linux
* implement NativeLibrary.Unix.cs
* add missing libc
* add few -nonamespace
* more flaky tests
Commit migrated from https://github.com/mono/mono/commit/
3a0191194b015ad54f4b7254b7c92a6a9feda4ca
Larry Ewing [Thu, 6 Jun 2019 18:41:45 +0000 (13:41 -0500)]
Enable the compiler server by default
Commit migrated from https://github.com/mono/mono/commit/
bd7cb7e4d4de8769d97e0a3700f09b653a773317
Zoltan Varga [Wed, 12 Jun 2019 13:18:14 +0000 (09:18 -0400)]
[runtime] Fix gshared support for BeginInvoke ()/EndInvoke () wrappers. (mono/mono#14985)
Fixes https://github.com/mono/mono/issues/14972.
Commit migrated from https://github.com/mono/mono/commit/
a9949782d630233d4b964b5488d681c73ba26b1b
Vlad Brezae [Wed, 12 Jun 2019 12:42:46 +0000 (15:42 +0300)]
[jit] Fix interface cast (mono/mono#14978)
* [jit] Throw exception if casting fails for special array interface
After the standard interface check (mini_emit_iface_cast), for special interfaces we need to do additional checks. We were skipping these checks if the object was not an array, without throwing a cast exception. This code path is reached for configurations where remoting is disabled.
Fixes https://github.com/mono/mono/issues/14729
* [tests] Add test for interface casting case
This test would have failed on fullaot lane for example.
Commit migrated from https://github.com/mono/mono/commit/
9c265ace06712396cfb0786f403a0108188da3e8
Marius Ungureanu [Mon, 20 May 2019 22:32:31 +0000 (01:32 +0300)]
Plug leak of ppdb_filename
mono_image_open_metadata_only and its callees all dupe the filename string, so free the string after mono_image_open_metadata_only is done with it:
```
1 (128 bytes) ROOT LEAK: 0x7fb07f086c80 [128] length: 105 "/Users/therzok/Work/md/md-addins/external-addins/MonoDevelop.MonoDroid/build/Xamarin.Installer.Common.pdb"
```
Commit migrated from https://github.com/mono/mono/commit/
669629330f9fe5b8cf9426bd34afb52d55404070
Aleksey Kliger [Tue, 11 Jun 2019 14:55:58 +0000 (10:55 -0400)]
[runtime] Switch to GC Unsafe for all GC external API functions
Fixes https://github.com/mono/mono/issues/14975
Commit migrated from https://github.com/mono/mono/commit/
cd8b7602206b2f0820ecd0661c17d2d655b24dda
Egor Bogatov [Wed, 12 Jun 2019 07:40:15 +0000 (10:40 +0300)]
[netcore] Run CoreFX tests on CI (macOS) (mono/mono#14849)
Commit migrated from https://github.com/mono/mono/commit/
56398813ae5dd9b363888bc1d221b75035051afc
Zoltan Varga [Wed, 12 Jun 2019 00:13:34 +0000 (20:13 -0400)]
[aot] Open AOT profile files using "rb" so it works on windows.
Fixes https://github.com/xamarin/xamarin-android/issues/3168.
Commit migrated from https://github.com/mono/mono/commit/
bcd14601c22978286ffb5dd1b9ca917ade63cf89
Alexander Kyte [Tue, 11 Jun 2019 16:30:05 +0000 (12:30 -0400)]
[llvm] Fix disabling direct calls and inlining (mono/mono#14880)
* [llvm] Enable disabling inlining on llvm
* [llvm] Fix disabling direct calls on llvm
* [llvm] Rename mono_inited even when doing self_init (generated init functions refer to it)
Commit migrated from https://github.com/mono/mono/commit/
e4d375268439869ccb8fded4c75468fca19b4d80
Aleksey Kliger (λgeek) [Tue, 11 Jun 2019 13:42:24 +0000 (09:42 -0400)]
[install] Include .exe extension when symlinking the mono binary (mono/mono#14958)
Prevent the SDKs from making dangling symlinks when packaging the MXE
cross-compilers: should hav
mono.exe -> mono-sgen.exe
rather than
mono -> mono-sgen (dangling).
Commit migrated from https://github.com/mono/mono/commit/
5440491ae8b4b65a4e2010f86e425b265e825250
Johan Lorensson [Tue, 11 Jun 2019 11:22:18 +0000 (13:22 +0200)]
Merge pull request mono/mono#14811 from lateralusX/lateralusX/fix-lmf-with-ctx-windows-msvc
Fix interpreter failure in install_eh_callback.exe under Windows x64 MSVC.
Commit migrated from https://github.com/mono/mono/commit/
3a193b7ae59f62d52c1713b7d55548acf86cad67
Jay Krell [Tue, 11 Jun 2019 04:40:39 +0000 (21:40 -0700)]
Remove JIT icall hashing by address. (mono/mono#14870)
* Work toward removing JIT icall hashing by address.
* Remove JIT icall hashing by address.
* Cleanup amd64 emit_call use.
* Move MonoJumpInfoTarget to among types, not functions.
If mini.h includes mini-runtime.h, then can move it nearer MonoJumpInfo.
Or if returned by out parameter (pointer) instead of struct by value.
Or pair of out parameters instead of struct.
* Closer to historical semantics, at least to avoid assertion failure, will try to refine in a later PR.
* Remove new comments about partial barriers, I think the comments are wrong and the code is correct (except that lock/unlock probably need to be full barriers, if they are not.)
* PR: Don't worry about size of MonoCallInst.jit_icall_id. Let it be 32 or 64 bits instead of 9.
Commit migrated from https://github.com/mono/mono/commit/
c398e19d3515c6bbb6046ed014b2095594a15229
Zoltan Varga [Sun, 9 Jun 2019 03:16:18 +0000 (23:16 -0400)]
[wasm] Prototype for collecting aot profile data. (mono/mono#14865)
* [runtime] Add some options to the aot profiler:
- write-at-method=<METHOD> Write the data when <METHOD> is compiled.
- send-to-method=<METHOD> Call <METHOD> with the collected data.
* [wasm] Fix profiler support in the packager.
* [wasm] Add prototype for generating aot profile data.
* Fix indentation.
Commit migrated from https://github.com/mono/mono/commit/
23a928826cd88cf45fe2e3af1e2ef5a60ef88d34
Jay Krell [Sat, 8 Jun 2019 17:38:01 +0000 (10:38 -0700)]
Cleanup amd64 emit_call / emit_call_body -- last parameter always FALSE. (mono/mono#14897)
And it is reasonable to expect that to remain the case, as C compilers
do not generate code as would occur with the last parameter = TRUE.
They allocate the room for their maximum outgoing parameters at function entry,
and keep a constant stack, except for functions that call _alloca,
and this code risks but not necessarily breaks ABI compliance.
In particular, the rsp adjustment either needs unwind codes, or needs
to only occur in a function with a frame pointer other than RSP.
And the uwind codes for adding to RSP are very tricky to impossible.
Normally you only ever subtract from RSP. There is an unwind code for that.
But there isn't really for add.
You might be able to simulate it with chained unwind, making these
regions look kinda like end of function.
But this is all most unlikely.
Commit migrated from https://github.com/mono/mono/commit/
63f17d2f553083cde0a9afdab5e4c4bbff944f29
Zoltan Varga [Sat, 8 Jun 2019 04:46:56 +0000 (00:46 -0400)]
[wasm] Switch to the LLVM wasm backend. (mono/mono#14734)
* [wasm] Switch to the llvm wasm backend.
* [wasm] Packager changes for the wasm backend.
* -s EMULATED_FUNCTION_POINTERS=1 no longer needed.
* Run wasm-strip on the final binary.
* Run opt during AOT.
* Disable the dynamic build for now, it doesn't seem to work with the wasm backend.
* [wasm] Use STACK_MAX instead of STACK_BASE for the bottom limit of the stack.
* [aot] Handle llvmopts= in llvmonly mode as well.
* [wasm] Disable an assertion which is no longer true with the wasm backend.
* [wasm] Disable computed gotos in the interpreter, the wasm backend doesn't support it.
Fix llvm target layout so its compatible with clang compiled code.
* [wasm] Pass llvm-path to the cross compiler.
* [wasm] Fix some problems with the dynamic build, still doesn't work. Fix packaging.
* [wasm] Pass -s DISABLE_EXCEPTION_CATCHING=0 to the runtime build, otherwise catch clauses are not generated in llvm-runtime.cpp.
* [aot] Allow llvmopts= argument multiple times.
* Bump emscripten version to 1.38.34.
* [wasm] Add https://github.com/emscripten-core/emscripten/pull/8457 as a patch.
* [wasm] Compile the aot .bc files to .o in a separate step using emcc, this will help with incremental compilation later.
* [wasm] Source emsdk_set_env.sh instead of emsdk_env.sh the latter calls emsdk construct_env to construct emsdk_set_env.sh which is racy.
Commit migrated from https://github.com/mono/mono/commit/
16532397c362cf66da55be388dc84bb7b3ad6ad1
Alexander Kyte [Fri, 7 Jun 2019 19:18:57 +0000 (15:18 -0400)]
[crash] Move /proc/self/maps crash collection to created JSON blob (mono/mono#14704)
* [runtime] Don't print /proc/self/maps on Android
* [runtime] Add proc mapping to crash JSON output
* [runtime] Zero initialize locals in threading macros
* [crash] Filter out illegal characters from process_maps
* [crash] Prevent concurrent reads from /proc/self/maps
* [crash] Clean up memset in g_async_safe_fgets
* [crash] Remove stack staging array in async_safe_fgets
* Revert "[crash] Prevent concurrent reads from /proc/self/maps"
This reverts commit mono/mono@
f65166559ad24ad65c530f7abbc096e4d4634878.
Commit migrated from https://github.com/mono/mono/commit/
d54a6544b3165f13bb9cd9b5585648b0ac708622
Calvin Buckley [Fri, 7 Jun 2019 18:02:44 +0000 (11:02 -0700)]
AIX/PASE integration improvements (mono/mono#14652)
* Allow using SysV-style sonames on AIX/PASE
This uses a far saner naming convention with libtool, and is
consistent with the official PASE RPM repository. However, some
loader changes are required to make it "just work" and workaround
some real dumb behaviour on AIX's part.
Note that while Mono works when built without the different soname
tweak, it won't when installed, because the convention is strange
and the libtool .la archives won't be installed. It's recommended
as such that installation of Mono keeps the libtool files or just
uses SVR4 sonames like the rest of the world, even if they're made
strange like AIX.
* Specify a specific version of unixODBC, make an include
A workaround against PASE RPMs of unixODBC not including the just
"libodbc.so" except in the development version. If a platform needs
a specific version (the macOS reference not changed in the DllMap)
then it can be specified in the configure script.
AIX doesn't need a special name because both AIX Toolbox and Perzl
include non-archive libraries in /opt/freeware/lib - unexpected.
* Don't try to use shm_open on PASE due to it not being implemented
All this will do is cause a coredump if running the script on PASE,
and write an entry to the SLIC diagnostic logs. This test could be
re-enabled if i 7.4 supports it properly.
* fix ODBC include
* Check for what library to use for libintl when dlopenning on AIX
These checks are for the benefit of the DllMap. The construct used
is kinda hacky, IMHO, but it resolves the concerns of hardcoding.
In the event that this doesn't work (it does for me), it falls back
to what the IBM RPMs seem to use for linking gettext et al.
Not sure of the utility for other platforms, since they usually
use sane soname conventions and the one-liner here depends heavily
on an AIX developer tool and its output format.
The use of cut/awk should work with the stock AIX utils, no GNU
necessarily needed.
Commit migrated from https://github.com/mono/mono/commit/
18e0ebfe89be0a175d2f904b9bb1ec6816daa318
Martin Baulig [Fri, 7 Jun 2019 17:14:21 +0000 (13:14 -0400)]
Bump CoreFX to pickup https://github.com/mono/corefx/pull/298. (mono/mono#14851)
Commit migrated from https://github.com/mono/mono/commit/
96125c693c5164347da9fba14a3c936d16fef86e
Aleksey Kliger (λgeek) [Fri, 7 Jun 2019 11:06:32 +0000 (07:06 -0400)]
[runtime] Make cross-appdomain wrappers throw NIE for methods with ref struct args (mono/mono#14863)
* [AppDomain] Cross-appdomain wrapper throws NIE for methods with ref struct arguments
If we have a ref struct and a method that takes it as an argument:
```
[Serializable]
public ref struct R {
public int i;
}
public interface I {
public void M1 (R r, SomeClass o);
}
public class M : MarshalByRefObject, I {
public void M1 (R r, SomeClass o) { ... }
}
```
If we create an instance of M in another domain and try to call it:
```
I obj = (I)otherDomain.CreateInstanceAndUnwrap (typeof(M).Assembly.FullName,
nameof(M));
R r;
r.i = 42;
SomeClass o = ...;
obj.M1 (r, o);
```
Mono will need to create a wrapper that can invoke M.M1 in the other domain.
The way the wrapper works in `mono_marshal_get_xappdomain_invoke` is by
creating an array of all the arguments that need to be serialized (see
`mono_get_xdomain_marshal_type`) and then serializing the whole array (by
calling out to `System.Runtime.Remoting.RemotingServices.SerializeCallData`).
In the example it would make a two element array and try to serialize `r` and
`o` into it. For valuetypes it normally does this by boxing the argument.
However since `R` is a ref-struct, boxing it is not allowed.
This works on .NET Framework.
However for Mono we would need to serilize `R` without boxing it, which seems
challenging with our current setup.
So for now we generate a wrapper that just throws a NotImplementedException if
it is ever called.
This fixes https://github.com/mono/mono/issues/14809 (in that marshalling a
TextWriter across domains works again) but in an unsatisfactory way (because
you can't call any of the ReadOnlySpan<char> overloads on the transparent proxy
object).
* [corlib] Add back Serializable attribute on some reflection classes
Tests that use https://www.nuget.org/packages/NUnit.ApplicationDomain/
need to serialize MethodInfo (and hence MethodBase).
* [corlib] Add test for transparent proxies for classes with methods that take
ref struct args
Regression test for https://github.com/mono/mono/issues/14809
* Bump API snapshot submodule
Commit migrated from https://github.com/mono/mono/commit/
277bbdaada789bb9b61a71aa45475d914b457494
Ryan Lucia [Thu, 6 Jun 2019 20:42:03 +0000 (16:42 -0400)]
Remove exclusions for resolved issue
Commit migrated from https://github.com/mono/mono/commit/
65608fe3f412a08289239e6146f0dc21f71ce1c9
Ryan Lucia [Thu, 6 Jun 2019 19:38:57 +0000 (15:38 -0400)]
Add logic to object array typecheck to handle arrays of unmanaged pointers (mono/mono#14733)
Fixes mono/mono#14555
The NULL check alone is not enough, because interfaces are also parented to NULL for some reason, and so I've moved `class_kind` out from the bitfield section to make it accessible from IR. The beginning of the struct is going to be padded to 32 bits anyway at the least, so this move should save space if anything.
Our type checking overall is not very robust, and in particular the supertype comparison doesn't work well for anything that isn't an object, so it's possible there are some other weird corner cases. As far as I can tell looking through the array of objects stuff though, we should have reasonable coverage with the existing tests + the stuff I added.
Commit migrated from https://github.com/mono/mono/commit/
a5a26a2f92d00ab174d794f077007faaab5d3843
Ryan Lucia [Thu, 6 Jun 2019 19:02:57 +0000 (15:02 -0400)]
Switch supported runtimes storage from an array to a list (mono/mono#14777)
Fixes mono/mono#12141
Switched to a list because in theory any number of tags can be present. Old behavior was to put them into an array of size 3 and zero the byte following them, which was causing the crash with more than two tags. There's no null check for the default runtime because that should never happen, and the list is reversed to preserve the order from the XML. Changing the signature of `get_runtimes_from_exe` should be fine because it's static and only called in the one place.
Commit migrated from https://github.com/mono/mono/commit/
6d2c77fb3373971b4c615a70fe43f3622e3c91d8
Bernhard Urban [Thu, 6 Jun 2019 18:14:59 +0000 (20:14 +0200)]
[mach] cast objc_msgSend{,Super} usages (mono/mono#14836)
Fixes mono/mono#14792
Commit migrated from https://github.com/mono/mono/commit/
812357ec51f771c69f54694e9fa88ee49180eb62
Bernhard Urban [Thu, 6 Jun 2019 17:24:20 +0000 (19:24 +0200)]
[llvm] emit call to mini_llvmonly_throw_nullref_exception without exceptions in mind (mono/mono#14840)
Fixes https://github.com/mono/mono/issues/14243
Commit migrated from https://github.com/mono/mono/commit/
e8367ce3d7fb0510ceee3bde8e0f9a4d2ce00655
Alexander Kyte [Thu, 6 Jun 2019 16:07:31 +0000 (12:07 -0400)]
[runtime] Gracefully skip AOTing problematic assemblies (mono/mono#14232)
Commit migrated from https://github.com/mono/mono/commit/
364a8423e3e64cc199a8f43c6e0738118fb10f8a
Egor Bogatov [Thu, 6 Jun 2019 15:43:58 +0000 (18:43 +0300)]
[netcore] Improve netcore/build.sh script (mono/mono#14835)
* Improve netcore/build.sh
* bump corefx tests version
* ignore StringTests failures
* Ignore more tests for xtestall
* Implement Environment.TickCount64
* cleanup
* Add two debug-* rules
Commit migrated from https://github.com/mono/mono/commit/
b861cacd4828d525aa37ddd2e3f18454f7a95f41
Jay Krell [Thu, 6 Jun 2019 07:40:39 +0000 (00:40 -0700)]
[thread] Print function name when asserting MonoThreadInfo is non-NULL (mono/mono#13814)
https://github.com/mono/mono/issues/13813.
Commit migrated from https://github.com/mono/mono/commit/
515234a128318cc199df0cca9cccdbf06fe72fdb
Kenneth Pouncey [Thu, 6 Jun 2019 03:07:56 +0000 (05:07 +0200)]
[wasm][bcl] Use zlib for DeflateStream on WASM profile (mono/mono#14308)
* [wasm][bcl] Use zlib for DeflateStream on WASM profile
- Add `-s USE-ZLIB=1` flag for the emscripten build of `mono.js`
- Add new `zlib-helper` module build that is included in the `mono` wasm build.
- This adds roughly 300 kb to the size.
* Add zlib calls to `icall` for `WASM` profile
* Address comments use `TARGET_WASM` instead of `HOST_WASM`
* Hack around JS exception: RuntimeError: indirect call signature mismatch
- Instead of using the function pointer from DeflateStream (Marshal.GetFunctionPointerForDelegate) obtain the callback functions from the object itself.
* Update error messages and add exception parameter to `mono_runtime_invoke`.
* Add `mono/support` zlib include sources files to make `package` target.
* Add `zlib-helper` build to packager.
- Note: Right now only supports zlib build from mono tree build.
- Add `zlibtest.cs` scenario to compress and uncompress using DeflateStream and GZip.
- Add test to make file to build and run aot version of ziplibtest.
* Add copy of zlib header support files to `package-wasm-runtime`
- The support library is not built for wasm but the zlib include files are needed to build support during wasm build.
- See mono.js build and the use of the `-s USE_ZLIB=1` flag.
- The include files will be used in packager.exe to build zlib support for wasm.
* Use the zlib includes from support to build the zlib support.
* Setup base tests for testing System.IO.Compression integration
* Formatting
* Add more ziparchive tests
* Formatting and indentation
* Add more Zip tests
* Add more tests.
- Add more tests for ZipArchive.
- Add tests for Deflate - small, large and very large strings.
- Add tests for GZipStream - small, large and very large strings.
* Fix merge of EMCC_FLAGS
* Add new option to packager to enable the use of zlib
- --enable-zlib (enable the use of zlib for System.IO.Compression support)
type: bool default: false
- update packager doc
* Address review comments
- Change `enable-zlib` to `zlib`
Commit migrated from https://github.com/mono/mono/commit/
0562fde077f11bfd81ae0c2ce5c467ae2928c259
Egor Bogatov [Wed, 5 Jun 2019 22:39:05 +0000 (01:39 +0300)]
Fix build on macOS 10.15 Catalina + xcode 11 (mono/mono#14820)
1) CC_MD5_Init, CC_MD5_Update and CC_MD5_Final are deprecated.
```c
mono-md5.c:45:2: error: 'CC_MD5_Init' is deprecated: first deprecated in macOS 10.15 - This function is
cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256
(or stronger). [-Werror,-Wdeprecated-declarations]
CC_MD5_Init (ctx);
^
```
2) objc_msgSend is deprecated
```
mono-threads-mach-helper.c:95:17: error: too many arguments to function call, expected 0, have 2
objc_msgSend (value, release);
~~~~~~~~~~~~ ^~~~~~~~~~~~~~
```
XCode has a special switch `Enable Strict Checking of objc_msgSend Calls` which is now `true` by default. It's fixed by `-DOBJC_OLD_DISPATCH_PROTOTYPES=1` flag to clang or the corresponding define in the source file.
3) Fixes https://github.com/mono/mono/issues/14793
It worked on pre 10.15 without `-framework GSS`, because it got pulled in through the dependencies. You can see it by running DYLD_PRINT_LIBRARIES=1 csharp and then trace it back. On Mojave /System/Library/Frameworks/GSS.framework/Versions/A/GSS got loaded as dependency of /usr/lib/libcups.2.dylib and so on. Unlike Windows, macOS will resolve the symbols to whatever is already available so it was just happy that someone loaded GSS before libmono-native[-compat/-unified].
Commit migrated from https://github.com/mono/mono/commit/
181a602acee3bcc1ac529ff41c254f794052ca71
Vlad Brezae [Wed, 5 Jun 2019 20:05:30 +0000 (23:05 +0300)]
[interp] Inline more methods (mono/mono#14755)
* [interp] Add support for inlining methods with locals
For each local in the inlined method we allocate a new local in the parent method.
* [interp] Enable inlining of methods using ldarga opcode
* [interp] Don't inline methods that do localloc
Inlining localloc in a loop leads to stack overflows. JIT has same behavior.
Commit migrated from https://github.com/mono/mono/commit/
e548a7d231e936562fcc301826034c14e4bc9d7b
Egor Bogatov [Wed, 5 Jun 2019 18:44:47 +0000 (21:44 +0300)]
Reflect recent NS2.1 changes (mono/mono#14679)
Due to few recent updates to dotnet/standard (NETStandard 2.1) we had 40 apicompat issues.
Mostly copy-pasted from dotnet/corefx.
Didn't implement Cryptography stuff yet.
Checked all profiles.
Implements mono/mono#14609
Commit migrated from https://github.com/mono/mono/commit/
c5ed9bfc0d1b393c1dc6d97fc3caf8b5b09ab443
imhameed [Wed, 5 Jun 2019 15:42:18 +0000 (08:42 -0700)]
[jit] Treat ternary operations as non-constant during constant evaluation and propagation (mono/mono#14782)
* Treat ternary operations as non-constant... (mono/mono#13873)
...during constant evaluation and propagation.
* Move ternary SSA cfold test from basic.cs to objects.cs.
Commit migrated from https://github.com/mono/mono/commit/
993d4842854c1a5cfd4f50f880c1e5b4067479ee
Brendan Zagaeski [Wed, 5 Jun 2019 15:38:07 +0000 (08:38 -0700)]
[arm64] Correct exception filter stack frame size (mono/mono#14757)
* [arm64] Correct exception filter stack frame size
Fixes: https://github.com/mono/mono/issues/14170
Fixes: https://github.com/xamarin/xamarin-android/issues/3112
The `call_filter()` function generated by `mono_arch_get_call_filter()`
was overwriting a part of the previous stack frame because it was not
creating a large enough new stack frame for itself. This had been
working by luck before the switch to building the runtime with Android
NDK r19.
I used a local build of [xamarin/xamarin-android/d16-1@87a80b][0] to
verify that this change resolved both of the issues linked above. I
also confirmed that I was able to reintroduce the issues in my local
environment by removing the change and rebuilding.
After this change, the generated `call_filter()` function now starts by
reserving sufficient space on the stack to hold a 64-bit value at the
`ctx_offset` location. The 64-bit `ctx` value is saved to the
`ctx_offset` location (offset 344 in the new stack frame) shortly
afterwards:
stp x29, x30, [sp,#-352]!
mov x29, sp
str x0, [x29,mono/mono#344]
As expected, the invocation of `call_filter()` now no longer modifies
the top of the previous stack frame.
Top of the stack before `call_filter()`:
(gdb) x/8x $sp
0x7fcd2774a0: 0x7144d250 0x00000000 0x2724b700 0x00000000
0x7fcd2774b0: 0x1ee19ff0 0x00000071 0x0cc00300 0x00000071
Top of the stack after `call_filter()` (unchanged):
(gdb) x/8x $sp
0x7fcd2774a0: 0x7144d250 0x00000000 0x2724b700 0x00000000
0x7fcd2774b0: 0x1ee19ff0 0x00000071 0x0cc00300 0x00000071
Additional background information
=================================
The original lucky, "good" behavior worked as follows for
[mono/mono/2018-08@725ba2a built with Android NDK r14][1]:
1. The `resume` parameter for `mono_handle_exception_internal()` is
held in register `w23`.
2. That register is saved into the current stack frame at offset 20 by
a `str` instruction:
0x00000000000bc1bc <+3012>: str w23, [sp,mono/mono#20]
3. `handle_exception_first_pass()` invokes `call_filter()` via a `blr`
instruction:
2279 filtered = call_filter (ctx, ei->data.filter);
0x00000000000bc60c <+4116>: add x9, x22, x24, lsl mono/mono#6
0x00000000000bc610 <+4120>: ldr x8, [x8,mono/mono#3120]
0x00000000000bc614 <+4124>: ldr x1, [x9,mono/mono#112]
0x00000000000bc618 <+4128>: add x0, sp, mono/mono#0x110
0x00000000000bc61c <+4132>: blr x8
Before the `blr` instruction, the top of the stack looks like this:
(gdb) x/8x $sp
0x7fcd2774a0: 0x7144d250 0x00000000 0x0a8b31d8 0x00000071
0x7fcd2774b0: 0x00000000 0x00000000 0x1ef51980 0x00000071
4. `call_filter()` runs. This function is generated by
`mono_arch_get_call_filter()` and starts with:
stp x29, x30, [sp,#-336]!
mov x29, sp
str x0, [x29,mono/mono#344]
Note in particular how the first line subtracts 336 from `sp` to
start a new stack frame, but the third line writes to a position
that is 344 bytes beyond that, back within the *previous* stack
frame.
5. After the invocations of `call_filter()` and
`handle_exception_first_pass()`, `w23` is restored from the stack:
0x00000000000bc820 <+4648>: ldr w23, [sp,mono/mono#20]
At this step, the top of the stack looks like this:
(gdb) x/8x $sp
0x7fcd2774a0: 0x7144d250 0x00000000 0xcd2775b0 0x0000007f
0x7fcd2774b0: 0x00000000 0x00000000 0x1ef51980 0x00000071
Notice how `call_filter()` has overwritten bytes 8 through 15 of the
stack frame. In this original lucky scenario, this does not affect
the value restored into register `w23` because that value starts at
byte 20.
6. `mono_handle_exception_internal()` tests the value of `w23` to
decide how to set the `ji` local variable:
2574 if (resume) {
0x00000000000bb960 <+872>: cbz w23, 0xbb9c4 <mono_handle_exception_internal+972>
Since `w23` is `0`, `mono_handle_exception_internal()` correctly
continues into the `else` branch.
The bad behavior for
[mono/mono/2018-08@725ba2a built with Android NDK r19][2]
works just slightly differently:
1. As before, the local `resume` parameter starts in register `w23`.
2. This time, the register is saved into the stack frame at offset 12
(instead of 20):
0x00000000000bed7c <+3200>: str w23, [sp,mono/mono#12]
3. As before, `handle_exception_first_pass()` invokes `call_filter()`
via a `blr` instruction.
At this step, the top of the stack looks like this:
(gdb) x/8x $sp
0x7fcd2774a0: 0x7144d250 0x00000000 0x2724b700 0x00000000
0x7fcd2774b0: 0x1ee19ff0 0x00000071 0x0cc00300 0x00000071
4. `call_filter()` runs as before. And the first few instructions of
that function are the same as before:
stp x29, x30, [sp,#-336]!
mov x29, sp
str x0, [x29,mono/mono#344]
5. `w23` is again restored from the stack, but this time from offset 12:
0x00000000000bf2c0 <+4548>: ldr w23, [sp,mono/mono#12]
The problem is that `call_filter()` has again overwritten bytes 8
through 15 of the stack frame:
(gdb) x/8x $sp
0x7fcd2774a0: 0x7144d250 0x00000000 0xcd2775b0 0x0000007f
0x7fcd2774b0: 0x1ee19ff0 0x00000071 0x0cc00300 0x00000071
So after the `ldr` instruction, `w23` has an incorrect value of
`0x7f` rather than the correct value `0`.
6. As before, `mono_handle_exception_internal()` tests the value of `w23` to
decide how to set the `ji` local variable:
2574 if (resume) {
0x00000000000be430 <+820>: cbz w23, 0xbe834 <mono_handle_exception_internal+1848>
But this time because `w23` is *not* zero, execution continues
*incorrectly* into the `if` branch rather than the `else` branch.
The result is that `ji` is set to `0` rather than a valid
`(MonoJitInfo *)` value. This incorrect value for `ji` leads to a
null pointer dereference, as seen in the bug reports.
[0]: https://github.com/xamarin/xamarin-android/tree/xamarin-android-9.3.0.22
[1]: https://jenkins.xamarin.com/view/Xamarin.Android/job/xamarin-android-freestyle/1432/Azure/
[2]: https://jenkins.xamarin.com/view/Xamarin.Android/job/xamarin-android-freestyle/1436/Azure/
* reduce frame size
Commit migrated from https://github.com/mono/mono/commit/
888a8d44f6d6e6934b9f105d4e0b0432edf72ba4
lateralusX [Wed, 5 Jun 2019 15:19:18 +0000 (17:19 +0200)]
Fix interpreter failure in install_eh_callback.exe under Windows MSVC.
INTERP_PUSH_LMF_WITH_CTX_BODY is not fully supported under Windows MSVC
since that compiler doesn't support taking address from a label, needed
by current implementation to correctly resume after unwinding exceptions
happening in native frames as tested by install_eh_callback.exe.
This fix add support to restore to a known location and use a flag
indicating if we have been resumed to the location or just passing by
for the first time. If we resume it will transfer control to specified label.
This will mimic the behavior of taking the address of a label and use that
address as the restore point and works like how setjmp/longjmp work.
I also considered switching to setjmp/longjmp but that would have had a bigger
impact on all platforms and needed changes into the resume context
machinery as well.
While doing the implementation I also found an interesting issue with
MONO_CONTEXT_GET_CURRENT under Windows x64. On most other platforms it is
implemented as inline assembler, but on MSVC x64 inline assembler is not
supported so it is implemented as a function. Problem with that is how IP
was resolved, since it won't be resolved to the last instruction in the
expanded macro, but to the IP within the mono_context_get_current. This has
not had any visible effects in the past since it will just do the ret and get
back to the call site, but when this was used in INTERP_PUSH_LMF_WITH_CTX_BODY
it caused some issues. This was fixed to make sure rsp and rip reflect location
in caller frame and not within mono_context_get_current, similar to how
it works on all platforms with inline assembler support.
Commit migrated from https://github.com/mono/mono/commit/
ae84befc0f0ffe05fad7b2c807560a67f2926896
Johan Lorensson [Wed, 5 Jun 2019 10:26:50 +0000 (12:26 +0200)]
Merge pull request mono/mono#14760 from lateralusX/lateralusX/increase-windows-main-thread-stack-size
Increase main thread stack size on Windows.
Commit migrated from https://github.com/mono/mono/commit/
644bfc93d4bec824d38f83850746a2a3132a6200
Egor Bogatov [Wed, 5 Jun 2019 09:52:01 +0000 (12:52 +0300)]
[netcore] Download and use local .NET Core SDK (mono/mono#14696)
* Download and use local .NET Core SDK
* depend on 'all' rule in nupkg
* fix build error
* Windows support
* use InitializeToolset function
* ouput full path of dotnet in init-tools.sh
* remove init-tools
* Add init-tools.ps1 (Windows)
* fix / issue on cygwin
* address Jo's feedback
* add powershell to PATH for make nupkg
* add netcore/build.sh
* handle pack and test commands
* Update tools.ps1
* Update tools.ps1
Commit migrated from https://github.com/mono/mono/commit/
d3101fbaeb7e5a0f29418876588856b132cabff3
Aleksey Kliger [Tue, 4 Jun 2019 22:22:10 +0000 (18:22 -0400)]
[runtime] Autoconf check for pthread_mutexattr_setprotocol
Android doesn't always declare that function.
Commit migrated from https://github.com/mono/mono/commit/
be92baf12d33c95b46075f48f69c0274ae8301d9
Johan Lorensson [Tue, 4 Jun 2019 09:16:49 +0000 (11:16 +0200)]
Merge pull request mono/mono#14694 from lateralusX/lateralusX/fix-llvm-build-path-msvc
Fix LLVM build break on Windows MSVC.
Commit migrated from https://github.com/mono/mono/commit/
a76fc055cf1dc3173b6df1690d14723a13fbaf63
lateralusX [Mon, 3 Jun 2019 09:43:16 +0000 (11:43 +0200)]
Increase main thread stack size on Windows.
On Windows default thread stack size has been 1MB for a long time
(both 32/64-bit). When starting to use interpreter some of the tests
include deep recursions that will hit stackoverflow on Windows
(ackermann.exe as one example). This commit adjust the default reserved
stack size to 8MB for debug builds and 1.5MB (same as coreclr), for main
thread only. All other threads will still default to 1MB stack size
(both debug/release).
Commit migrated from https://github.com/mono/mono/commit/
29a2383333fdd4d49101d37ea61571747454aae9
Rich Lander [Tue, 4 Jun 2019 04:25:16 +0000 (21:25 -0700)]
Update license to match directory
Commit migrated from https://github.com/mono/mono/commit/
697c1402ea978a80ff071c4e8ad4a37dce6cae2d
Rich Lander [Tue, 4 Jun 2019 04:23:38 +0000 (21:23 -0700)]
Update license to match directory
Commit migrated from https://github.com/mono/mono/commit/
f0ef7aa4dfe494b885d344f9a83fc322f609fb70
Johan Lorensson [Tue, 4 Jun 2019 06:49:02 +0000 (08:49 +0200)]
Merge pull request mono/mono#14766 from lateralusX/lateralusX/fix-win-32-createprocess-error
Change in process_complete_path exposed uninitialized variable error.
Commit migrated from https://github.com/mono/mono/commit/
0fa59f11ea2bd6ae81cf09f17dd44df7d9d78d89
monojenkins [Mon, 3 Jun 2019 20:41:42 +0000 (16:41 -0400)]
Bump roslyn to release 3.1.0 (mono/mono#14778)
Commit migrated from https://github.com/mono/mono/commit/
deb0227a78992097770310c82c74b7a6449cb5fa
lateralusX [Mon, 3 Jun 2019 14:04:32 +0000 (16:04 +0200)]
Change in process_complete_path exposed uninitialized variable error.
https://github.com/mono/mono/commit/mono/mono@
5d088cf0de7f3e50e3547dba361af4401e938dd4
exposed a problem with an uninitialized variable, only exposed on some
build configurations, 32-bit Windows release builds.
Commit migrated from https://github.com/mono/mono/commit/
85bdaee7a540f6b3af83ae5046cd08d4bcbdf068
Jay Krell [Thu, 30 May 2019 16:15:26 +0000 (09:15 -0700)]
Remove W32_UPDATE_LAST_ERROR_RESTORE_POINT that is not used and does not make sense to me, as to when it would be useful, having preserved LastError around many code paths through the years.
Commit migrated from https://github.com/mono/mono/commit/
018940f1bc126298771ed8d3855cf228382f44f3
Jay Krell [Wed, 29 May 2019 23:29:48 +0000 (16:29 -0700)]
Do not change Win32 lasterror in the first MONO_EXIT_GC_SAFE.
Commit migrated from https://github.com/mono/mono/commit/
c5a628e86f4a4acff36e10cd768b36ec3cc4e18d
Rich Lander [Sat, 1 Jun 2019 17:57:49 +0000 (10:57 -0700)]
Update THIRD-PARTY-NOTICES.TXT
Add entry for https://github.com/mono/mono/blob/mono/mono@
a34c9c79c07156797499b6ed2ce43c5897263b57/mono/benchmark/logic.cs
Commit migrated from https://github.com/mono/mono/commit/
72dfea91df90020e5ca3cf7e5bbfd9a22e390fe3