Jay Krell [Tue, 27 Aug 2019 09:51:21 +0000 (02:51 -0700)]
[interp] Replace imethod with frame->imethod. (mono/mono#16459)
This conserves stack on Linux/amd64/gcc.
Commit migrated from https://github.com/mono/mono/commit/
bfe1b6182cb4e354f94d00d3206be4b83331db1d
Jay Krell [Tue, 27 Aug 2019 08:40:35 +0000 (01:40 -0700)]
CodeManager cleanup: (mono/mono#16468)
- Chunks do not need flags, only codemanagers do.
- Sort by size to minimize padding for alignment.
- Booleans only need one bit.
- Chunk is not spelled chunck.
- Suggest foo accessors be named foo() and set_foo(), not get_foo() and set_foo().
i.e. the more common "get" is implied.
- Allow free(0) w/o initialization.
Commit migrated from https://github.com/mono/mono/commit/
6cf8b6e73824545709cf6556726e0460bc7e2558
Jay Krell [Tue, 27 Aug 2019 08:36:59 +0000 (01:36 -0700)]
[monodis] Combine adjacent identical cases. (mono/mono#16501)
Commit migrated from https://github.com/mono/mono/commit/
9f9e5f7803b98494ca8773876c81e0cc582d679d
Jay Krell [Tue, 27 Aug 2019 07:46:35 +0000 (00:46 -0700)]
mono_attach_load_agent: Fix leaks, alloc, copy. (mono/mono#15950)
Extracted and slightly modified from https://github.com/mono/mono/pull/15868.
Commit migrated from https://github.com/mono/mono/commit/
7ca15e5a42ad03572e9209abb7e030ad712ee4b5
Jay Krell [Mon, 26 Aug 2019 23:04:46 +0000 (16:04 -0700)]
Add missing const, particularly on functions "like" memcpy. (mono/mono#16477)
But do not change the signatures of external functions.
Commit migrated from https://github.com/mono/mono/commit/
67c97d30b45751b5d87254d07c5343d92008dfb5
Zoltan Varga [Mon, 26 Aug 2019 21:31:50 +0000 (17:31 -0400)]
Merge pull request mono/mono#16451 from vargaz/gc-handle-pin
[runtime] Make the local gc handles pin the object they point to by scanning the handle area conservatively.
Commit migrated from https://github.com/mono/mono/commit/
4f8c0b9b46eb014ba7db36d824b3002c217a6c5b
Aleksey Kliger (λgeek) [Mon, 26 Aug 2019 21:13:45 +0000 (17:13 -0400)]
[threadpool-io] Throw if backend won't be able to register a FD (mono/mono#16396)
The poll+select i/o selector backend can't handle file descriptor ids greater
than FD_SETSIZE. This can happen if too many files are open and we want to
wait on it.
Previously, mono would fail in the i/o selector thread by which point it was
too late to do anything.
With this change we will fail eagerly on the thread that calls IOSelector.Add
by throwing a NotSupportedException.
Addresses https://github.com/mono/mono/issues/15931
Commit migrated from https://github.com/mono/mono/commit/
78edafd6e2d5ce886e2fd2ddc3cf8bbbffeeb860
Egor Bogatov [Mon, 26 Aug 2019 15:35:38 +0000 (18:35 +0300)]
[netcore] Implement missing ThreadPool methods (for metrics) (mono/mono#16076)
* Implement missing ThreadPool methods
* Address feedback
* ifdef for mono_threadpool_worker_get_completed_threads_count
* remove GetPendingUnmanagedWorkItemCount
Commit migrated from https://github.com/mono/mono/commit/
85265d884cf31f8779daba2d639eb795fbc9bd5e
Johan Lorensson [Mon, 26 Aug 2019 14:46:43 +0000 (16:46 +0200)]
Fix special case tramp assert in x86/amd64. (mono/mono#16476)
https://github.com/mono/mono/pull/16408 temporary fixed a tramp issue on
x86 (also exist on amd64). This commit fixes the underlying issue and re-enable
the use of noreturn outside of netcore.
The problem hit by the use of OP_NOT_REACHED on x86/amd64 is due to a specific
case when the address to patch happens to fall at the start of a different
managed method. Since the use of OP_NOT_REACHED can end a method
with the call instruction on x86/amd64 in combination with how patch location
(using the return address from stack) is resolved, the implementation in
mono_arch_patch_callsite didn't take this case into account, reading incorrect
patch data, triggering assert oh x86. So, based on timing we could end up with
the following code:
025715B3 call
02570D98
025715B8 push ebp
since the patch target is
025715B8, but also the start of a completely different
method, method_start == origin_code. The fix is to detect this case on x86/amd64
(done on each arch since the way origin_code is detected is arch specific)
and then use a method_start of NULL, that is already a supported scenario.
Commit migrated from https://github.com/mono/mono/commit/
f9be7a67d33d9bdec342401a8ed84885672e9b67
Alexander Köplinger [Mon, 26 Aug 2019 11:53:40 +0000 (13:53 +0200)]
[utils] Don't use MAP_32BIT on Apple platforms, fixes crash with XCode 11 beta6 (mono/mono#16441)
As of XCode 11 beta6 the MacOSX SDK defines the MAP_32BIT symbol:
```diff
--- /Applications/Xcode11-beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-07-25 17:43:49.
000000000 -0400
+++ /Applications/Xcode11-beta6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/mman.h 2019-08-06 21:03:07.
000000000 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -145,6 +145,10 @@
#define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */
#define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */
+#if !defined(CONFIG_EMBEDDED)
+#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only: Requires entitlement */
+#endif /* !defined(CONFIG_EMBEDDED) */
+
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
```
This causes the mono_valloc() function to try to use the MAP_32BIT flag for mmap().
However as mentioned in the comment for the symbol in mman.h it seems to require a special entitlement
which isn't available/documented anywhere yet.
This in turn causes the mmap call to fail presumably because we're missing that entitlement.
Instead we now skip setting this flag on Apple platforms to make mmap() behave like it did before.
Commit migrated from https://github.com/mono/mono/commit/
2f2771fcfa22ac16a24a6a1ff2554440e5de29ca
Egor Bogatov [Mon, 26 Aug 2019 11:36:04 +0000 (14:36 +0300)]
Optimized LLVM IR (mono/mono#16448)
LLVM JIT: dump IR after optimizations
```csharp
[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(int a, int b, int c) => a * b + a * c;
```
`MONO_VERBOSE_METHOD="Test"` now prints both unoptimized and optimized IR:
```llvm
*** Unoptimized LLVM IR for P:Test ***
; Function Attrs: noinline uwtable
define monocc i32 @"P:Test (int,int,int)"(i32 %arg_a, i32 %arg_b, i32 %arg_c) mono/mono#0 {
BB0:
br label %BB3
BB3: ; preds = %BB0
br label %BB2
BB2: ; preds = %BB3
%t22 = mul i32 %arg_a, %arg_b
%t25 = mul i32 %arg_a, %arg_c
%t27 = add i32 %t22, %t25
br label %BB1
BB1: ; preds = %BB2
ret i32 %t27
}
***
*** Optimized LLVM IR for P:Test ***
; Function Attrs: noinline uwtable
define monocc i32 @"P:Test (int,int,int)"(i32 %arg_a, i32 %arg_b, i32 %arg_c) mono/mono#0 {
BB0:
%t251 = add i32 %arg_b, %arg_c
%t27 = mul i32 %t251, %arg_a
ret i32 %t27
}
***
```
Commit migrated from https://github.com/mono/mono/commit/
6aaec2fe9b0c57dcd03967160d8c67bebcd91fae
Jay Krell [Mon, 26 Aug 2019 08:26:07 +0000 (01:26 -0700)]
[interp] Cleanup stackval_to_data and stackval_to_data_addr. (mono/mono#16458)
No functional change, except for debugging, look up a frame
for the prior value.
Commit migrated from https://github.com/mono/mono/commit/
6671316e35d9753539a0276c2c90c0300403b0ad
Bernhard Urban [Mon, 26 Aug 2019 07:46:12 +0000 (09:46 +0200)]
[android] remove text relocations in AOT/arm32 (mono/mono#16432)
[android] remove text relocations in AOT/arm32
Remove support for "big assemblies" for AOT on Android running on ARM 32bit. This will remove relocations in `.text` which are not allowed in the upcoming Android Q release anymore.
_If_ a customer should run into this problem, the suggested workarounds are:
* Switch to ARM64, or
* Do not use AOT compilation.
Fixes https://github.com/mono/mono/issues/16369
Commit migrated from https://github.com/mono/mono/commit/
b6ca76c48415393f09f09977327c0bcd99f10bf4
Ryan Lucia [Mon, 26 Aug 2019 03:13:39 +0000 (23:13 -0400)]
Detect additional invalid assembly names when parsing (mono/mono#16446)
Commit migrated from https://github.com/mono/mono/commit/
510f3c7d70d576cffc5f32edf8741ed841e6211d
Jay Krell [Sun, 25 Aug 2019 21:52:17 +0000 (14:52 -0700)]
Add MONO_LLVM_INTERNAL to mono_jit_compile_method. (mono/mono#16463)
Commit migrated from https://github.com/mono/mono/commit/
e95ef822a16406c2c75f973f22c6e47d0e4f4e7f
Jay Krell [Sun, 25 Aug 2019 17:11:02 +0000 (10:11 -0700)]
[interp] Outline mono_interp_box_vt. (mono/mono#16454)
Contributes to https://github.com/mono/mono/issues/16172.
Seen to reduce frame from 0xB8 to 0xA8 on Linux/amd64/gcc against master.
Possibly similar elsewhere.
(Possibly 8 added to a rounded 8.)
Add const, add braces, they might help compiler and/or programmer.
Commit migrated from https://github.com/mono/mono/commit/
2224d6b55d286e8ab1f2b222f4171f9667c27ed6
Zoltan Varga [Sat, 24 Aug 2019 15:32:37 +0000 (11:32 -0400)]
[runtime] Make the local gc handles pin the object they point to by scanning
the handle area conservatively.
Commit migrated from https://github.com/mono/mono/commit/
7d43ffda1a29315b20d2ab64d19db9d33e8faa4d
Jay Krell [Sat, 24 Aug 2019 07:56:40 +0000 (00:56 -0700)]
[interp] Outline STRMFLD_VT. (mono/mono#16355)
Without being entirely scientific about it, this case seems
to be one that uses more than typical locals and therefore
be on a sort of critical path to reduce frame size.
I have a change that reduces frame to 0x78 bytes (albeit
not yet working) and to achieve that, in this case I refetched
the locals after function calls.
This achieves similar but perhaps more elegantly.
If we rest at larger frame size then this case might not be
on the critical path.
https://github.com/mono/mono/issues/16172
Commit migrated from https://github.com/mono/mono/commit/
9d1eec6bf88656e8302441d0349dcc467a52b605
Jay Krell [Sat, 24 Aug 2019 07:56:00 +0000 (00:56 -0700)]
[windows gc] Trim one syscall per thread in garbage collection. (mono/mono#16003)
* Skip one syscall per thread in garbage collection.
Specifically do not query for guard pages.
There are better ways:
1. Visual C++ specific, __try / __except, get the guard page exception,
put back the guard page. This is a little slower (exception + two syscalls),
but exceedinly rare. __try itself is cheap on x86, free on the rest.
This was also not allowed on UWP. It will be. And is VirtualProtectFromApp.
2. Record the TEB and get from it the maximum commited page and just use MAX, trivial.
The comments are also not completely clear as to what is going on here, but they were close.
Augment them.
Commit migrated from https://github.com/mono/mono/commit/
99e9d8064272eefdba7c567f44d924ad1ec938ac
Jay Krell [Sat, 24 Aug 2019 07:52:30 +0000 (00:52 -0700)]
Remove dlmalloc from Win32. (mono/mono#15773)
Commit migrated from https://github.com/mono/mono/commit/
ab6a09741d1017800ecc2d1688562f68547d7834
Zoltan Varga [Fri, 23 Aug 2019 22:06:17 +0000 (18:06 -0400)]
Merge pull request mono/mono#16414 from vargaz/llvm-gc-poll-wrapper
[llvm] Add a mono wrapper method for the gc poll cold cconv wrapper so the EH code can unwind through it.
Commit migrated from https://github.com/mono/mono/commit/
ab9c58d76d49c750bf69ee4f6ba89c45c8a1df51
Ryan Lucia [Fri, 23 Aug 2019 19:58:10 +0000 (15:58 -0400)]
Return an empty string for assemblies loaded from stream (mono/mono#16345)
* Return an empty string for assemblies loaded from memory
* Blind attempt to fix wasm
Commit migrated from https://github.com/mono/mono/commit/
83cf007ae3e52a7c83d2a31bbc939aa08df67392
Ryan Lucia [Wed, 21 Aug 2019 22:35:24 +0000 (18:35 -0400)]
[netcore] Use requesting assembly's context for InternalLoad calls
Commit migrated from https://github.com/mono/mono/commit/
7615ba3e45654ce5b22125c818876c10b6e4fbf9
Ryan Lucia [Wed, 21 Aug 2019 20:40:08 +0000 (16:40 -0400)]
[netcore] Random loader cleanup
Commit migrated from https://github.com/mono/mono/commit/
0661bf0424f78f35571c229733d61b406f082e5b
Zoltan Varga [Fri, 23 Aug 2019 12:13:21 +0000 (08:13 -0400)]
Merge pull request mono/mono#16431 from kjpou1/wasm-maindir-cleanup
[wasm] Small cleanup of main wasm directory
Commit migrated from https://github.com/mono/mono/commit/
f0cbb79b7f17d30c6674f600f4fccef8a4f1cc87
Zoltan Varga [Fri, 23 Aug 2019 11:49:20 +0000 (07:49 -0400)]
[jit] Make mono_unwind_frame () ignore registers which are greater than NUM_DWARF_REGS.
These registers can be encountered in the unwind info for functions with a cold
cconv, like xmm0 on amd64. Since they are caller saved, they don't have to
be restored during EH.
Commit migrated from https://github.com/mono/mono/commit/
97d2d976156f5584d913844f2610683978f2a567
Zoltan Varga [Fri, 23 Aug 2019 10:40:09 +0000 (06:40 -0400)]
Merge pull request mono/mono#16429 from vargaz/llvm-jit-module
[llvm] Don't pass a module argument to the code in llvm-jit.cpp, we create a new LLVM module for each method.
Commit migrated from https://github.com/mono/mono/commit/
fdd0d7f027f2f45a8aacd304747a42e4ae7d9739
Zoltan Varga [Fri, 23 Aug 2019 10:28:40 +0000 (06:28 -0400)]
Fix the bitcode build.
Commit migrated from https://github.com/mono/mono/commit/
81f736e7745d7d94c282eb20605e970db74aeef1
Zoltan Varga [Fri, 23 Aug 2019 09:34:52 +0000 (05:34 -0400)]
[llvm] Add a cold wrapper and mono wrapper for gc poll for JITted code as well.
Commit migrated from https://github.com/mono/mono/commit/
4ed1c3335f2ddf88e1e402ad046bcb2d7cebc7d0
Zoltan Varga [Thu, 22 Aug 2019 20:15:22 +0000 (16:15 -0400)]
Fix the build.
Commit migrated from https://github.com/mono/mono/commit/
0d603261a0e27f97c0f8f7874411435010799550
Zoltan Varga [Thu, 22 Aug 2019 17:28:17 +0000 (13:28 -0400)]
[llvm] Add a mono wrapper method for the gc poll cold cconv wrapper so the EH code can unwind through it.
Commit migrated from https://github.com/mono/mono/commit/
f6b189ecab310271f456dea05e2ddd320d72acfc
Zoltan Varga [Fri, 23 Aug 2019 08:41:10 +0000 (04:41 -0400)]
Merge pull request mono/mono#16407 from vargaz/fix-llvm-simd
[llvm] Fix type issues in the llvm IR emitted for SIMD. Fix a warning.
Commit migrated from https://github.com/mono/mono/commit/
8ace3754509cd9875f3a6b28d5f90f5471bffd9a
Zoltan Varga [Fri, 23 Aug 2019 08:40:28 +0000 (04:40 -0400)]
Merge pull request mono/mono#16408 from vargaz/noreturn-methods
[jit] Special case the ThrowHelper methods only on netcore.
Commit migrated from https://github.com/mono/mono/commit/
14a76b03c51af060cd497b1e14e891b548c340d9
Egor Bogatov [Fri, 23 Aug 2019 08:17:31 +0000 (11:17 +0300)]
Merge pull request mono/mono#16412 from EgorBo/fix-ci4
[netcore] Fix CI, ignore failing tests
Commit migrated from https://github.com/mono/mono/commit/
47efe6bab00303974025dd7f41af806df49fe842
Zoltan Varga [Fri, 23 Aug 2019 07:27:41 +0000 (03:27 -0400)]
[llvm] Don't pass a module argument to the code in llvm-jit.cpp, we create a new LLVM module for each method.
Commit migrated from https://github.com/mono/mono/commit/
c357de87ec2b3d4369f6c2405c5baa919d1e1059
Zoltan Varga [Fri, 23 Aug 2019 06:08:12 +0000 (02:08 -0400)]
Merge pull request mono/mono#16379 from EgorBo/improve-dump
Improve MONO_VERBOSE_METHOD
Commit migrated from https://github.com/mono/mono/commit/
c97bfe21679544bdf4ba7f20d459b6cf219e21e8
coypoop [Thu, 22 Aug 2019 22:46:08 +0000 (22:46 +0000)]
If either sched_get_priority_{min,max} failed, don't try to set a priority (mono/mono#15898)
netbsd and linux both require that if SCHED_OTHER is used, a fixed value is used for sched_param ([0 for linux](http://man7.org/linux/man-pages/man7/sched.7.html), -1 for netbsd)
the netbsd case can also be detected by the [POSIX-defined failure](https://pubs.opengroup.org/onlinepubs/
007908799/xsh/sched_get_priority_min.html) return value for sched_get_priority_min, a return value of -1.
Commit migrated from https://github.com/mono/mono/commit/
f626f3e7aa540c9d7fb267d3beb4ec4cb32fac8d
EgorBo [Thu, 22 Aug 2019 22:12:47 +0000 (01:12 +0300)]
ignore FSW test
Commit migrated from https://github.com/mono/mono/commit/
71dce6502a5b75e74ef765e2d2b9e674680e9a80
EgorBo [Thu, 22 Aug 2019 20:08:44 +0000 (23:08 +0300)]
ignore more tests
Commit migrated from https://github.com/mono/mono/commit/
692f70cb677a127499abf930035982386f391026
EgorBo [Thu, 22 Aug 2019 18:47:45 +0000 (21:47 +0300)]
Disable the whole System.ComponentModel.Composition namespace
Commit migrated from https://github.com/mono/mono/commit/
40cf68aa98078d5dd6c62ec21db5e0e9366a6b1c
EgorBo [Thu, 22 Aug 2019 17:53:14 +0000 (20:53 +0300)]
fix macOS
Commit migrated from https://github.com/mono/mono/commit/
7678654781869c0507f6dd07c9756a9ab666f991
Steve Pfister [Thu, 22 Aug 2019 16:22:22 +0000 (12:22 -0400)]
Added a workaround for an issue with the compiler server on 32-bit linux. (mono/mono#16405)
Currently, if the process is 32-bit, roslyn tries to determine how much
memory is available. To do that, it tries to pinvoke into GlobalMemoryStatusEx,
which is not supported on mono.
Without it, the compiler server bombs on https://github.com/dotnet/roslyn/blob/mono/mono@
0e63260c5afb3fb5b74c357dd250e500172bcd63/src/Compilers/Server/VBCSCompiler/NamedPipeClientConnection.cs#L55-L59
Commit migrated from https://github.com/mono/mono/commit/
fbdad781018886353f8a02a23eee9957a092bbf3
EgorBo [Thu, 22 Aug 2019 16:02:53 +0000 (19:02 +0300)]
update rsp
Commit migrated from https://github.com/mono/mono/commit/
779fda51037cc4540e844b9760538d2bafae04e4
EgorBo [Thu, 22 Aug 2019 15:52:52 +0000 (18:52 +0300)]
ignore some tests
Commit migrated from https://github.com/mono/mono/commit/
f809fe55a88438009390a25e871d1952780dc02e
Zoltan Varga [Thu, 22 Aug 2019 14:36:43 +0000 (10:36 -0400)]
[jit] Special case the ThrowHelper methods only on netcore.
Commit migrated from https://github.com/mono/mono/commit/
49f913ac8afda7f7b2321c6b4755557e56e57ef3
Zoltan Varga [Thu, 22 Aug 2019 14:28:47 +0000 (10:28 -0400)]
[llvm] Fix type issues in the llvm IR emitted for SIMD. Fix a warning.
Commit migrated from https://github.com/mono/mono/commit/
f2f58e522b8d8702814d8b6943343d68029d0a1e
Aleksey Kliger (λgeek) [Thu, 22 Aug 2019 14:10:09 +0000 (10:10 -0400)]
[android] mono_dl_open_file: use g_file_test only on absolute paths (mono/mono#16387)
The intention of calling `g_file_test (file, G_FILE_TEST_EXISTS)` where file is
the name of a shared library we want to open is to speed up probing for
non-existent libraries.
See https://github.com/mono/mono/pull/12074
The problem is that if file is just a simple "libdl.so" then `dlopen (file)`
doesn't just look for it in the current working directory, it will probe some
other paths too. (For example on desktop linux you'd also look in all the
directories in LD_LIBRARY_PATH). So the g_file_test() call is not a robust way
to avoid calling dlopen if the filename is relative.
But it actually broke more things: https://github.com/xamarin/xamarin-android/issues/3388
When probing for "libdl.so" on Android mono_lookup_pinvoke_call will first try
prepending some paths that it knows about and we end up calling
`dlopen ("/system/lib/libdl.so")` which will fail because Bionic has security
restrictions on what code can dlopen something from /system/lib with an
absolute path. Eventually mono_lookup_pinvoke_call will go back to trying the
bare "libdl.so" which hits `g_file_test` and returns NULL.
The new code only does the file test if we pass it an absolute path, which
gives Bionic's dlopen a chance to deal with relative paths however it needs to.
Commit migrated from https://github.com/mono/mono/commit/
e74736a471f50781db06914f1c048aadabfb52bc
Zoltan Varga [Thu, 22 Aug 2019 13:07:02 +0000 (09:07 -0400)]
Merge pull request mono/mono#16300 from EgorBo/llvm-fpm
Use basic LLVM optimizations (PassManager) in JIT mode
Commit migrated from https://github.com/mono/mono/commit/
f6b0c9b7723a2e992e1728ab4782d8331048eef7
Jay Krell [Thu, 22 Aug 2019 12:57:39 +0000 (05:57 -0700)]
[interp] Replace endsp with preexisting child_frame.retval which appears equivalent. (mono/mono#16378)
This should conserve stack. I didn't verify it.
child_frame being address-taken, compiler would struggle to remove it.
So we have the same value in two places.
https://github.com/mono/mono/issues/16172
Commit migrated from https://github.com/mono/mono/commit/
5368fef5ee6859c3bc81f6c6c2cbb7635d9f4778
Zoltan Varga [Thu, 22 Aug 2019 12:43:07 +0000 (08:43 -0400)]
Merge pull request mono/mono#16390 from EgorBo/intptr-intrinsic
Make IntPtr.Zero intrinsic
Commit migrated from https://github.com/mono/mono/commit/
87a6364d58a52ffa5f930770b7226caba9e88e5d
Zoltan Varga [Thu, 22 Aug 2019 12:26:10 +0000 (08:26 -0400)]
Merge pull request mono/mono#16386 from vargaz/llvm-inline-limit
[llvm] Use a different inline limit (30) for llvm+aot.
Commit migrated from https://github.com/mono/mono/commit/
341cc0dd833b63f226347ce9e05ff41d9a568ae7
Zoltan Varga [Thu, 22 Aug 2019 11:26:36 +0000 (07:26 -0400)]
Merge pull request mono/mono#16384 from vargaz/fix-16381
[llvm] Fix an assert.
Commit migrated from https://github.com/mono/mono/commit/
3f21a2c8f3cbdfa8a5be6309d099c2f7fcc5d005
Zoltan Varga [Thu, 22 Aug 2019 09:36:17 +0000 (05:36 -0400)]
Merge pull request mono/mono#16389 from vargaz/fix-16380
[aot] Simplify a check to avoid calling into the assembly loading code while loading the aot image for corlib.
Commit migrated from https://github.com/mono/mono/commit/
254d6d37580a70fbb4fa072b0b2b16d2984b3bb5
Zoltan Varga [Thu, 22 Aug 2019 04:34:32 +0000 (00:34 -0400)]
Add comments.
Commit migrated from https://github.com/mono/mono/commit/
b7ca80ed581f3ad232107726b651f6adb407d197
Egor Bogatov [Wed, 21 Aug 2019 22:46:10 +0000 (01:46 +0300)]
Update llvm-jit.cpp
Commit migrated from https://github.com/mono/mono/commit/
279676f43ed0c310fdc2146e3cceb40561ddf04a
Egor Bogatov [Wed, 21 Aug 2019 22:43:56 +0000 (01:43 +0300)]
cleanup
Commit migrated from https://github.com/mono/mono/commit/
d02695ef47ccf628d77cceae13dbb756fbf2ce22
Egor Bogatov [Wed, 21 Aug 2019 21:47:40 +0000 (00:47 +0300)]
Merge remote-tracking branch 'origin/master' into llvm-fpm
Commit migrated from https://github.com/mono/mono/commit/
1822f2faab3e58199ed33560e18ebabad7da06e6
Bernhard Urban [Wed, 21 Aug 2019 21:16:03 +0000 (23:16 +0200)]
[netcore] Use Release configuration for default System.Private.CoreLib build (mono/mono#16391)
It seems the Configuration set inside of the System.Private.CoreLib.csproj is just completely ignored, making it default to "Debug".
Maybe because we're using Microsoft.NET.Sdk ?
Commit migrated from https://github.com/mono/mono/commit/
5c9be2dc2b7bdb75dd3eca910754d04f08cfdd06
Egor Bogatov [Wed, 21 Aug 2019 18:48:14 +0000 (21:48 +0300)]
use EMIT_NEW_PCONST
Commit migrated from https://github.com/mono/mono/commit/
cb34178cd69d0dc8a88657379f796a4811de23ff
Egor Bogatov [Wed, 21 Aug 2019 18:23:19 +0000 (21:23 +0300)]
Make IntPtr.Zero intrinsic
Commit migrated from https://github.com/mono/mono/commit/
d3ecd70eadb4b682358e25934b13a88f2a69694e
Zoltan Varga [Wed, 21 Aug 2019 18:15:25 +0000 (14:15 -0400)]
[aot] Simplify a check to avoid calling into the assembly loading code while loading the aot image for corlib.
Fixes https://github.com/mono/mono/issues/16380.
Commit migrated from https://github.com/mono/mono/commit/
c4de19ef097006408bbc52f489ec860b43cf8c17
Zoltan Varga [Wed, 21 Aug 2019 16:20:50 +0000 (12:20 -0400)]
[llvm] Use a different inline limit (30) for llvm+aot.
Commit migrated from https://github.com/mono/mono/commit/
433b9a7f70231bcdfe4bb2d9ef08a240f92090eb
Zoltan Varga [Wed, 21 Aug 2019 16:03:16 +0000 (12:03 -0400)]
[llvm] Fix an assert.
Fixes https://github.com/mono/mono/issues/16381.
Commit migrated from https://github.com/mono/mono/commit/
0e2da3c2abb0c2797cb24da05e16d76bfc179e8c
EgorBo [Wed, 21 Aug 2019 11:20:57 +0000 (14:20 +0300)]
Merge remote-tracking branch 'origin/master' into llvm-fpm
Commit migrated from https://github.com/mono/mono/commit/
ad713a70ef1f7b7a82f5b7213f889fe1be3895a1
Egor Bogatov [Wed, 21 Aug 2019 11:07:59 +0000 (14:07 +0300)]
Update mini.c
Commit migrated from https://github.com/mono/mono/commit/
50b57fe926b8ddbb0b732bce313767116ebc241e
Egor Bogatov [Wed, 21 Aug 2019 11:07:02 +0000 (14:07 +0300)]
Update mini-llvm.c
Commit migrated from https://github.com/mono/mono/commit/
6bb1e5ffc4caa318ad005d893b676756769cab7b
Egor Bogatov [Wed, 21 Aug 2019 11:04:57 +0000 (14:04 +0300)]
undo change in mini.c
Commit migrated from https://github.com/mono/mono/commit/
e5acc9be7aec1e66b0af20290f28408ad20dd421
Egor Bogatov [Wed, 21 Aug 2019 10:35:40 +0000 (13:35 +0300)]
Improve MONO_VERBOSE_METHOD
Commit migrated from https://github.com/mono/mono/commit/
b0b3743f3643da390c3624f59dd2e1659acf6fb7
Zoltan Varga [Wed, 21 Aug 2019 03:14:44 +0000 (23:14 -0400)]
Merge pull request mono/mono#16363 from vargaz/tp-thread-name
[runtime] Avoid resetting the tp thread name on every call to worker_callback ().
Commit migrated from https://github.com/mono/mono/commit/
977ccf7cb2553d249419d38c1f159bfde923b63b
Zoltan Varga [Wed, 21 Aug 2019 03:11:27 +0000 (23:11 -0400)]
Merge pull request mono/mono#16286 from vargaz/netcore-simd
[netcore] Add a netcore version of simd-intrinsics.c.
Commit migrated from https://github.com/mono/mono/commit/
285f33efe6cd3ead92210ffea244edfc5112e3c2
Alexander Köplinger [Tue, 20 Aug 2019 17:59:27 +0000 (19:59 +0200)]
Fix Windows build
Commit migrated from https://github.com/mono/mono/commit/
38c524cc2ad83001b3b2be28e9c7f25cbc126ca2
Alexander Köplinger [Tue, 20 Aug 2019 17:44:37 +0000 (19:44 +0200)]
[profiler] Rename helper functions to have common prefix
Unfortunately https://github.com/mono/mono/pull/16335 didn't fix the new symbols showing up in the log profiler module.
The reason is that we actually pass `--disable-visibility-hidden` for iOS builds in https://github.com/mono/mono/blob/mono/mono@
0b6d95e8ce7c882e2db9e89fa0dec850c687f65e/sdks/builds/ios.mk#L98.
Rename the helper functions instead to have a common prefix so they can be ignored in xamarin-macios tests.
Commit migrated from https://github.com/mono/mono/commit/
55f2c4d6ad8ace7690668c64378248571871c7eb
Aleksey Kliger [Mon, 19 Aug 2019 16:21:21 +0000 (12:21 -0400)]
[w32socket] Translate some errno codes to WSA_ errors imprecisely.
These aren't a perfect match, but better than falling into the `default` case
where Mono asserts and crashes.
Addresses part of https://github.com/mono/mono/issues/16024
Commit migrated from https://github.com/mono/mono/commit/
ed0063b4d593436c531e851054127a64a133be18
Aleksey Kliger [Mon, 19 Aug 2019 16:25:40 +0000 (12:25 -0400)]
[w32error] Add WSA_INVALID_PARAMETER and WSA_INVALID_HANDLE
Commit migrated from https://github.com/mono/mono/commit/
c38044d74fcdc7bedda20153917bf1ed63f0eedc
Ryan Lucia [Tue, 20 Aug 2019 18:33:39 +0000 (14:33 -0400)]
[netcore] Remove local copy of static alc resolve methods
Commit migrated from https://github.com/mono/mono/commit/
fc5e3fa0394b112ab238e1cf67a755c0f1bc8b00
Ryan Lucia [Tue, 20 Aug 2019 16:55:54 +0000 (12:55 -0400)]
[netcore] Remove unnecessary calls to mono_domain_get (mono/mono#16336)
Should use mono_alc_domain where possible
Commit migrated from https://github.com/mono/mono/commit/
0b6d95e8ce7c882e2db9e89fa0dec850c687f65e
Alexander Köplinger [Tue, 20 Aug 2019 15:59:55 +0000 (17:59 +0200)]
[netcore] Consolidate running tests between AzDO pipeline and Makefile (mono/mono#16348)
* [netcore] Consolidate running tests between AzDO pipeline and Makefile
There was some unnecessary duplication between the two that we can remove.
* Add timeout to test execution
Commit migrated from https://github.com/mono/mono/commit/
5dc4a86d9dde59823224d6dfe1f0e0bcb68e39b4
Zoltan Varga [Tue, 20 Aug 2019 15:32:46 +0000 (11:32 -0400)]
Fix the build.
Commit migrated from https://github.com/mono/mono/commit/
8a413fad719ca9068dfd36f0cb39ca94d6c8de2f
Zoltan Varga [Tue, 20 Aug 2019 15:02:01 +0000 (11:02 -0400)]
[runtime] Avoid resetting the tp thread name on every call to worker_callback ().
Commit migrated from https://github.com/mono/mono/commit/
b5cfeb3b5b350758867513de735ebf1ddf42b57e
Jo Shields [Tue, 20 Aug 2019 14:17:26 +0000 (10:17 -0400)]
Pass -fvisibility=hidden to profiler modules. (mono/mono#16335)
* Pass -fvisibility=hidden to profiler modules.
This appears to not break the profilers:
```
directhex@breakfast:/tmp$ nm -g /tmp/ponyponyponypony/lib/libmono-profiler-log.so | grep close_socket_fd
directhex@breakfast:/tmp$
directhex@breakfast:/tmp$ /tmp/ponyponyponypony/bin/mono --profile=log:report bottle.exe
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 99 bottles of beer on the wall.
[..]
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
Mono log profiler data
Profiler version: 3.0
Data version: 17
Arguments: log:report
Architecture: x86-64
Operating system: linux
Mean timer overhead: 86 nanoseconds
Program startup: Mon Aug 19 14:18:30 2019
Program ID: 17715
Server listening on: 41539
JIT summary
Compiled methods: 753
Generated code size: 228046
JIT helpers: 0
JIT helpers code size: 0
GC summary
GC resizes: 0
Max heap size: 0
Object moves: 0
Metadata summary
Loaded images: 3
Loaded assemblies: 3
Exception summary
Throws: 0
Executed finally clauses: 3
Thread summary
Thread: 0x7fcd968c9700, name: "Finalizer"
Thread: 0x7fcd966c8700, name: "Profiler Sampler"
Thread: 0x7fcd9b036780, name: "Main"
Thread: 0x7fcd964c7700, name: "Profiler Helper"
Thread: 0x7fcd954c5700, name: "Profiler Dumper"
Thread: 0x7fcd95cc6700, name: "Profiler Writer"
Domain summary
Domain: (nil), friendly name: "bottle.exe"
Context summary
Context: (nil), domain: (nil)
Counters:
Mono System:
User Time : 70.000ms
System Time : 0.000ms
Total Time : 140.000ms
Working Set :
22032384
Private Bytes :
63455232
Virtual Bytes :
449630208
Page Faults : 3004
CPU Load Average - 1min : 1.870000
CPU Load Average - 5min : 2.670000
CPU Load Average - 15min : 2.900000
Mono JIT:
Methods from AOT : 536
Methods JITted using mono JIT : 154
Methods JITted using LLVM : 0
```
* Add missing annotations and includes
Commit migrated from https://github.com/mono/mono/commit/
3070ab6a96c98c2f31116db691d789ac8ec970e7
Jay Krell [Tue, 20 Aug 2019 13:53:25 +0000 (06:53 -0700)]
[interp] Outline box_nullable. (mono/mono#16356)
Without being entirely scientific about it, this case seems
to be one that uses more than typical locals and therefore
be on a sort of critical path to reduce frame size.
I have a change that reduces frame to 0x78 bytes (albeit
not yet working) and to achieve that, in this case I refetched
the locals after function calls.
This achieves similar but perhaps more elegantly.
If we rest at larger frame size then this case might not be on the critical path.
https://github.com/mono/mono/issues/16172.
Commit migrated from https://github.com/mono/mono/commit/
169205813b7d8f75a435edc092c8aa6678754711
Jay Krell [Tue, 20 Aug 2019 11:03:12 +0000 (04:03 -0700)]
[interp] Reduce register/stack pressure esp. around vtable initialization. (mono/mono#16349)
Part of mono/mono#16172 though not necessarily any gain from this change, at this time.
Commit migrated from https://github.com/mono/mono/commit/
ea29349f77df3a4eb553300c1b694afe656cd56a
Alexander Köplinger [Tue, 20 Aug 2019 10:04:30 +0000 (12:04 +0200)]
[interp] Reduce register/stack pressure slightly, i.e. so that `field` does not have (mono/mono#16339)
to be preserved across `mono_get_special_static_data ()` if non-volatile registers
are all otherwise allocated.
Commit migrated from https://github.com/mono/mono/commit/
b205f1bd9cb9b6c19b90aab1de6d20c45be3bb4f
Jay Krell [Tue, 20 Aug 2019 10:03:48 +0000 (03:03 -0700)]
[interp] Relieve register/stack pressure around mono_thread_internal_current. (mono/mono#16341)
Part of mono/mono#16172 though not necessarily any gain from this change, at this time.
We might want to expose ifdef and inline mono_thread_internal_current also or instead.
Commit migrated from https://github.com/mono/mono/commit/
33153ddd2d02b55a13d11d670b8742c15264fadf
Jay Krell [Tue, 20 Aug 2019 09:47:38 +0000 (02:47 -0700)]
Fix warnings. (mono/mono#16287)
debug-mono-ppdb.c ppdb_compressed_size may be used uninitialized
ppdb_size may be used uninitialized
image.c iinfo set but not used
icall.c klass set but not used
Commit migrated from https://github.com/mono/mono/commit/
bc2accfc7edae72d24390b1c72534ff8bdcdcde6
Alexander Köplinger [Mon, 19 Aug 2019 21:52:01 +0000 (23:52 +0200)]
[netcore] Use Release configuration for CI builds (mono/mono#16329)
* [netcore] Use Release configuration for CI builds
Fixes https://github.com/mono/mono/issues/16308
* [ci] Ensure the artifacts/logs/Release folder exists
Some arcade steps need the path to exist and we only create artifacts/logs/Debug right now,
because that folder is created by eng/common/tools.sh used by init-tools.sh defaulting to Debug.
Commit migrated from https://github.com/mono/mono/commit/
9a5ae23f7e3d49b0b32ae423513d2344a837d698
Jay Krell [Mon, 19 Aug 2019 21:48:20 +0000 (14:48 -0700)]
[interp] Inline MINT_NEWOBJ_VTST_FAST (mono/mono#16314)
For purposes of stack savings, only MINT_NEWOBJ_VT_FAST w/o the "ST"
needed to be outlined, and inlining also the ST form increased
its stack use, w/o savings elsewhere.
That is, the recursive cases should generally not be outlined.
We were outlining two. We still outline one.
This is partially undoing my recent change, where I outlined both of these, but only one was justified.
Commit migrated from https://github.com/mono/mono/commit/
31aed632bab5f0cdd379640296ebcf4c14482461
Jay Krell [Mon, 19 Aug 2019 19:59:36 +0000 (12:59 -0700)]
[interp] Reduce register/stack pressure slightly, i.e. so that `field` does not have
to be preserved across `mono_get_special_static_data ()` if non-volatile registers
are all otherwise allocated.
Commit migrated from https://github.com/mono/mono/commit/
2313f1a88402784d6930ac3c73c990548a3ff1f1
Ryan Lucia [Mon, 19 Aug 2019 18:50:15 +0000 (14:50 -0400)]
[netcore] Update ALC test exclusions (mono/mono#16332)
Commit migrated from https://github.com/mono/mono/commit/
7c3dfbcbdf46d057ae4f145a8ddfc8e193d90ef5
Aleksey Kliger (λgeek) [Mon, 19 Aug 2019 15:01:09 +0000 (11:01 -0400)]
[coop] Add a handle frame in construct_culture (mono/mono#16299)
Otherwise we see warnings like these:
```
ves_icall_System_Globalization_CultureInfo_internal_get_cultures_raw USED 680 handles
```
Commit migrated from https://github.com/mono/mono/commit/
2f0cbb5aa5801144aa887a164f4c95ef146686a8
Vincent Povirk [Mon, 19 Aug 2019 11:09:14 +0000 (06:09 -0500)]
eglib: Remove broken executable test on Windows. (mono/mono#16295)
The strcmp is wrong, and it doesn't test anything meaningful anyway.
This flag is unused since mono/mono#16156 was merged.
Commit migrated from https://github.com/mono/mono/commit/
9f790cd5e2c2b5b998ce9ccdf5c4d67d8ad31507
Jay Krell [Mon, 19 Aug 2019 09:50:20 +0000 (02:50 -0700)]
[interp] Remove InterpFrame.locals, replace with reasonably efficient frame_locals macro.o (mono/mono#16317)
Contributes to mono/mono#16172.
Commit migrated from https://github.com/mono/mono/commit/
8886f71b2cb957cdf3f967d8251ec9a6102e358f
Alexander Köplinger [Mon, 19 Aug 2019 09:24:44 +0000 (11:24 +0200)]
[interp] Put finally data back in locals instead of frame to save 16 bytes of stack. (mono/mono#16307)
* Put finally data back in locals instead of frame to save 16 bytes of stack.
Partial undo of mono/mono@
f8fd60b5c088753a4a0ccb79483ebae73489e7a2.
* Add comments explaining goto main_loop vs. MINT_IN_DISPATCH.
Commit migrated from https://github.com/mono/mono/commit/
e754bb1c430d5ae65056c01fd5ef1f370ff2150a
Jay Krell [Mon, 19 Aug 2019 09:24:11 +0000 (02:24 -0700)]
[interp] Outline ves_array_element_address to save 16 bytes of stack on Linux/amd64/clang. (mono/mono#16304)
Contributes to mono/mono#16172.
Commit migrated from https://github.com/mono/mono/commit/
60cd1b35565e8a4553cc1d70de204ecb96ed54fa
Alexander Köplinger [Mon, 19 Aug 2019 09:23:23 +0000 (11:23 +0200)]
thread names: coop, constants, usually ignore-error. (mono/mono#16272)
- Convert setting thread name to be coop-compatible.
- For constant thread names, just retain the constant, not a copy.
This includes producing and using constant unicode thread names on Windows.
- Make setting a thread name often non-fatal, except where mandated by public API.
- From earlier PR: mono_free (mono-publib.c) would no longer be referenced and therefore
no longer exported. That broke profilers and maybe other externals.
Choices:
1 Use it instead of g_free randomly sometimes.
2 Call it randomly sometimes.
3 include it in external-only.c or object.c
4 Mark it external only (breaks profiler).
5 Use a .def file or Unix equivalent.
5 is best, 2 is done here, the advantages/disadvantages
among most choices are subtle. 3 is probably better than 2
but is slightly bigger change, to put off -- you'd stop
compiling mono-publib.c and move it to include/extra_redist.
The advantage of not-.def file is perhaps that it is exposed
by the compiler, so maybe easy to port and work with.
People are more comfortable with obscure C extensions than
any linker options, and there are multiple linkers to contend
with. Arguably there are fewer compilers.
Commit migrated from https://github.com/mono/mono/commit/
9001c4fa83aa2327038627e9f003ce9432a8e8d5
Jay Krell [Mon, 19 Aug 2019 09:20:37 +0000 (02:20 -0700)]
Reduce size of internal MonoErrors by 3 pointers, while trying to be compatible with old size.(mono/mono#16218)
There is an incompatibility here.
If Mono hands off an InternalError and it is accessed
like an ExternalError, like memset(sizeof()), bad.
Hopefully nobody does that.
There is also compatability -- embedders can continue to embed MonoError
in their own data. Its size and hopefully alignment is unchanged.
Commit migrated from https://github.com/mono/mono/commit/
cf0ce4f55ad92529bf969bef1cbf5cc6a502fdef
Jay Krell [Mon, 19 Aug 2019 09:19:10 +0000 (02:19 -0700)]
[interp] Replace frame.args with frame.stack, the same except for type (mono/mono#16316)
Contributes to mono/mono#16172.
Commit migrated from https://github.com/mono/mono/commit/
047c7d35faa441e9d73364b681e5826a7c00051f
Vlad Brezae [Mon, 19 Aug 2019 08:59:21 +0000 (11:59 +0300)]
[interp] Make sure we allocate stack for MINT_LD_DELEGATE_INVOKE_IMPL (mono/mono#16224)
* [interp] Make sure we allocate stack for MINT_LD_DELEGATE_INVOKE_IMPL
This opcode is pushing a function pointer from the delegate, so it needs to have stack reserved.
* [interp] Fix overflow of stack space
Commit migrated from https://github.com/mono/mono/commit/
975b543e92e296db338ac699c8d87c46f1fbbe42
Jay Krell [Mon, 19 Aug 2019 03:22:06 +0000 (20:22 -0700)]
warning: mono-threads-wasm.c no previous prototype for function mono_background_exec (mono/mono#16289)
Commit migrated from https://github.com/mono/mono/commit/
cecea63691e412e0363de91a9bea594caf1ae2cc
Jay Krell [Sun, 18 Aug 2019 14:36:33 +0000 (07:36 -0700)]
[interp] Reduce register/stack pressure slightly. (mono/mono#16303)
No savings on Linux/amd64/gcc/clang.
Commit migrated from https://github.com/mono/mono/commit/
d1f47e7b48826abd41eaab5c492f41cf4d22ac3f