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

5 years ago[System.Private.CoreLib] Merge fixes
Marek Safar [Tue, 18 Jun 2019 09:10:59 +0000 (11:10 +0200)]
[System.Private.CoreLib] Merge fixes

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

5 years agoMerge remote-tracking branch 'upstream/master' into mirror-merge-10235436
Marek Safar [Tue, 18 Jun 2019 08:54:06 +0000 (10:54 +0200)]
Merge remote-tracking branch 'upstream/master' into mirror-merge-10235436

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

5 years ago[netcore] Reflect shared partition changes
Marek Safar [Tue, 18 Jun 2019 08:52:05 +0000 (10:52 +0200)]
[netcore] Reflect shared partition changes

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

5 years ago[System.Private.CoreLib] Align on CA naming for easier sharing
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

5 years agoImplement GC.GetAllocatedBytes (mono/mono#14779)
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

5 years ago[arm] use target_mgreg_t instead of plain pointer type in sdb breakpoint (mono/mono...
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

5 years agoAllocate MonoJumpInfo instead of MonoAotCompile.
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

5 years agoRevert "threads.c:6403:6: warning: 'current_idx' may be used uninitialized in this...
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

5 years agoPR: Restore nearby unusual formatting.
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

5 years agointrinsics.c: In function 'mini_emit_inst_for_method':
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

5 years agodebugger-engine.c: In function 'set_bp_in_method':
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

5 years agotramp-arm64-gsharedvt.c: In function 'mono_arch_get_gsharedvt_trampoline':
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

5 years agomini-arm64-gsharedvt.c: In function 'mono_arch_get_gsharedvt_call_info':
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

5 years agointerp/mintops.c: In function 'mono_interp_dis_mintop':
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

5 years agoIn file included from object.c:40:0:
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

5 years agow32file-unix.c: In function 'mono_w32file_get_file_size':
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

5 years agointerp/interp.c: In function 'interp_entry.constprop':
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

5 years agoimage.c:1351:20: warning: variable 'header' set but not used [-Wunused-but-set-variable]
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

5 years agoexception.c:747:1: warning: 'mono_new_exception_argument_out_of_range' defined but...
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

5 years agoos-event-unix.c: In function 'mono_os_event_wait_multiple':
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

5 years agoIn file included from ../../mono/eglib/glib.h:45:0,
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

5 years agomarshal.c: In function 'mono_marshal_get_runtime_invoke_full':
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

5 years agosgen-mono.c:260:1: warning: 'install_noilgen' defined but not used [-Wunused-function]
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

5 years agoIn file included from sgen-new-bridge.c:31:0:
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

5 years agothreads.c:6403:6: warning: 'current_idx' may be used uninitialized in this function...
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

5 years agosgen-dynarray.h:248:1: warning: 'dyn_array_ptr_set' defined but not used [-Wunused...
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

5 years agoIn file included from sre.c:30:0:
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

5 years agosre.c:2067:1: warning: 'is_sr_mono_field' defined but not used [-Wunused-function]
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

5 years agow32handle.c: In function 'mono_w32handle_wait_multiple':
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

5 years agocustom-attrs.c:269:1: warning: 'load_cattr_type_object' defined but not used [-Wunuse...
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

5 years agosre-save.c:114:1: warning: 'swap_with_size' defined but not used [-Wunused-function]
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

5 years agomono-mmap.c: In function 'mono_file_map_error':
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

5 years agothreadpool.c: In function 'mono_threadpool_remove_domain_jobs':
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

5 years agofix RuntimeType.cs
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

5 years agoFix race conditions in mono_lazy_initialize,
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

5 years agoReplace MONO_PATCH_INFO_TRAMPOLINE_FUNC_ADDR with MONO_PATCH_INFO_JIT_ICALL_ADDR...
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

5 years ago[interp] Prefer interp_in wrappers over trampolines (mono/mono#14684)
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

5 years ago[debugger-agent] Ignore thread_end event if thread is detached
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

5 years ago[System.Private.CoreLib] Extract RuntimeType for easier refactoring
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

5 years ago[netcore] Fix CI build script (mono/mono#15130)
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

5 years agoRead only interp callbacks, option 4, without ordering sensitivity.
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

5 years agoCleanup AIX code a little.
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

5 years ago[netcore] Arcade does not yet have CLSCompliant support, revert to manual settings
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

5 years agoImplementing reabstraction of default interface methods. (mono/mono#14790)
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

5 years ago[netcore] Add more Arcade magic for signing
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

5 years ago[metadata] Move problematic image out-param usage (mono/mono#15131)
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

5 years ago[mini] Move some MONO_API functions to public header (mono/mono#15105)
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

5 years agoFix csproj
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

5 years agoDeadlock in loader when using bundling. (mono/mono#15061)
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

5 years ago[netcore] Clean up netcore build
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

5 years agoFix S390x compile since mono/mono#14870 and a warning. (mono/mono#15056)
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

5 years ago[wasm] fix most cases of numeric debugging for wasm
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

5 years agoDon't create a cycle when translating IL `break` to IR. (mono/mono#14980)
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

5 years agoPropagate error in mono_unicode_to_external (mono/mono#14879)
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

5 years ago[netcore] Bump roslyn version
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

5 years ago[crash] Print native module name when crash privacy disabled (mono/mono#14986)
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

5 years ago[netcore] Enable CoreFX tests on CI for Linux (mono/mono#15015)
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

5 years agoEnable the compiler server by default
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

5 years ago[runtime] Fix gshared support for BeginInvoke ()/EndInvoke () wrappers. (mono/mono...
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

5 years ago[jit] Fix interface cast (mono/mono#14978)
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

5 years agoPlug leak of ppdb_filename
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

5 years ago[runtime] Switch to GC Unsafe for all GC external API functions
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

5 years ago[netcore] Run CoreFX tests on CI (macOS) (mono/mono#14849)
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

5 years ago[aot] Open AOT profile files using "rb" so it works on windows.
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

5 years ago[llvm] Fix disabling direct calls and inlining (mono/mono#14880)
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

5 years ago[install] Include .exe extension when symlinking the mono binary (mono/mono#14958)
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

5 years agoMerge pull request mono/mono#14811 from lateralusX/lateralusX/fix-lmf-with-ctx-window...
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

5 years agoRemove JIT icall hashing by address. (mono/mono#14870)
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

5 years ago[wasm] Prototype for collecting aot profile data. (mono/mono#14865)
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

5 years agoCleanup amd64 emit_call / emit_call_body -- last parameter always FALSE. (mono/mono...
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

5 years ago[wasm] Switch to the LLVM wasm backend. (mono/mono#14734)
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