Bernhard Urban-Forster [Fri, 17 Jan 2020 10:05:50 +0000 (11:05 +0100)]
[prof] remove wrong cast for format string (mono/mono#18477)
[prof] remove wrong cast for format string
Fixes this warning:
```
CC mprof-report.o
mprof-report.c:408:62: warning: format specifies type 'char *' but the argument has type 'guint64' (aka 'unsigned long long') [-Wformat]
snprintf (format, sizeof (format), "%s : %%" PRIu64 "\n", (guint64)key_format);
~~ ^~~~~~~~~~~~~~~~~~~
%llu
/Applications/Xcode112.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro
'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
```
mistake in refactoring commit https://github.com/mono/mono/commit/mono/mono@
07402062541fa9555bef99dbaac84cfb587926cd#diff-c825627ea9ddb3fa753fa3617eaec7c8R408
Commit migrated from https://github.com/mono/mono/commit/
73eeda130fceacebec5f1ccbae10478e7fc7c051
Aleksey Kliger (λgeek) [Fri, 17 Jan 2020 09:43:05 +0000 (04:43 -0500)]
[netcore] Mark InitializeCurrentThread NoInlining (mono/mono#18493)
Follow-up for https://github.com/mono/mono/pull/18480
We might want to replace calls to this with an intrinsic
Commit migrated from https://github.com/mono/mono/commit/
1f0e147cddcc9b900f7e487dfed2a8ca008830b0
Bernhard Urban-Forster [Fri, 17 Jan 2020 08:36:32 +0000 (09:36 +0100)]
[runtime] fix warnings on linux (gcc 8.3.0) (mono/mono#18479)
* [aot] fix warnings on linux (gcc 8.3.0)
Fixes these warnings:
```
aot-compiler.c: In function ‘emit_trampolines’:
aot-compiler.c:7675:28: warning: ‘_e’ directive writing 2 bytes into a region of size between 1 and 256 [-Wformat-overflow=]
sprintf (end_symbol, "%s_e", symbol);
^~
aot-compiler.c:7675:4: note: ‘sprintf’ output between 3 and 258 bytes into a destination of size 256
sprintf (end_symbol, "%s_e", symbol);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
aot-compiler.c:753:1: warning: ‘link_shared_library’ defined but not used [-Wunused-function]
link_shared_library (MonoAotCompile *acfg)
^~~~~~~~~~~~~~~~~~~
aot-compiler.c:558:1: warning: ‘mangle_symbol_alloc’ defined but not used [-Wunused-function]
mangle_symbol_alloc (const char * symbol)
^~~~~~~~~~~~~~~~~~~
aot-compiler.c:535:1: warning: ‘mangle_symbol’ defined but not used [-Wunused-function]
mangle_symbol (const char * symbol, char * mangled_symbol, gsize length)
^~~~~~~~~~~~~~~~~~~
```
* [amd64] fix warnings on linux (gcc 8.3.0)
Fixes this warning:
```
tramp-amd64.c: In function ‘mono_arch_create_generic_trampoline’:
tramp-amd64.c:242:65: warning: variable ‘ex_offset’ set but not used [-Wunused-but-set-variable]
int i, lmf_offset, offset, res_offset, arg_offset, rax_offset, ex_offset, tramp_offset, ctx_offset, saved_regs_offset;
^~~~~~~~~
```
* [lldb] fix warnings on linux (gcc 8.3.0)
Fixes these warnings:
```
lldb.c:243:1: warning: ‘buffer_add_buffer’ defined but not used [-Wunused-function]
buffer_add_buffer (Buffer *buf, Buffer *data)
^~~~~~~~~~~~~~~~~
lldb.c:215:1: warning: ‘buffer_add_id’ defined but not used [-Wunused-function]
buffer_add_id (Buffer *buf, int id)
^~~~~~~~~~~~~
lldb.c:208:1: warning: ‘buffer_add_long’ defined but not used [-Wunused-function]
buffer_add_long (Buffer *buf, guint64 l)
^~~~~~~~~~~~~~~
lldb.c:188:1: warning: ‘buffer_add_short’ defined but not used [-Wunused-function]
buffer_add_short (Buffer *buf, guint32 val)
^~~~~~~~~~~~~~~~
```
* [interp] fix warnings on linux (gcc 8.3.0)
Fixes these warnings:
```
interp/interp.c:3425:1: warning: ‘g_error_xsx’ defined but not used [-Wunused-function]
g_error_xsx (const char *format, int x1, const char *s, int x2)
^~~~~~~~~~~
CC interp/libmono_ee_interp_la-mintops.lo
CC interp/libmono_ee_interp_la-transform.lo
CCLD libmono-ee-interp.la
ar: `u' modifier ignored since `D' is the default (see `U')
CC libmono_dbg_la-debugger-agent.lo
CC libmono_dbg_la-debugger-state-machine.lo
CC libmono_dbg_la-debugger-engine.lo
CCLD libmono-dbg.la
ar: `u' modifier ignored since `D' is the default (see `U')
CCLD mono-sgen
AR libmain.a
ar: `u' modifier ignored since `D' is the default (see `U')
CC interp/libmaintest_a-whitebox.o
In file included from interp/whitebox.c:3:
interp/transform.h:163:12: warning: ‘stack_type’ defined but not used [-Wunused-variable]
static int stack_type [] = {
^~~~~~~~~~
interp/transform.h:155:20: warning: ‘stack_type_string’ defined but not used [-Wunused-variable]
static const char *stack_type_string [] = { "I4", "I8", "R4", "R8", "O ", "VT", "MP", "F " };
^~~~~~~~~~~~~~~~~
```
* [thread state] fix warnings on linux (gcc 8.3.0)
Fixes these warnings:
```
CC libmonoutils_la-mono-threads-state-machine.lo
mono-threads-state-machine.c:33:1: warning: ‘get_thread_no_safepoints’ defined but not used [-Wunused-function]
get_thread_no_safepoints (int thread_state)
^~~~~~~~~~~~~~~~~~~~~~~~
mono-threads-state-machine.c:26:1: warning: ‘get_thread_suspend_count’ defined but not used [-Wunused-function]
get_thread_suspend_count (int thread_state)
^~~~~~~~~~~~~~~~~~~~~~~~
```
* [domain] fix warnings on linux (gcc 8.3.0)
Fixes these warnings:
```
appdomain.c:2415:1: warning: ‘get_app_context_base_directory’ defined but not used [-Wunused-function]
get_app_context_base_directory (MonoError *error)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC libmonoruntimesgen_la-assembly-load-context.lo
CC libmonoruntimesgen_la-domain.lo
domain.c:135:1: warning: ‘mono_domain_alcs_lock’ declared ‘static’ but never defined [-Wunused-function]
mono_domain_alcs_lock (MonoDomain *domain);
^~~~~~~~~~~~~~~~~~~~~
domain.c:138:1: warning: ‘mono_domain_alcs_unlock’ declared ‘static’ but never defined [-Wunused-function]
mono_domain_alcs_unlock (MonoDomain *domain);
^~~~~~~~~~~~~~~~~~~~~~~
domain.c:2129:1: warning: ‘mono_alc_free’ defined but not used [-Wunused-function]
mono_alc_free (MonoAssemblyLoadContext *alc)
^~~~~~~~~~~~~
domain.c:2108:1: warning: ‘mono_domain_create_default_alc’ defined but not used [-Wunused-function]
mono_domain_create_default_alc (MonoDomain *domain)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
domain.c:2084:1: warning: ‘create_alc’ defined but not used [-Wunused-function]
create_alc (MonoDomain *domain, gboolean is_default)
^~~~~~~~~~
```
* [native library] fix warnings on linux (gcc 8.3.0)
Fixes this warning:
```
CC libmonoruntimesgen_la-native-library.lo
native-library.c:295:1: warning: ‘mono_loader_register_module_locking’ defined but not used [-Wunused-function]
mono_loader_register_module_locking (const char *name, MonoDl *module)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* [sample] fix warnings on linux (gcc 8.3.0)
Fixes this warning:
```
CC libtestlib_la-test-mono-embed.lo
In file included from test-mono-embed.c:7:
../../samples/embed/teste.c:20:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
gimme () {
^~~~~
```
* fix for checked builds
Commit migrated from https://github.com/mono/mono/commit/
b4c506c3045516349d03ce8f3fe9fa5b79a7271c
Aleksey Kliger (λgeek) [Fri, 17 Jan 2020 02:57:54 +0000 (21:57 -0500)]
[runtime] NOHANDLES for ves_icall_System_Threading_Thread_GetCurrentThread (mono/mono#18480)
* [runtime] NOHANDLES for ves_icall_System_Threading_Thread_GetCurrentThread
This function (and its call to mono_handle_new) was showing up in the
flamegraph for some async-heavy benchmarks
Commit migrated from https://github.com/mono/mono/commit/
c1498b8d4ce83732d1bab794005cc12f8319053d
Aleksey Kliger (λgeek) [Fri, 17 Jan 2020 00:27:23 +0000 (19:27 -0500)]
[interp] Add missing files to tarball (mono/mono#18482)
Commit migrated from https://github.com/mono/mono/commit/
2ba25542e3f3c396ab0b3f516d80c968b39acb23
Thays Grazia [Thu, 16 Jan 2020 22:23:58 +0000 (19:23 -0300)]
Revert "On android sometimes there is no valid_info but the ctx is valid and the debug can continue. (mono/mono#18463)" (mono/mono#18490)
This reverts commit mono/mono@
61894d4a0745783372f3214f3bf4345d620fbc21.
Commit migrated from https://github.com/mono/mono/commit/
e2d8f5ee91f171edb3b49a2e59a353b4e819adb4
Thays Grazia [Thu, 16 Jan 2020 20:34:22 +0000 (17:34 -0300)]
On android sometimes there is no valid_info but the ctx is valid and the debug can continue. (mono/mono#18463)
Fixes mono/mono#18106
Commit migrated from https://github.com/mono/mono/commit/
61894d4a0745783372f3214f3bf4345d620fbc21
Bernhard Urban-Forster [Wed, 15 Jan 2020 17:35:53 +0000 (18:35 +0100)]
[arm] account for signed bit when calculating offset to PLT entry (mono/mono#18454)
[arm] account for signed bit when calculating offset to PLT entry
See `bl` documentation (make sure you look at the thumb2 one):
<img width="1003" alt="Screenshot 2020-01-14 at 22 43 33" src="https://user-images.githubusercontent.com/75403/
72385601-
2bb53b00-3720-11ea-9858-
d73bc2d02a7e.png">
Fixes https://github.com/mono/mono/issues/18247
Commit migrated from https://github.com/mono/mono/commit/
bdde94b8e2e08761d0f562dcbcc5c4c7fb497ab3
Aleksey Kliger (λgeek) [Wed, 15 Jan 2020 09:47:27 +0000 (04:47 -0500)]
[loader] ReflectionOnlyLoad(byte[]) should not apply binding redirects (mono/mono#18457)
* [loader] ReflectionOnlyLoad(byte[]) should not apply binding redirects
Match .NET Framework behavior.
Addresses https://github.com/mono/mono/issues/18388
* [tests] ReflectionOnlyLoad(byte[]) should not apply binding redirects
Regression test for https://github.com/mono/mono/issues/18388
Commit migrated from https://github.com/mono/mono/commit/
e7e81a47c93f8a2e1128a4d0fd515fa235dbcf19
Maher Jendoubi [Tue, 14 Jan 2020 21:30:06 +0000 (22:30 +0100)]
Contributing: fixing some typos (mono/mono#18453)
Commit migrated from https://github.com/mono/mono/commit/
f4567e83dde9393fe19d4cb7e315c21899c67a3f
Jay Krell [Tue, 14 Jan 2020 21:17:00 +0000 (13:17 -0800)]
Reduce some stack use and cleanup. (mono/mono#17809)
Commit migrated from https://github.com/mono/mono/commit/
6eea4a18f0b58e9db0aee09b40f328d1b13ced87
Vlad Brezae [Tue, 14 Jan 2020 14:13:27 +0000 (16:13 +0200)]
[utils] Make sure we include WRAP_ATOMIC_INTRINSIC if needed
Currently, this doesn't impact any targets, but do it for consistency.
Fixes https://github.com/mono/mono/issues/10651
Commit migrated from https://github.com/mono/mono/commit/
fef06df53729a7e0159660494b0ecc1c5b3fe0c7
Vlad Brezae [Tue, 14 Jan 2020 14:09:33 +0000 (16:09 +0200)]
[utils] Include missing define of MONO_GNUC_VERSION
We were adding the WRAP_ATOMIC_INTRINSIC all the time on arm64, due to missing MONO_GNUC_VERSION.
Commit migrated from https://github.com/mono/mono/commit/
7fb011aa5a5475b59d3b2f16256fc745ed1bda15
Jay Krell [Tue, 14 Jan 2020 21:03:22 +0000 (13:03 -0800)]
Fix many printf warnings (mono/mono#16484)
* Do not `printf` `long long` or `unsigned long long`.
*Do* printf `gint64` or `guint64`.
Do not printf %ll.
Do not printf %z.
gint64 == int64_t, which could be long, or long long, or maybe other
guint64 == uint64_t, ditto
For printing gint64/guint64, use PRId64, PRIx64, etc.
For printing gsize/gssize, use `G_GSIZE_FORMAT` (seems like excess `G`).
%z definitely would warn for every single use, with Mingw.
And %ll might also, since on 64bit platforms, gint64 tends to be
long, not long long, and would merit %l not %ll.
(No matter that %ll is merited on 32bit, and the behavior
would then be correct on both.).
If there becomes a system w/o PRId64 etc., and it is a 64bit system,
then we could use %l under a portable name.
Or %I64. This appears unlikely (unless reach is extended to older Windows runtime).
Note that PRIxPTR for gsize/intptr_t may be a good idea too.
Commit migrated from https://github.com/mono/mono/commit/
07402062541fa9555bef99dbaac84cfb587926cd
Ryan Lucia [Tue, 14 Jan 2020 21:01:13 +0000 (16:01 -0500)]
[netcore] Implement Thread.GetCurrentProcessorId (mono/mono#18450)
CoreCLR has a managed cache surrounding this, but for the moment the naive implementation will suffice. We can later move their managed cache to shared on top of this PR with minimal trouble.
We can't guarantee the id will be [0..CpuCount) for a variety of reasons, and a followup PR to the dotnet docs will clarify this. I've chosen not to intentionally add an offset, but no one should be relying on that behavior, and if someone thinks adding an offset would drive the point home the perf cost is irrelevant.
Commit migrated from https://github.com/mono/mono/commit/
3b19228a668644e19944258d14124442cabf3003
Bernhard Urban-Forster [Tue, 14 Jan 2020 20:59:48 +0000 (21:59 +0100)]
[interp] initial infrastructure for whitebox testing of optimization passes (mono/mono#18268)
Commit migrated from https://github.com/mono/mono/commit/
05f2651a12ba5eae1de8b488c4026145622b265a
Vlad Brezae [Tue, 14 Jan 2020 19:42:14 +0000 (11:42 -0800)]
[sgen] Fixes for max-heap-size option (mono/mono#18446)
* [sgen] Don't subtract twice the nursery size from max_heap_size
We were subtracting the nursery size when initializing max_heap_size as well as adding it to the allocated_heap when allocating the nursery (alloc_nursery).
* [sgen] Trigger collection if failing to allocate los section
If the memory governor says we are exceeding the max_heap_size by allocating a los section (1MB) for a new los object, attempt to clear some space by triggering a major collection, before completely bailing out.
Commit migrated from https://github.com/mono/mono/commit/
d9db79b4b281afc5064921ff69a4bbbfb2c5f0e1
Jay Krell [Tue, 14 Jan 2020 18:28:54 +0000 (10:28 -0800)]
[cxx] Make the externC of icalls configuration-dependent instead of always. (mono/mono#17573)
There are pluses and minuses here:
+ Minimize externC.
+ Maximimze typesafe linkage.
- Minimize configuration-sensitivity.
- Maximize commonality across all configurations, so that
success in one configuration maximally but not 100% implies
success in others (which is why to avoid `#if` in general,
to contribute toward compilation success).
+ Use higher level macros to explain reason.
Even if ICALL_EXTERN_C was always externC (presently not),
using it instead of plain G_EXTERN_C offers a builtin comment.
Commit migrated from https://github.com/mono/mono/commit/
5237696f65cda0f079562838990b4effd4d65eee
Egor Bogatov [Tue, 14 Jan 2020 15:37:16 +0000 (18:37 +0300)]
Optimize typeof(T).IsValueType (mono/mono#18307)
* Optimize Type.IsValueType
* Ignore gsharedvt types
* use mini_is_gsharedvt_variable_klass
* test
* fix build
Commit migrated from https://github.com/mono/mono/commit/
08bb5660f6b2cc87ec59fb77c01a1f8cdeda183f
Jay Krell [Tue, 14 Jan 2020 13:20:15 +0000 (05:20 -0800)]
Remove comment about unexplained C++/LLVM problem. (mono/mono#18447)
The explanations/fixes were:
Compile consistently as C++:
https://github.com/mono/mono/commit/mono/mono@
893486638cae8efc46323d6c2209fc99febcd05d
Make inconsistent compilation safe since it was fragile:
https://github.com/mono/mono/commit/mono/mono@
b2817e6404d573e837e1d8c7e047135974a3b311
Commit migrated from https://github.com/mono/mono/commit/
c32414966c76a10741949d4f40e0dc737753e44f
Jonathan Chambers [Tue, 14 Jan 2020 11:56:09 +0000 (06:56 -0500)]
Add mono_gc_thread_detach callback. (mono/mono#18408)
Add mono_gc_thread_detach callback for Boehm
Use under Boehm to detach without threads lock as Boehm will take it's own lock internally.
Note in `on_gc_notification` we take threads lock after Boehm already has it's own lock. For consistency and to prevent deadlocks always take lock ordering of Boehm then threads lock.
Commit migrated from https://github.com/mono/mono/commit/
480bef72172856bd0f1a57243ddb53e98684f7d1
Jay Krell [Tue, 14 Jan 2020 11:32:08 +0000 (03:32 -0800)]
[cxx] Fixes for all lanes to build as C++ but w/o configure.ac change. (mono/mono#17452)
* [cxx] dlmalloc remove extern "C" and remove NO_MALLINFO.
* [cxx] Move CallInst bitfields to the end to minimize padding for alignment
and fix an unexplained LLVM problem.
Commit migrated from https://github.com/mono/mono/commit/
dc866c2aadb6f6aba04ca0b5eb5799c4e5b7a0fd
Egor Bogatov [Tue, 14 Jan 2020 11:04:21 +0000 (14:04 +0300)]
Merge pull request mono/mono#18293 from EgorBo/vt-gettype-boxing
Optimize boxing for var.GetType()
Commit migrated from https://github.com/mono/mono/commit/
f5e1bd3cdf07f914dad86377fab2b1bc6df08d61
Alexander Köplinger [Mon, 13 Jan 2020 20:27:11 +0000 (21:27 +0100)]
[netcore] Fix build warning
Commit migrated from https://github.com/mono/mono/commit/
53ade46065e28d3c2b2129e1f4abba533a14c685
Aleksey Kliger (λgeek) [Mon, 13 Jan 2020 20:15:09 +0000 (15:15 -0500)]
[netcore] Require use of MonoClass getters in Debug builds (mono/mono#18267)
1. Update `build.sh` to use `--enable-checked-build=private_types` which forces the use of getter methods to access `MonoClass` fields.
2. Fix up some places that were accessing MonoClass directly.
3. Get rid of a spurious comma operator usage from an earlier refactoring:
```c
z = a, b, c;
```
is the same as
```c
z = a; b; c;
```
which is the same as just `z = a;` if `b` and `c` have no side-effects.
Commit migrated from https://github.com/mono/mono/commit/
6abab691ec71c3cb4f72dd6d8f630088c8330357
Alexander Köplinger [Mon, 13 Jan 2020 19:47:35 +0000 (20:47 +0100)]
Write version.h for netcore and allow preview VS for msvc builds
Commit migrated from https://github.com/mono/mono/commit/
a5cc4cd9ec6a595231c7aeb84a8166c736b867e3
Maxim Lipnin [Mon, 13 Jan 2020 16:06:55 +0000 (19:06 +0300)]
[netcore] Make System.Diagnostics.TraceSourceTests.DefaultTraceListenerClassTests.EntryAssemblyName_Null_NotIncludedInTrace Pass (mono/mono#18403)
* [netcore] Extract Assembly.GetEntryAssembly method to shared part
Commit migrated from https://github.com/mono/mono/commit/
87cfaf15ae8687524b1f18e21c85a2680d7fe5e0
Egor Bogatov [Mon, 13 Jan 2020 12:51:51 +0000 (15:51 +0300)]
[netcore][llvm] Implement Sse1-4.2 subsets used by corlib (mono/mono#18103)
* Implement SSE41 subset used by corlib
* Implement Sse2.MoveMask
* only works with llvm
* Implement Sse3 and Ssse3 subsets used by corlib
* Implement a few SSE1 methods
* Address feedback, also, implement Sse.Add/Subtract
* Fix build
* Implement Sse.Multiply, Sse.Store
* Implement Sse.CompareNotEquals
* Implement Sse.MoveScalar
* Finish SSE1 corlib subset
* Implement Sse.LoadVector128, Sse.Shuffle
* Sse.Shuffle cleanup
* Implement Sse2 APIs
* More of SSE2: LoadAlignedVector128, Compare*
* Implement Sse2.Unpack* and Sse2.StoreScalar
* Implement Sse2.PackUnsignedSaturate
* Implement Sse2.ShiftRightLogical
* Implement Sse2.Shuffle
* Implement Vector128<T>.Zero
* Fix CreateScalarUnsafe
* Implement Vector128.As*, Fix Vector128.CreateScalarUnsafe
* Fix failures
* Fix failures
* Fix Sse.MoveMask
* remove redundant null checks
* Fix AOT failures
* fix compilation warrning
* rename create_vector_mask_*
* Fix failures found via tests
* Index in Sse41.Insert has to be a constant
* add local tests for mono
* Update tests (cleanup)
* Code cleanup
* test
* fix typo
* Clean up
* Clean up
* Implement And, AndNot, Or, Xor, Divide for Sse1
* Cleanup
* Fix build
* limit emit_vector128 with LLVM
* enable IsSupported for corlib
* Fix build on wasm (if-defs issue)
* Don't intrinsify Vector256
* Address feedback
Commit migrated from https://github.com/mono/mono/commit/
423192ed85c0b2263b46f3f4cfa63ec7b90b3f31
Zoltan Varga [Mon, 13 Jan 2020 11:09:09 +0000 (12:09 +0100)]
[jit] Fix an assertion in the Thread.VolatileRead () intrinsic. (mono/mono#18430)
Fixes https://github.com/mono/mono/issues/18418.
Commit migrated from https://github.com/mono/mono/commit/
4b718ca1f2547172e3bb68e9b87f1bde11429528
Vlad Brezae [Mon, 13 Jan 2020 11:05:25 +0000 (03:05 -0800)]
[interp] Fix struct copying during pinvoke transitions (mono/mono#18402)
If we are in pinvoke wrapper, we need to use the marshalled native size, not the managed size.
Commit migrated from https://github.com/mono/mono/commit/
a13f5ccbb60d162fe3a8ffdbb9cd61c9c1f8a425
Vlad Brezae [Fri, 10 Jan 2020 07:32:04 +0000 (09:32 +0200)]
[interp] Add gc unsafe transition during pinvokes (mono/mono#18399)
Native methods can be run in gc safe mode, meaning we can be in gc safe mode while setting/getting the arguments for a native transition. Call context computation requires us to be in unsafe mode.
Fixes https://github.com/mono/mono/issues/16969
Commit migrated from https://github.com/mono/mono/commit/
d33a1009619531b41ed884380aab9abbbf317509
Alexander Köplinger [Thu, 9 Jan 2020 17:06:53 +0000 (18:06 +0100)]
Fix line endings in .bat files
They need to be CRLF otherwise we'll get conflicts when moving into dotnet/runtime which has a .gitattributes setting forcing .bat to CRLF.
Commit migrated from https://github.com/mono/mono/commit/
c9dc20f59ebe7fbed2a439d69c2d03a2d4500577
Maxim Lipnin [Thu, 9 Jan 2020 16:01:57 +0000 (19:01 +0300)]
[netcore][xunit tests] Re-enable System.Diagnostics.Tests.ProcessTests.ProcessStart_UseShellExecute_ExecuteOrder (mono/mono#18397)
mono/mono#14903
Commit migrated from https://github.com/mono/mono/commit/
f5aca4235ef9508954425eb5bcb72311cbe56a0d
Vlad Brezae [Thu, 9 Jan 2020 10:08:15 +0000 (12:08 +0200)]
[interp] Throw overflow exception when converting NaN (mono/mono#18384)
Fixes https://github.com/mono/mono/issues/18061
Commit migrated from https://github.com/mono/mono/commit/
345550fb99a12f66054b7c1f545b4d117368c47f
Bernhard Urban-Forster [Thu, 9 Jan 2020 09:46:03 +0000 (10:46 +0100)]
[memory barrier] use pagesize determined by helper (mono/mono#18383)
[memory barrier] use pagesize determined by helper
`limits.h` doesn't always define `PAGESIZE` properly (e.g. iOS), so it would fall back to `0x1000` (4096) but it's really `0x4000` (16384) on iOS. We already have a helper in the runtime to determine the pagesize, so let's use that instead.
Fixes https://github.com/mono/mono/issues/18273
Commit migrated from https://github.com/mono/mono/commit/
207cf805e54f0444616ace9433fe84c6eb2eec78
Ryan Lucia [Wed, 8 Jan 2020 22:02:25 +0000 (17:02 -0500)]
[reflection] Fix check for Type.FullName to match CoreCLR (mono/mono#18385)
Updated test to follow in dotnet/runtime
Commit migrated from https://github.com/mono/mono/commit/
9fd95db929a8adb9e4d41887eea77af704a1fca4
Ryan Lucia [Wed, 8 Jan 2020 20:57:16 +0000 (15:57 -0500)]
[metadata] Propagate error in mono_runtime_try_invoke_array (mono/mono#18382)
This was prompted by https://github.com/mono/mono/issues/18339, which seems to be failing to locate a native library and then hitting an assertion. We should propagate the error instead, so that if others run into something similar they can see what's actually going wrong instead of just getting a runtime crash.
Commit migrated from https://github.com/mono/mono/commit/
1178ab3a1a48dbc831ecd905a7d88bfd417e0d73
Jay Krell [Wed, 8 Jan 2020 18:34:11 +0000 (10:34 -0800)]
[Coop] Remove handles from Mono.Interop.ComInteropProxy. (mono/mono#16993)
Commit migrated from https://github.com/mono/mono/commit/
e8d38961eedfc4d5575ec264483bbe9dbdd59282
Zoltan Varga [Wed, 8 Jan 2020 15:39:39 +0000 (16:39 +0100)]
[runtime] Initialize field info before accessing it in ves_icall_System_RuntimeFieldHandle_SetValueDirect (). (mono/mono#18378)
Fixes https://github.com/mono/mono/issues/18364.
Commit migrated from https://github.com/mono/mono/commit/
34dee0ea4e969d6d5b37cb842fc3b9f73f2dc2ae
Zoltan Varga [Wed, 8 Jan 2020 12:32:52 +0000 (13:32 +0100)]
[jit] Implement fast TLS access in gshared methods. (mono/mono#18377)
Fixes https://github.com/mono/mono/issues/18370.
Commit migrated from https://github.com/mono/mono/commit/
e999846088bb4b05b2fa22234bd70fb42fd02a80
Bernhard Urban-Forster [Tue, 7 Jan 2020 18:35:54 +0000 (19:35 +0100)]
[interp] run regression with all combinations of available optimizations (mono/mono#17644)
[interp] run regression with all combinations of available optimizations
Like we do for the JIT.
Commit migrated from https://github.com/mono/mono/commit/
6481e8f7a3f2ff1b23310446711179bc31789d7d
Calvin Buckley [Tue, 7 Jan 2020 16:28:06 +0000 (12:28 -0400)]
Force Python 3.x from env in shebang lines (mono/mono#18285)
* Fix byte/string incompatiblity in Python 3
Commit migrated from https://github.com/mono/mono/commit/
524a8298d0c8cda332c17a743eaed69ce78f392d
Zoltan Varga [Tue, 7 Jan 2020 16:12:34 +0000 (17:12 +0100)]
[netcore] Remap String ctors to the String:Ctor () methods. (mono/mono#18357)
Commit migrated from https://github.com/mono/mono/commit/
ec7f4c68f989d6ce037f7b03094826a131e40f46
Calvin Buckley [Tue, 7 Jan 2020 14:44:03 +0000 (10:44 -0400)]
More disambiguation of Python in makefiles (mono/mono#18284)
Commit migrated from https://github.com/mono/mono/commit/
b3ce5bfa887e4542b5360e51f2a8ae483b58e07a
Vlad Brezae [Tue, 7 Jan 2020 14:31:49 +0000 (16:31 +0200)]
[sgen] Fix xref computation with tarjan bridge (mono/mono#18239)
* [sgen] Include also derived classes as bridges
When using `MONO_GC_DEBUG=bridge=` debug option
* [sgen] Fix xref computation with tarjan bridge
Between C# and java (on android) there are objects that live on both worlds. This means that there exists a C# object with a corresponding java object. The relationship between them is strong, meaning if C# object is alive then java object must stay alive, and vice-versa. We keep java bridge objects always alive through a GCHandle (on the java gc). When doing a C# collection we select all bridge objects that appear to be dead on the C# side. These objects are candidates for collection, assuming the java side has nothing against it. Before triggering a collection on the java side (following the mono gc) we switch all the strong gchandles to the java objects to be weak (for these objects that are candidate to be collected) and we recreate the reference graph from the C# side to the java side (if C# Bridge1 can reference C# Bridge2 then, on the java side, we add a reference from Java Bridge1 to Java Bridge2; this is done by adding to an array of references inside Java Bridge1). In order to minimize the amount of work that needs to be done on the java side, we compute the minimal amount of references that need to be added, by computing the strongly connected components of the object graph.
An optimized way to construct the SCCs and the xrefs is by using the tarjan algorithm (https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm). Our algorithm is non recursive (scan_stack emulates the recursive order of traversal in a dfs algorithm, while loop_stack is the stack used by the algorithm). A color represents an SCC. We have some optimizations in place where we might merge colors if they don't contain bridges, since the client only cares about SCCs containing bridge objects and the links between them. color_merge_array is used to keep track of all neighbors of a node until we are creating the scc for that node. It is populated when scanning all the refs inside an object (compute_low). All the colors in the color_merge_array will be cross references with that scc.
Before this commit we were only clearing the color_merge_array when creating an SCC. This is problematic because we could end up with xrefs inside of an SCC that belong to another SCC. Consider the simple graph of nodes 0,1,2,3 where 0 <=> 2, 0->1, 2->3. Assume we start scanning with node 0. When creating the SCC for node 3 the followed path is 0 -> 2 -> 3, while the loop stack will contain (0,1,2,3). After creating SCC for node 3, we will finish scanning node 2 which would detect the xref to Bridge3, which would have been added to the color_merge_array. Because node 2 is not the root of the SCC it belongs to (its lowlink points towards node 0 which has a lower index), we are not creating an SCC with it, and the link to node 3 remains in color_merge_array. Because the next node from the scan_stack is node 1, which is also the root of the SCC that it belongs to, we will create an SCC for it and wrongly add the node 3 reference from color_merge_array to it. In order to fix this issue, we will always clear the color_merge_array once we finished scanning the xrefs for a node. If the node in question is not the root of an scc, then we will remember them as xrefs pointing out from this object. When we finally reach node 0 (which will be the root of the SCC containing nodes 0 and 2), we will then know that all xrefs for this color are the union of the xrefs of all objects belonging to this color (which represents the objects that we are popping from the loop_stack until we encounter the root node).
Even though this change adds required bookeeping for xrefs, I didn't notice any change in performance on the bridge tests that we have in mono/tests.
* [sgen] Some logging improvements in tarjan bridge
* [sgen] Disable optimization when comparing bridge outputs
When this optimization is enabled, the tarjan bridge will create more SCCs in order to reduce amount of xrefs in the graph. This would render the `bridge-compare-to` debug flag unusable with tarjan bridge.
Commit migrated from https://github.com/mono/mono/commit/
376c46bcf3bc101fba85a402914d60c6bda70e75
Jay Krell [Tue, 7 Jan 2020 14:01:22 +0000 (06:01 -0800)]
Set thread pool thread name just based on string pointer check. (mono/mono#16637)
* Set thread pool thread name just based on string pointer check.
When the generation-based solution went in, there were not
yet constant thread names, so a pointer based approach could fail
due to reuse. We can do slightly simpler now.
* Remove the generation field which is no longer needed.
Remove the duplicated knowledge of how to set a constant and put
it behind a funny sounding but perhaps reasonable flag.
Revise corlib version.
Commit migrated from https://github.com/mono/mono/commit/
2129ac6c282560e3039a38de9ebbebcdfab6f149
EgorBo [Tue, 7 Jan 2020 12:18:51 +0000 (15:18 +0300)]
Address Zoltan's feedback (enable for AOT)
Commit migrated from https://github.com/mono/mono/commit/
e6c0cdae0ca94955c3c1e7083b3eb906a5824c3e
EgorBo [Tue, 7 Jan 2020 11:50:16 +0000 (14:50 +0300)]
Merge branch 'master' of github.com:mono/mono into vt-gettype-boxing
Commit migrated from https://github.com/mono/mono/commit/
1c5a29508202267ebdb30ae99a283f919a87dd6b
Marek Safar [Tue, 7 Jan 2020 10:17:06 +0000 (11:17 +0100)]
[System.Private.CoreLib] Cleanup intrinsic tracking (mono/mono#17884)
* [System.Private.CoreLib] Cleanup intrinsic tracking
1. Removed icalls where intrinsic version for the method exists
2. Add [Intrinsic] attribute to methods which have runtime intrinsic
to make them easier to track and to tell linker not to analyze them
3. Use recursive syntax for any intrinsic which can be called via
reflection to correctly apply the intrinsic when invoked.
```c#
public static bool IsSupported { get => IsSupported; }
```
When one calls X86.IsSupported, the call gets replaced by an
intrinsics. When one calls it with an Invoke, the body of IsSupported
gets replaced by intrinsics. It's just a hack to get Invoke support for free.
* [interp] implement System.Type::op_Equality
* Undo changes which are not yet supported by interpreter
* [interp] Implement System.Runtime.CompilerServices.RuntimeHelpers::OffsetToStringData
Co-authored-by: Bernhard Urban-Forster <bernhard.urban@xamarin.com>
Commit migrated from https://github.com/mono/mono/commit/
adcd62248d8956ab4d512c5b970c867b7432887f
Zoltan Varga [Tue, 7 Jan 2020 01:57:10 +0000 (02:57 +0100)]
[jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods. (mono/mono#18334)
* [jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods.
Fixes https://github.com/mono/mono/issues/18276.
* Fix compilation with mcs.
Commit migrated from https://github.com/mono/mono/commit/
487dacce79f0191dd7275c40756e9ccb42fa7ff0
Jay Krell [Mon, 6 Jan 2020 21:11:21 +0000 (13:11 -0800)]
Do not depend on gboolean to have multiple bits. (mono/mono#17825)
Commit migrated from https://github.com/mono/mono/commit/
6a8ca2252b9e140949a73614d78ea327b111130e
Zoltan Varga [Mon, 6 Jan 2020 15:36:59 +0000 (16:36 +0100)]
[netcore] Optimize RuntimeType::IsSZArray. (mono/mono#18347)
Commit migrated from https://github.com/mono/mono/commit/
384db9e89053822a2d51cc19d7084ce75a636b37
Zoltan Varga [Mon, 6 Jan 2020 13:48:50 +0000 (14:48 +0100)]
[netcore] Mark SRE types with required=false so they are only retained when they are actually used.
Commit migrated from https://github.com/mono/mono/commit/
7236dadd32a6d36910051e21478f9281cca64ad8
Jo Shields [Mon, 6 Jan 2020 14:20:46 +0000 (09:20 -0500)]
Don't run `make install` in boehm submodule (mono/mono#17907)
Don't run `make install` in boehm submodule
Commit migrated from https://github.com/mono/mono/commit/
4c9e28b80afb29af526fd698b9922ed0a13531fb
Aleksey Kliger (λgeek) [Fri, 3 Jan 2020 15:42:44 +0000 (10:42 -0500)]
[metadata] Size 0 Blob heap is ok when resolving assembly refs (mono/mono#18313)
* [metadata] Size 0 Blob heap is ok when resolving assembly refs
Sometimes ILasm can produce images with a Blob heap of size 0. In cases where
we're loading assembly references from such an image, the hash (which is
optional) can be at index = 0 and the Blob heap size is also 0.
Also: add the hash value to the output of `monodis --assemblyref`
* [metadata] Add a separate assertion for the index == size == 0 case
And a comment explaining how it is likely to be triggered. If the assembly is
reasonable the caller of mono_metadata_blob_heap should be updated to use
mono_metadata_blob_heap_null_ok instead
* [bcl] Allow Mono's ILASM to produce a size 0 Blob heap
ECMA 335 II.24.2.4 says that the user string and blob heaps should have an
entry at index 0 consisting of the single byte 0. However .NET Framework (and
.NET Core) ilasm will entirely omit the Blob heap (that is, create a blob heap
entry of size 0) if it is not needed. This PR changes Mono's ILASM to emit the
initial byte on demand only if one of the MetaDataStream.Add() methods is
called. Otherwise we will also emit a stream of size 0.
This is needed to compile some test cases.
* [tests] Add regression test for loading assemblies with size 0 Blob heap
Depends on ILASM that can emit a size 0 Blob heap
Commit migrated from https://github.com/mono/mono/commit/
07fee8a91dbc172bacded9d2c7f7d158eb7c50f1
Zoltan Varga [Fri, 3 Jan 2020 08:53:09 +0000 (09:53 +0100)]
[netcore] Add some linker exclusions.
Commit migrated from https://github.com/mono/mono/commit/
22afdb80e1b1921a66cb30c2a885bf0041cf67f1
Marek Safar [Sun, 29 Dec 2019 13:14:31 +0000 (14:14 +0100)]
Cleanup a few dependencies to reduce wasm bcl size
Commit migrated from https://github.com/mono/mono/commit/
c9036e755580c96a984daad55ff8dec11ff46b44
Ryan Lucia [Thu, 2 Jan 2020 20:21:45 +0000 (15:21 -0500)]
[loader] Add assembly name matching on netcore to fix DefaultContext test (mono/mono#18272)
* [loader] Rename assembly name check strictness flag
* [loader] Add predicate for assembly name matching on netcore
* [loader] Enable LoadInDefaultContext test
* Make mono_assembly_names_equal external, change flags in domain search
* Move ifdef inside mono_loader_get_strict_assembly_name_check
* Fix pedump
* No reason to make this external
* Feedback
Commit migrated from https://github.com/mono/mono/commit/
33ca3d33e1994cabf9f9b19034624a3495bbc9cb
Egor Bogatov [Thu, 2 Jan 2020 19:45:40 +0000 (22:45 +0300)]
Add !align 8 to all managed allocators (calls) (mono/mono#18283)
Commit migrated from https://github.com/mono/mono/commit/
458d80002db5fadd8349eac0e9724ceec097d003
Ryan Lucia [Thu, 2 Jan 2020 16:58:15 +0000 (11:58 -0500)]
[reflection] Convert internal GetCustomAttributes calls to Attribute[] (mono/mono#18176)
* [reflection] Avoid creating object[] in GetCustomAttributesBase
* [reflection] Migrate Attribute type checking to CustomAttribute.cs
Commit migrated from https://github.com/mono/mono/commit/
ff6294d2311932902a9e790bbcc79f109a602d0c
Ryan Lucia [Thu, 2 Jan 2020 16:56:50 +0000 (11:56 -0500)]
[eglib] Fix whitespace in memory.c (mono/mono#18320)
Commit migrated from https://github.com/mono/mono/commit/
675f1eb32141fb0904b1499382ccca4b38c1e46a
Thays Grazia [Thu, 2 Jan 2020 14:26:14 +0000 (11:26 -0300)]
The behaviour expected of filter exceptions is: (mono/mono#18309)
-> throw in a async task with a try catch in the caller -> don't stop
-> throw in a new thread with a try catch in the caller -> stop
-> throw in the main thread without any try catch -> stop
Including a new test to test the fix of mono/mono#17601.
Fixing mono/mono#16588, create a while 1 to stops the program execution when an exception is thrown and no try catch is found and MONO_DEBUG=suspend-on-unhandled.
Fixes mono/mono#17601
Fixes mono/mono#16588
Commit migrated from https://github.com/mono/mono/commit/
e20956305e0b9fabade97f31e1712ea920381d3f
Aleksey Kliger (λgeek) [Mon, 30 Dec 2019 14:54:57 +0000 (09:54 -0500)]
[eglib] Don't define _FORTIFY_SOURCE on Cygwin builds (mono/mono#18308)
See https://github.com/msys2/MINGW-packages/issues/5803
Without -lssp (or -fstack-protector), -D_FORTIFY_SOURCE=2 leads to linker
errors.
Commit migrated from https://github.com/mono/mono/commit/
61eb2be2e10c228c5915d90a90b52e7d410c0f25
imhameed [Thu, 26 Dec 2019 19:34:02 +0000 (13:34 -0600)]
Use byte-aligned LLVM loads and stores for unaligned mini IR loads and stores. (mono/mono#18296)
Should fix https://github.com/mono/mono/issues/18221.
Commit migrated from https://github.com/mono/mono/commit/
9719635e5896b1c929cb5310f400b713a8ddfac8
EgorBo [Tue, 24 Dec 2019 23:32:46 +0000 (02:32 +0300)]
Optimize box(T)+GetType
Commit migrated from https://github.com/mono/mono/commit/
28cae98ef060e3c94798cb02cdf0c680f761d6df
Aleksey Kliger (λgeek) [Mon, 23 Dec 2019 15:44:32 +0000 (10:44 -0500)]
[domain] Don't add NULL runtime to runtimes list (mono/mono#18260)
Also when iterating over the runtimes, actually look at the current element,
not the first element.
Also mention the unsupported runtime version in the warning message when it is
passed to mono_init_internal.
Fixes https://github.com/mono/mono/issues/17916
Commit migrated from https://github.com/mono/mono/commit/
ffdffa54f2494cfdf390fabfc76e353fbe59405a
Fan Yang [Mon, 23 Dec 2019 13:38:36 +0000 (08:38 -0500)]
Fix llvm jit assertion (mono/mono#18280)
* Fix assertion when Alignment is greater than 32
Commit migrated from https://github.com/mono/mono/commit/
a1a4bcc49d9d4880f135a17fa3c6ad36b72e5483
Fan Yang [Mon, 23 Dec 2019 13:34:37 +0000 (08:34 -0500)]
Add cast to ((align) - 1) for Alignment macros (mono/mono#18255)
* Add cast to ((align) - 1) for Alignment macros
* Add test for Alignment macro change
Commit migrated from https://github.com/mono/mono/commit/
7ffcaaf59a9826a68233fa9671548c2ca492806a
Ryan Lucia [Fri, 20 Dec 2019 17:37:07 +0000 (12:37 -0500)]
[loader] Check AppContext.BaseDirectory on netcore in preload hook
Commit migrated from https://github.com/mono/mono/commit/
0f8aac3c62db53dc7073c6136664da7f5e184c8b
Ryan Lucia [Fri, 20 Dec 2019 17:21:46 +0000 (12:21 -0500)]
[loader] Remove unnecessary newlines in tracing
Commit migrated from https://github.com/mono/mono/commit/
57b6c8775b97f7a6996b608d2f8db8f808cd6062
Ryan Lucia [Sat, 21 Dec 2019 00:52:53 +0000 (19:52 -0500)]
[netcore] Re-enable some BinaryFormatter tests (mono/mono#18277)
Commit migrated from https://github.com/mono/mono/commit/
5c87445310d2acd5dd35584d123daa8ad20fa317
Aleksey Kliger (λgeek) [Fri, 20 Dec 2019 10:11:26 +0000 (05:11 -0500)]
[tests] Add test files to tarball (mono/mono#18261)
Some test sources weren't included.
Fixes https://github.com/mono/mono/issues/18202
Commit migrated from https://github.com/mono/mono/commit/
d6f3de3c4c8639b5052ffeed483b79193fb76a07
Bernhard Urban-Forster [Thu, 19 Dec 2019 01:05:57 +0000 (02:05 +0100)]
[interp] add guard that a local hasn't been modified for stlocfld fusion (mono/mono#18129)
[interp] add guard that a local hasn't been modified for stlocfld fusion
Fixes https://github.com/mono/mono/issues/18120
Commit migrated from https://github.com/mono/mono/commit/
e7b98d3587fddd51db69baddb370321cca521d60
Nathan Ricci [Wed, 18 Dec 2019 02:35:56 +0000 (21:35 -0500)]
Change ICONST to I8CONST when propagating constants through sign extension. (mono/mono#18222)
Change ICONST to I8CONST when propagating constants through sign extension.
Commit migrated from https://github.com/mono/mono/commit/
ed7432d98844f5638c4e381e2bd0ec5f0787b9dc
Evgenii Stepanov [Tue, 17 Dec 2019 00:18:53 +0000 (16:18 -0800)]
Relax assert in mono_arch_build_imt_trampoline. (mono/mono#18195)
This assert fails when the trampoline code size worst case is realized.
Observed on a Android device with HWASan [1] enabled, where heap
addresses have a non-zero tag in the most significant byte, and thus
require 4 instructions to materialize in emit_imm64.
[1] https://source.android.com/devices/tech/debug/hwasan
Commit migrated from https://github.com/mono/mono/commit/
06673e723ec3d59b071a1b763680f252b71c5de4
Zoltan Varga [Mon, 16 Dec 2019 23:52:02 +0000 (00:52 +0100)]
[llvm] Generate correct LLVM IR for OP_XEQUAL. (mono/mono#18217)
Commit migrated from https://github.com/mono/mono/commit/
aa9227f7c8af76105ded6dbd62c1cf5ae76bc54b
Zoltan Varga [Mon, 16 Dec 2019 23:09:24 +0000 (00:09 +0100)]
[netcore] Add AssemblyLoadContext:OnAssemblyLoad() to linker descriptor. (mono/mono#18219)
Commit migrated from https://github.com/mono/mono/commit/
9f5e38229e2a89baf129c072a21d516d598e510d
Jay Krell [Mon, 16 Dec 2019 22:06:11 +0000 (14:06 -0800)]
Remove handles/MonoError from some marshal icalls. (mono/mono#18036)
Remove handles/MonoError from some marshal icall functions.
This does some small other things.
In particular, if a function is not static for some platforms, make it not static for all.
static historically was valuable, because of default linker semantics around visibility.
I believe it is less important now, since visibility is default constrained.
Also being consistent across platforms seems good.
Maybe split off a separate PR for that.
Commit migrated from https://github.com/mono/mono/commit/
de359d493081350aff7234ef8c3d507b75ef11a5
Ryan Lucia [Mon, 16 Dec 2019 19:17:44 +0000 (14:17 -0500)]
[metadata] Check for GTDs in setup_generic_array_ifaces (mono/mono#18101)
Judging by https://github.com/mono/mono/blob/mono/mono@
4cefdcb7ce2d939ee78fb45d1b4913eb3bc064fd/mono/metadata/metadata.c#L3515 the cached_class is sometimes intentionally a GTD, which can get passed all the way down to setup_generic_array_ifaces and cause a crash.
Commit migrated from https://github.com/mono/mono/commit/
e19914fe6991a93af3f4c0730f1399d7bb5f1f66
Zoltan Varga [Mon, 16 Dec 2019 17:54:54 +0000 (18:54 +0100)]
[wasm] Regen wasm_m2n_invoke.g.h. (mono/mono#18212)
Commit migrated from https://github.com/mono/mono/commit/
ac1a12f9971fc7ba4f8f675af020dc18fd9d35ee
Calvin Buckley [Mon, 16 Dec 2019 10:06:00 +0000 (06:06 -0400)]
Fix locating Python interpreter when it isn't "python" (mono/mono#18197)
Fix locating Python interpreter when it isn't "python"
The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.
This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.
Commit migrated from https://github.com/mono/mono/commit/
84221f04b5ff1f5f6de69100494ae7cb3ba94975
Jay Krell [Fri, 13 Dec 2019 21:49:15 +0000 (13:49 -0800)]
Add full compiler barriers to any fence that lacked a compiler barrier. (mono/mono#18177)
A compiler barrier generates no code.
It "only" inhibits certain compiler optimizations, which I do not consider
particularly worrisome, as most code is "fully" optimized, and
compiler barriers are relatively rare.
It could be a concern in code paths that greatly benefit
from compiler optimizations and for which barriers greatly
inhibits the compiler.
I would further suggest, though it is not here, that any compiler
half barrier (read, write) be a compiler full barrier instead,
as they sound pretty cheap, so simplify.
Similar cannot be said about CPU barriers.
They do not always generate code, but when they do, it can cost.
This is follow-up from https://github.com/mono/mono/pull/17849#issuecomment-
556273801
https://github.com/mono/mono/pull/17849#issuecomment-
557661604.
Commit migrated from https://github.com/mono/mono/commit/
e76fb5dbf92c34a944f6e3d5654a51661acbf6d8
Aleksey Kliger (λgeek) [Fri, 13 Dec 2019 20:32:06 +0000 (15:32 -0500)]
[cominterop] Attach to runtime from IUnknown and IDispatch methods (mono/mono#18175)
* [cominterop][test] Calling QueryInterface from an unattached thread asserts
If we pass a managed COM object to native code and the native code calls one of
the IUnknown methods, we assert because the thread is not attached but we want
to enter GC Unsafe mode.
* [cominterop] Attach to runtime from IUnkown and IDispatch methods
If the COM objects for a managed object is passed to a thread that hasn't
interacted with Mono before, we need to attach before doing GC thread state
transitions.
Addresses https://github.com/mono/mono/issues/18137
* [test] Call managed method through COM wrapper from unattached thread
This works, but I don't think we had a test previously. Call a managed method
via a COM interface from a thread that is not attached to the runtime, to
ensure that it is attached.
Commit migrated from https://github.com/mono/mono/commit/
d0f27ce4feb07bdcf7958272e6e943eb2a2f0f7b
Ankit Jain [Fri, 13 Dec 2019 19:06:16 +0000 (14:06 -0500)]
Bump msbuild to track xplat-master (mono/mono#18183)
- bump roslyn to 3.5.0-beta1-19606-04, to match msbuild
- bump nuget.exe to 5.5.0.6319 (5.5.0-preview1), to match msbuild
Commit migrated from https://github.com/mono/mono/commit/
ea50ca48ba6194daab46f45346567a733b602585
Jay Krell [Fri, 13 Dec 2019 18:57:33 +0000 (10:57 -0800)]
Fix on-demand initialization race conditions [threads.c]. (mono/mono#18166)
Commit migrated from https://github.com/mono/mono/commit/
13100439539433458675fabc37dda7e2feca55aa
Jay Krell [Fri, 13 Dec 2019 18:57:17 +0000 (10:57 -0800)]
Fix on-demand initialization race conditions [marshal.c]. (mono/mono#18169)
* Fix on-demand initialization race conditions [marshal.c].
* PR feedback: fix incorrect merge
Commit migrated from https://github.com/mono/mono/commit/
2eca6a1e37b7a802630bf77ba592321dddf82c72
Ryan Lucia [Fri, 13 Dec 2019 16:36:08 +0000 (11:36 -0500)]
[netcore] Implement AppDomain.AssemblyLoad (mono/mono#18143)
Commit migrated from https://github.com/mono/mono/commit/
7bc25cef6d4ec4b5bb443cc7e20259c4fea1e354
Jay Krell [Fri, 13 Dec 2019 16:29:30 +0000 (08:29 -0800)]
Fix on-demand initialization race conditions [marshal-ilgen.c] (mono/mono#18160)
* Fix on-demand initialization race conditions [marshal-ilgen.c]
* PR: Feedback more MONO_STATIC_POINTER_INIT instead of manual mono_atomic_store_seq.
* PR feedback: Narrow scope of from_oadate.
* One more MONO_STATIC_POINTER_INIT vs. mono_atomic_store_seq post-review.
* Repair whitespace.
* Alternate formating.
Commit migrated from https://github.com/mono/mono/commit/
b637c1db670c0d7355ae4f43f2e4ea1d0b162434
Jay Krell [Fri, 13 Dec 2019 11:28:34 +0000 (03:28 -0800)]
Fix on-demand initialize race conditions [cominterop.c] (mono/mono#18158)
Commit migrated from https://github.com/mono/mono/commit/
57c6b81b969d099953f77365dd566b9405f16887
Jay Krell [Fri, 13 Dec 2019 11:27:39 +0000 (03:27 -0800)]
Fix on-demand initialize race conditions [custom-attrs.c] (mono/mono#18159)
Commit migrated from https://github.com/mono/mono/commit/
64ad6460664615586883ac9ea5eb2ec478e85f18
Jay Krell [Fri, 13 Dec 2019 08:25:56 +0000 (00:25 -0800)]
Fix on-demand initialization race conditions [object.c]. (mono/mono#18163)
Fix on-demand initialization race conditions [object.c].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
0dc19600d120a5ea2731bbdbb82b067e87de65e7
Jay Krell [Fri, 13 Dec 2019 03:55:58 +0000 (19:55 -0800)]
Fix on-demand initialization race conditions [sgen]. (mono/mono#18170)
Fix on-demand initialization race conditions [sgen].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
9cefdf59adc59b085ff8cf187fabb17aa9a40737
Jay Krell [Fri, 13 Dec 2019 00:46:07 +0000 (16:46 -0800)]
Fix on-demand initialization race conditions [remoting.c]. (mono/mono#18168)
Fix on-demand initialization race conditions [remoting.c].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
a93e4712ecdc3f35306c53377dbb5d22a80ae201
Jay Krell [Fri, 13 Dec 2019 00:26:07 +0000 (16:26 -0800)]
Fix on-demand initialization race conditions [native-library.c]. (mono/mono#18162)
Fix on-demand initialization race conditions [native-library.c].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
943a2760ec6fafadd73cc59e1f4f40d5959842d7
Jay Krell [Thu, 12 Dec 2019 23:45:36 +0000 (15:45 -0800)]
Fix on-demand initialization race conditions [reflection.c]. (mono/mono#18167)
Fix on-demand initialization race conditions [reflection.c].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
1fe3d7eda6e7eaacd3b742823c97b04a13c37720
Jay Krell [Thu, 12 Dec 2019 23:36:19 +0000 (15:36 -0800)]
Fix on-demand initialization race conditions [mini] (mono/mono#18161)
Fix on-demand initialization race conditions [mini].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
51bc81919fea20c0a253d9c7f5d67ce4972bfeee
Jay Krell [Thu, 12 Dec 2019 22:55:33 +0000 (14:55 -0800)]
Fix on-demand initialization race conditions [sre.c]. (mono/mono#18164)
Fix on-demand initialization race conditions [sre.c].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
620d7cf84d026417c0390bcef0b50acda6e0f40d
Jay Krell [Thu, 12 Dec 2019 22:46:06 +0000 (14:46 -0800)]
Fix on-demand initialization race conditions [threadpool.c]. (mono/mono#18165)
Fix on-demand initialization race conditions [threadpool.c].
Extracted from https://github.com/mono/mono/pull/18150 which reviewer said was too big.
Commit migrated from https://github.com/mono/mono/commit/
f96ba075a1f1712c1c34e126870f9df89852ce3c
Ryan Lucia [Thu, 12 Dec 2019 20:00:28 +0000 (15:00 -0500)]
[netcore] Implement AppDomain.TypeResolve (mono/mono#18141)
Commit migrated from https://github.com/mono/mono/commit/
88dde8b7634094bd24c9f32ac894912e4d073b9f
Jay Krell [Thu, 12 Dec 2019 18:32:14 +0000 (10:32 -0800)]
Remove handles/MonoError from 12 easy socket icalls. (mono/mono#18035)
Also put _icall back on ends so the search coincides between managed and native.
Commit migrated from https://github.com/mono/mono/commit/
a1e16d32734eadfc9beddf77e522e80cf5276a43