Bernhard Urban [Tue, 27 Aug 2019 12:47:54 +0000 (08:47 -0400)]
[arm] use opcode emulation for fconv/rconv
Commit migrated from https://github.com/mono/mono/commit/
5b20322a84bac20433103ac06a59e654cf581485
Bernhard Urban [Tue, 27 Aug 2019 12:46:06 +0000 (08:46 -0400)]
[arm] account only 4 bytes on stack for single precision arguments
Fixes `test_0_arm64_small_stack_args` in gshared.cs when
* `test_0_arm64_small_stack_args` is compiled with LLVM
* `Foo3.Floats` is compiled with Mini
Commit migrated from https://github.com/mono/mono/commit/
ba824cb9213670069b85ab397a7163a50e911ff6
Bernhard Urban [Mon, 26 Aug 2019 20:00:06 +0000 (16:00 -0400)]
[arm64] use opcode emulation for fconv/rconv
LLVM eagerly optimizes constants such as NaN in a way that does not align with .NET behaviour. In the future we can change it so that we only do opcode emulation when LLVM is used.
Fixes https://github.com/mono/mono/issues/16411
Commit migrated from https://github.com/mono/mono/commit/
475defca4d4d24dc44c660244b645df5f33e20ac
Jay Krell [Mon, 26 Aug 2019 06:05:18 +0000 (23:05 -0700)]
Cleanup arm64 SeqPointInfo.
Commit migrated from https://github.com/mono/mono/commit/
645c01066c08adef6d302a25d1ed9db6047e3042
Jay Krell [Tue, 27 Aug 2019 21:39:18 +0000 (14:39 -0700)]
Inline mono_string_length_internal and mono_string_chars_internal (mono/mono#16374)
* Inline mono_string_length_internal and mono_string_chars_internal for everyone.
* Add MONO_REQ_GC_UNSAFE_MODE.
Commit migrated from https://github.com/mono/mono/commit/
f516e79dd981e174ebf04fe81b76cdbec25f6b20
Filip Navara [Tue, 27 Aug 2019 20:55:37 +0000 (22:55 +0200)]
Update version information in System.Private.CoreLib to mimic CoreCLR and make BenchmarkDotNet happy (mono/mono#16515)
BenchmarkDotNet recently updated the algorithms for .NET version detection (https://github.com/dotnet/BenchmarkDotNet/pull/1230) which made it incompatible with the version presented by Mono.
This updates the value of [ProductName](https://github.com/dotnet/coreclr/blob/mono/mono@
1f428dbc5554191dadd27511cd5cd181e4a60efb/Directory.Build.targets#L7) and [Version](https://github.com/dotnet/coreclr/blob/mono/mono@
c9007e73286456434ba12744e778e87a89fc1d90/eng/Versions.props#L5) to match what CoreCLR is currently reporting and makes the [BDN detection code](https://github.com/dotnet/BenchmarkDotNet/blob/mono/mono@
b6d0e0f1d80ed60aa157149a0dfb704a2da4ca41/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs#L73-L81) happy.
Commit migrated from https://github.com/mono/mono/commit/
f4145ce10815b2f4a1d585dbdf462aa17015aed1
Ryan Lucia [Tue, 27 Aug 2019 20:53:37 +0000 (16:53 -0400)]
[netcore] Change exception thrown for SetTypedReference (mono/mono#16518)
This brings us in line with CoreCLR behavior.
Commit migrated from https://github.com/mono/mono/commit/
f9f5fff40c2012dc9631b7128d72c945620ce4fb
Zoltan Varga [Tue, 27 Aug 2019 20:30:16 +0000 (16:30 -0400)]
Fix the netcore build. (mono/mono#16519)
Commit migrated from https://github.com/mono/mono/commit/
44d33673a5d390e1f691967eb776c608d60b7a64
Zoltan Varga [Tue, 27 Aug 2019 19:22:30 +0000 (15:22 -0400)]
Merge pull request mono/mono#16487 from vargaz/cattr-data-handles
[runtime] Convert mono_reflection_create_custom_attr_data_args () to use handles.
Commit migrated from https://github.com/mono/mono/commit/
3108d4305174a015484aa0f77226e98ea13cb948
Egor Bogatov [Tue, 27 Aug 2019 17:21:51 +0000 (20:21 +0300)]
use gunichar2
Commit migrated from https://github.com/mono/mono/commit/
e9dff75d2fb049f11fdcf595b68de1f3061bdeb7
Alexander Köplinger [Mon, 26 Aug 2019 23:50:15 +0000 (01:50 +0200)]
Remove AppContext.cs that was moved to shared
Commit migrated from https://github.com/mono/mono/commit/
f914d900f6fc639b25eca68432133fedd4f6297b
Vlad Brezae [Tue, 27 Aug 2019 17:27:22 +0000 (20:27 +0300)]
[interp] Remove unnecessary recomputation (mono/mono#16509)
Seems to have been added by mistake in https://github.com/mono/mono/pull/16317, which was meant just to remove the locals variable from InterpFrame.
Commit migrated from https://github.com/mono/mono/commit/
ccc4bf853618649602691c6a10af59f80cd18466
Jay Krell [Tue, 27 Aug 2019 13:31:10 +0000 (06:31 -0700)]
[interp] Error handling refactor (optimize non-exception path) (helps clang save stack) (mono/mono#16371)
While working on stack reduction, I believe I found that
the compiler could not tell how THROW_EX and/or NULL_CHECK terminate.
That is, essentially, the success paths preserve volatile registers.
They do not have to be spilled/filled.
This tweak should make it clearer to the compiler, optimized common paths, and not slow down uncommon paths.
This also cleans it up a little and reduces macro expansion, and then possibly should allow for reinlining what is now used only once.
Also add some const so it can be casted away less.
Believed to save 32 bytes of stack with Linux/amd64/clang, nothing for gcc.
And a nice cleanup.
Commit migrated from https://github.com/mono/mono/commit/
00c1ec421a3d47931bd9ad719faec62e60277837
Zoltan Varga [Tue, 27 Aug 2019 10:51:03 +0000 (06:51 -0400)]
Merge pull request mono/mono#16493 from EgorBo/impl-lzcnt
Implement System.Runtime.Intrinsics.X86.Lzcnt
Commit migrated from https://github.com/mono/mono/commit/
fa1288794b5a38fa717d0f8db459386c3d4b3ad3
Johan Lorensson [Tue, 27 Aug 2019 10:14:12 +0000 (12:14 +0200)]
Fix multiple SGEN_LOG to correctly scale elapsed time in usec. (mono/mono#16485)
Several SGEN_LOG entries logged usec based on result returend from TV_ELAPSED.
On SGEN's implementation of TV_ELAPSED, the result is not scaled to usec
but returned as 100ns ticks. This was not handled correctly by SGEN_LOG,
but other measures, like profile counters and SGEN binary protocol handles
it correctly.
Fix will adjust the SGEN_LOG calls currently presenting usec to correctly
scale the result. Fix also adds one additional logging measuring total
amount of time spend scanning thread data.
Commit migrated from https://github.com/mono/mono/commit/
70aba13173840818246b470e425a6d2585e7672d
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
Zoltan Varga [Tue, 27 Aug 2019 07:57:44 +0000 (03:57 -0400)]
Add SETUP_ICALL_FUNCTION.
Commit migrated from https://github.com/mono/mono/commit/
c7d785f32996e9faa693f5e297d2ac47ee795acc
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
Zoltan Varga [Mon, 26 Aug 2019 18:17:09 +0000 (14:17 -0400)]
Fix review comments.
Commit migrated from https://github.com/mono/mono/commit/
65a71a2912920768134442e04ea17c4fa7382d22
Egor Bogatov [Mon, 26 Aug 2019 18:08:53 +0000 (21:08 +0300)]
Implement Lzcnt hw intrinsics
Commit migrated from https://github.com/mono/mono/commit/
044d1519bdf40f37ec06128dd383c21157dc3c0e
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
Zoltan Varga [Mon, 26 Aug 2019 15:17:15 +0000 (11:17 -0400)]
[runtime] Convert mono_reflection_create_custom_attr_data_args () to use handles.
Commit migrated from https://github.com/mono/mono/commit/
a908b72037d0fd13f2a86208f35e833b62a96e55
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