Jay Krell [Thu, 24 Oct 2019 21:59:11 +0000 (14:59 -0700)]
[cxx] externC for some icalls, for wasm and ios. (mono/mono#17444)
Maybe all JIT icalls?
Commit migrated from https://github.com/mono/mono/commit/
4ef7c566af91722821031f11d704cae2061937e3
Jay Krell [Thu, 24 Oct 2019 21:44:57 +0000 (14:44 -0700)]
Include signal.h unconditionally. (mono/mono#17430)
Some of the includes already were unconditional, including both on Win32 and Unix.
It is part of ANSI C 89, albeit in a reduced form compared to typical Unix (no sigaction).
Remove configuration of MSG_NOSIGNAL which has no other uses.
Preserve configuration of signal.h temporarily due to other uses of ifdef HAVE_SIGNAL_H.
i.e. LLVM?
Commit migrated from https://github.com/mono/mono/commit/
fc390a5f2493ae908ccf2696c4ca675d82104db6
Jay Krell [Thu, 24 Oct 2019 21:37:12 +0000 (14:37 -0700)]
[cxx][x86] int/ptr casts. (mono/mono#17441)
* [cxx][x86] Another int/ptr cast.
* More casts. Notice these are under
`#if defined (MONO_ARCH_USE_SIGACTION) && !defined (MONO_CROSS_COMPILE)`
which would explain them not showing up.
Commit migrated from https://github.com/mono/mono/commit/
ec81a868a104ca0c465023ff5d9f90c0f131f725
dotnet-maestro[bot] [Thu, 24 Oct 2019 19:06:46 +0000 (21:06 +0200)]
[master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx (mono/mono#17458)
* Update dependencies from https://github.com/dotnet/arcade build
20191018.2
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19518.2
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19518.2
* Update dependencies from https://github.com/dotnet/core-setup build
20191021.2
- Microsoft.NETCore.App - 5.0.0-alpha1.19521.2
* Update dependencies from https://github.com/dotnet/corefx build
20191020.7
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19520.7
* Update dependencies from https://github.com/dotnet/arcade build
20191023.3
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19523.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19523.3
* Update dependencies from https://github.com/dotnet/core-setup build
20191023.10
- Microsoft.NETCore.App - 5.0.0-alpha1.19523.10
* Update dependencies from https://github.com/dotnet/corefx build
20191023.8
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19523.8
* Disable a file system watcher test on mac
See https://github.com/mono/mono/issues/17547
* Reenable tests that were fixed
Commit migrated from https://github.com/mono/mono/commit/
a7287bdae54c0539a74fdbe87eb73ba268a95ed6
Bernhard Urban-Forster [Thu, 24 Oct 2019 18:13:27 +0000 (20:13 +0200)]
[interp] fix code length for JitInfo (mono/mono#17538)
* [interp] fix code length for JitInfo
* fix c++ build
Commit migrated from https://github.com/mono/mono/commit/
25b53a642b4756332e5cdb932ed09521da3418df
Marek Safar [Thu, 24 Oct 2019 14:58:20 +0000 (10:58 -0400)]
[netcore] Fix corerun build deps
Commit migrated from https://github.com/mono/mono/commit/
81a4a19f0a3282866cb6459da5f56ff67f26b940
Calvin Buckley [Thu, 24 Oct 2019 16:04:20 +0000 (13:04 -0300)]
Fix eglib on AIX/PASE (mono/mono#17476)
* fix eglib on AIX/PASE
* Work around access(2) syscall bug on PASE
On PASE, X_OK will always returns true. This is contrary to
how AIX behaves (though corresponds to documentation!). This
is probably because it's an upcall to the ILE version of
access, and that seemingly always returns true.
* Always export the dummy function in the test suite
The AIX linker didn't export this properly, without using the
giant sledgehammer of -bexpall. Write an export file and use
it. This required some build system changes to expose an
AIX-only automake conditional.
* Use a file that exists on PASE for tests
PASE doesn't use Unix-style DNS resolution, so /etc/hosts is
missing. Use /etc/magic, since that seems to be present.
* Don't use /bin on AIX/PASE for tests
This is a symlink to /usr/bin, and it seems chdir/getcwd
follows links. Use /usr instead, that is unlikely to be a
symlink.
* Make a note what directory we're in if we fail test_cwd
* Change manual executable access check change per Jay
* Change test on POSIXy platforms to always use root directory
Commit migrated from https://github.com/mono/mono/commit/
638e2c6a8614d25aad591112d3414e28641b97e0
Vlad Brezae [Thu, 24 Oct 2019 15:05:04 +0000 (18:05 +0300)]
[interp] Add super instructions for field storing (mono/mono#17525)
* [interp] Add also floating versions for stloc.np
* [interp] Add super instructions for stfld
When storing into a field of a local or an argument (ldloc/ldarg -> random instructions that end up pushing one value -> stfld). We add this instruction to the cprop pass because the instructions that are optimized together are not consecutive and we need the stack information to be able to access the instruction that loaded the argument / local and to make sure that the local wasn't dirtied. Alternatively we could make the super instruction pass stack aware, which we should probably do if more super instruction candidates turn out to require stack state information.
* [interp] Enable cprop for methods without locals
We do some optimizations here that don't apply to locals.
* [interp] Fix result stack type of CEE_CONV_OVF_I_UN
Commit migrated from https://github.com/mono/mono/commit/
b7ef7363382757c2951a7a84026d5a1baa7f0130
Zoltan Varga [Thu, 24 Oct 2019 10:57:13 +0000 (06:57 -0400)]
[netcore] Add a few more missing SSE intrinsics. (mono/mono#17511)
* [netcore] Add a few more missing SSE intrinsics.
* Disable some intrinsics for non-llvm.
Commit migrated from https://github.com/mono/mono/commit/
951769b2795df22904079d79d8d97d35c44466ba
Johan Lorensson [Thu, 24 Oct 2019 08:57:56 +0000 (10:57 +0200)]
Adjust restart world logging level to match start major/nursery logging. (mono/mono#17520)
With this change we will get the following logging on level 1:
2019-10-22 15:46:59 Start nursery collection 38898
00000205A0000000-
00000205A1000000, size:
16777216
2019-10-22 15:46:59 restarted (pause time: 2728 usec, max: 689233 usec)
showing the pause time and when runtime was restared, before this fix
we will only see the start log message on level 1.
Commit migrated from https://github.com/mono/mono/commit/
fe7654f745c9b8ba030c9c4c1671904c6d9bda53
Filip Navara [Thu, 24 Oct 2019 08:56:25 +0000 (10:56 +0200)]
[netcore] Managed ThreadPool implementation (mono/mono#17387)
* Wire up the managed side of the portable thread pool
* Remove old native thread pool code
* Fix non-netcore build
* Fix Thread.IsThreadPoolThread
* Fix MSVC builds
* Code style fix
* Make the locking primitives uninterruptible
* Revert icall changes for non-netcore
* Implement Thread.ResetThreadPoolThread
* Compile out more thread pool code for netcore
* Remove ThreadPoolBoundHandle, it is shared now
* Address PR feedback on code style
Commit migrated from https://github.com/mono/mono/commit/
7a15b718735eccfac6ecd7467a09279d2f23e16e
Thays Grazia [Wed, 23 Oct 2019 20:56:58 +0000 (17:56 -0300)]
[debugger] Changing how debugger handles exception when hybrid suspend is enabled (mono/mono#17478)
* Removing all fixes to fix mono/mono#15203 and mono/mono#17083, and trying a new approach to fix this mono/mono#17084, together.
The thing is when we are executing on hybrid suspend the caller is executed inside try catch in the runtime_invoke_ method that is generated. And this try catch should be ignored for the debugger exception, otherwise it's the last try catch in main thread, but should always be considered to generate the stack trace.
Fixes mono/mono#17084
* This test check the case that we were missing. On preemptive this test always runs perfectly, on Hybrid, never run well until this PR.
* Changing how call unit test.
Changing variable name.
Commit migrated from https://github.com/mono/mono/commit/
8fda1738f728dec900e7a53b78fefdbbbc9e0924
Jay Krell [Wed, 23 Oct 2019 19:36:35 +0000 (12:36 -0700)]
[cxx] Put extern "C" in MONO_LLVM_INTERNAL. (mono/mono#17443)
Commit migrated from https://github.com/mono/mono/commit/
4d7adf4d2a0c7c31d8081a4c01d2bb16b4029ea7
Johan Lorensson [Wed, 23 Oct 2019 18:58:04 +0000 (20:58 +0200)]
Optimize LOS for better parallelization. (mono/mono#17173)
Scanning LOS list as part of minor GC didn't parallelize well since
all scan jobs needed to walk the complete LOS list. This led to touching
a lot of memory walking the list, increasing minor GC pause times
when the number of items in the LOS list increased. As an example,
stressing LOS data structure using ~600 MB's of random sized byte arrays
caused minor GC pause times between ~20ms without parallelization and ~19ms
with parallelization. NOTE, the more work each job gets (more memory to scan)
we will get a better parallelization, but still a lot of room for improvement.
Changing from a normal linked list to a SgenArrayList makes it more effective
to parallelize the scan jobs and since the list is using sequential
memory, this will also reduce cache misses for each thread iterating LOS
objects. Tagging objects in SgenArrayList with reference information reduce
cache misses dramatically in cases where objects not including references
exists on the list, since scanning jobs can skip these items without any
need to touch object memory causing cache misses.
Same scenario running with fix gives us minor GC pause times, without
parallelization in ~7ms (down from 20~ms) and with parallelization,
< 5ms (down from 19ms). NOTE, the more work each job gets (more memory to scan)
we will get a better result using parallelization, so the delta will increase
between using and not using parallelization, this scenario primarily stress
the extreme case where most LOS objects doesn't have references.
In total, this optimization reduce minor GC pause time 4x, from ~19ms when
using parallelization down to < 5ms.
Commit migrated from https://github.com/mono/mono/commit/
df30c7228c4061573601ea9a71772cc6f00e4b85
Zoltan Varga [Wed, 23 Oct 2019 15:06:18 +0000 (11:06 -0400)]
[wasm] Avoid adding an extra arg to native-to-managed wrappers. (mono/mono#17508)
[wasm] Avoid adding an extra arg to native-to-managed wrappers.
Fixes https://github.com/mono/mono/issues/17389.
<!--
Thank you for your Pull Request!
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
Commit migrated from https://github.com/mono/mono/commit/
31b475e25a4ab5b6d8af731be9bb9e8158da31d9
Jay Krell [Wed, 23 Oct 2019 14:21:54 +0000 (07:21 -0700)]
[coop] Fix big endian problem in MonoThradStateMachine and cleanup. (mono/mono#17502)
Commit migrated from https://github.com/mono/mono/commit/
8b8b8b5010140b56bab3130e1b5b5e296dd86752
Filip Navara [Wed, 23 Oct 2019 09:53:06 +0000 (11:53 +0200)]
[netcore] Add Unsafe.SkipInit intrinsic
Commit migrated from https://github.com/mono/mono/commit/
e29f8e32b77e29ec314c0e509e1d1aef9d286285
Vlad Brezae [Wed, 23 Oct 2019 08:57:07 +0000 (11:57 +0300)]
[interp] Add a new super instructions pass (mono/mono#17489)
Together with a few very simple super instructions. We replace common instruction patterns to avoid indirection via interp stack, instruction dispatch overhead and to allow the compiler to generate better code for the instruction.
Commit migrated from https://github.com/mono/mono/commit/
479d2dff365a688cc0045b3c76aa7aba79d4784e
Vlad Brezae [Wed, 23 Oct 2019 07:39:27 +0000 (10:39 +0300)]
[interp] Retry cprop pass if killing stloc (mono/mono#17491)
When replacing a stloc with a pop, we should retry the pass, since it is very likely that we will be able to kill the instruction that pushed that value on the stack.
Commit migrated from https://github.com/mono/mono/commit/
4419dc919f01c6d97ecd1662929adc6e7e642e83
Jay Krell [Wed, 23 Oct 2019 07:36:15 +0000 (00:36 -0700)]
SetLastError slightly later, in case last error not preserved, and it is just as good. (mono/mono#17483)
SetLastError slightly later, in case last error not preserved, and it is just as good.
Commit migrated from https://github.com/mono/mono/commit/
92c08fab4d417d9c3e62dab7f1bac5a710f28916
Vlad Brezae [Wed, 23 Oct 2019 07:23:49 +0000 (10:23 +0300)]
[interp] Optimize ldelem instructions (mono/mono#17494)
Remove the switch and have each instruction have its own code. Seems to improve speed on a benchmark that heavily uses ldelem by about 10-20%.
Commit migrated from https://github.com/mono/mono/commit/
61594078466fd80a4f80a0c3d670adb8301144b0
Filip Navara [Wed, 23 Oct 2019 04:01:51 +0000 (06:01 +0200)]
[netcore] Disable debugging code in lookup_intrins (mono/mono#17464)
Commit migrated from https://github.com/mono/mono/commit/
1e60703a191297440d25f1f3a103fb515163869b
Aleksey Kliger (λgeek) [Tue, 22 Oct 2019 18:07:44 +0000 (14:07 -0400)]
[reflection] mono_method_get_base_method on a GTD should use canonical ginst (mono/mono#17475)
* [test] GetCustomAttributes on generic type definition
* [reflection] mono_method_get_base_method on a GTD should use canonical ginst
The issue is in how we pass along the generic instantiation. So there are two
parts here: we start with a method on a GTD which has to decompose into the GTD
and it's instantiation with its own generic parameters, and then we go up to
its parent and grandparent inflating and decomposing the resulting
instantiation. The instantiations keep passing the last parameter as the number
of parameters shrinks so that the gparam index from the original type is now
out of bounds for the parent and grandparent. If we mess up, we'll get a
BadImageFormatException from the runtime
Fixes https://github.com/mono/mono/issues/17278
Commit migrated from https://github.com/mono/mono/commit/
fb5b2c949ddd2ab09fcddb458584a5facd9ec94e
Aleksey Kliger (λgeek) [Tue, 22 Oct 2019 16:14:05 +0000 (12:14 -0400)]
[coop] Use bitfields for coop state machine state representation (mono/mono#17298)
* [checked] Mask the thread state in GC thread state assertions
Because we have extra bits (like suspend count and the no_checkpoints bit) on
the thread state, we have to mask it to get the actual thread state enum value
* [coop] Use bitfields to represent coop thread state
Instead of using a 32-bit int, use bitfields and type-punning through a union
type. We need to type pun because we need to access the entire state as a 32-bit int so that we can do atomic CAS.
* use atomic load of thread state in unwrap_thread_state.
Saw one stack trace on CI on the full coop lane where check_thread_state saw STATE_RUNNING
but with a positive suspend count. Another thread was starting a GC a
the time. Seems like we saw the state as runnning, but the suspend
count as if we were already in async_suspend_requested.
Thread 22 (Thread 0x7f43c03ff700 (LWP 39860)):
Commit migrated from https://github.com/mono/mono/commit/
ebb5846e0d743a12a359f4b1dbcea9d18ccfe867
Marek Safar [Tue, 22 Oct 2019 13:49:26 +0000 (09:49 -0400)]
[System.Private.CoreLib] Remove unused methods
Commit migrated from https://github.com/mono/mono/commit/
f34fd20fbf009c9ef174c1fabdbccda47c93b9da
Filip Navara [Tue, 22 Oct 2019 09:54:15 +0000 (11:54 +0200)]
Update Mono for changes in shared CoreLib partition
Commit migrated from https://github.com/mono/mono/commit/
cf1a9e003371495f4fff86c690da0213fff29c85
Zoltan Varga [Tue, 22 Oct 2019 10:31:23 +0000 (06:31 -0400)]
[jit] Avoid running mono_handle_native_crash () on the altstack, it can't produce a backtrace. AMD64 only for now. (mono/mono#17466)
* [jit] Avoid running mono_handle_native_crash () on the altstack, it can't produce a backtrace. AMD64 only for now.
* Fix checks so stack overflows work again.
Commit migrated from https://github.com/mono/mono/commit/
b96260e603fe0188e54019bfde8ca00bc2b5d78c
Vlad Brezae [Mon, 21 Oct 2019 20:42:24 +0000 (23:42 +0300)]
[interp] Replace loading of static readonly fields with LDC (mono/mono#17420)
LDC is faster and also allows for constant propagation. Cleanup code a little bit.
Commit migrated from https://github.com/mono/mono/commit/
c1461e4a2d9c539506b88af786c948ff8a8bad7d
Jay Krell [Fri, 18 Oct 2019 01:17:24 +0000 (18:17 -0700)]
No type_traits on Android.
In file included from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android/mono/metadata/icall.c:42:
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android/mono/metadata/icall-internals.h:89:10: fatal error: 'type_traits' file not found
Commit migrated from https://github.com/mono/mono/commit/
fd82c6036ec3720d568050c1e538f9729cef984e
Jay Krell [Sat, 19 Oct 2019 01:35:42 +0000 (18:35 -0700)]
[cxx][debug-interp] Cast once from void* to non-void*.
Commit migrated from https://github.com/mono/mono/commit/
21d7d41bfe4a8aebed8e73deadd1fb1177360392
Jay Krell [Mon, 21 Oct 2019 08:29:39 +0000 (01:29 -0700)]
[Coop] Unconvert Microsoft.Win32.NativeMethods. (mono/mono#16992)
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_CloseProcess.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess.
* [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle.
Commit migrated from https://github.com/mono/mono/commit/
9f50bdb2d944793d30ea2d052cdad96feb282003
Zoltan Varga [Mon, 21 Oct 2019 03:28:25 +0000 (23:28 -0400)]
[interp] Small fixes. (mono/mono#17442)
* [interp] Really abort in ves_real_abort ().
* [interp] Fix stack usage in TRACE_EXIT.
* [interp] Add a callback to free ThreadContext.
* Fix warnings.
* Remove an empty statement.
* Fix a double free.
Commit migrated from https://github.com/mono/mono/commit/
4b9226619c9caef3d45778380198c70a43e3570c
Filip Navara [Sun, 20 Oct 2019 22:39:39 +0000 (00:39 +0200)]
[netcore] Implement Array.GetElementSize as intrinsic (mono/mono#17437)
* [netcore] Implement Array.GetElementSize as intrinsic
* Remove unnecessary icall
* alloc_preg -> alloc_ireg
* Implement Array.GetElementSize as intrinsic in interpreter
* Address PR feedback
Commit migrated from https://github.com/mono/mono/commit/
32ab6bcf004dee2009ab98f9381842ff3fc6e6f2
Filip Navara [Sat, 19 Oct 2019 09:58:49 +0000 (11:58 +0200)]
[netcore] Remove unused code for Array.Unsafe[Mov/Load/Store] intrinsics
Commit migrated from https://github.com/mono/mono/commit/
67c8d0d812d5045ca084d24ad271233685a6c899
Filip Navara [Sun, 20 Oct 2019 05:26:44 +0000 (07:26 +0200)]
Use correct variable in mini_get_cpu_features (mono/mono#17436)
* Use correct variable in mini_get_cpu_features
* Address PR feedback
Commit migrated from https://github.com/mono/mono/commit/
bc678a2c10b98d8624bc55da1e4409be13a265f4
Filip Navara [Sun, 20 Oct 2019 05:23:05 +0000 (07:23 +0200)]
Remove dead code left out in mono/mono#17341 (mono/mono#17433)
Commit migrated from https://github.com/mono/mono/commit/
91f10aeee4ff70696f19fdda9f3d6b67403bc45d
Jay Krell [Sat, 19 Oct 2019 17:20:56 +0000 (10:20 -0700)]
[jit][x86][cxx] int/ptr casts in mini-x86.c (mono/mono#17380)
Commit migrated from https://github.com/mono/mono/commit/
91413f78f3242aab3d38d0fb609dd748999265fc
Jay Krell [Sat, 19 Oct 2019 11:25:54 +0000 (04:25 -0700)]
Replace ICALL_DECL_EXPORT with ICALL_EXPORT. They are always the same, and it is only used once. (mono/mono#17429)
Replace ICALL_DECL_EXPORT with ICALL_EXPORT. They are always the same and it is only used once.
Commit migrated from https://github.com/mono/mono/commit/
84f4e1dcbf96925105f4d4f54bb9cb9b61067603
Aleksey Kliger (λgeek) [Fri, 18 Oct 2019 23:11:22 +0000 (19:11 -0400)]
[bcl] Add null reference checks to Interlocked.Exchange<T> (mono/mono#17400)
* [bcl] Add null reference checks to Interlocked.Exchange<T>
and Interlocked.CompareExchange<T>
This is to mimic the old behavior in unmanaged when the intrinsic cannot be
used.
The issue was detected via the coreclr acceptance test:
https://github.com/mono/coreclr/blob/mono/tests/src/baseservices/threading/interlocked/exchange/exchangetneg.il
* and netcore
Commit migrated from https://github.com/mono/mono/commit/
d8ae32a9ee7763c861bdc31831271d82aa8a4953
Jay Krell [Fri, 18 Oct 2019 22:03:00 +0000 (15:03 -0700)]
[cxx] [wasm] int/ptr casts esp. m2n-gen. (mono/mono#17379)
Commit migrated from https://github.com/mono/mono/commit/
a2992d634b9cfa6ae8572ba597f009cb05104743
imhameed [Fri, 18 Oct 2019 19:47:41 +0000 (12:47 -0700)]
Merge pull request mono/mono#17279 from imhameed/bug-gh-16935-netcore-equalsall-codegen
Generate LLVM IR for OP_XEQUAL that is recognized by LLVM's vector pattern recognizers.
Commit migrated from https://github.com/mono/mono/commit/
8836231459121e0144ae03169554c1d0636ec5ba
Alex Rønne Petersen [Fri, 18 Oct 2019 18:16:14 +0000 (20:16 +0200)]
Some updates to make RISC-V buildable again. (mono/mono#17408)
Some updates to make RISC-V buildable again.
Also some updates to the toolchain setup documentation.
Commit migrated from https://github.com/mono/mono/commit/
d44e0e80d73d59de204b5db881e3d8c6076b4cac
Vlad Brezae [Fri, 18 Oct 2019 14:31:47 +0000 (17:31 +0300)]
[profiler] Fix coverage profiler on macos (mono/mono#17396)
If we have coverage profiling enabled for a method (mono_profiler_coverage_instrumentation_enabled, with coverage_filter callback), then we should be able to allocate a coverage info structure (mono_profiler_coverage_alloc). After https://github.com/mono/mono/commit/mono/mono@
52429673dc617fd437518757c04c7448211075e9, coverage_filter was reporting wrapper methods as ok to profile, while mono_profiler_coverage_alloc was refusing to allocate the necessary structure, leading to crashes.
Commit migrated from https://github.com/mono/mono/commit/
37f628750af0f81e7550989e83bcfe3d134fb6be
Jay Krell [Fri, 18 Oct 2019 07:39:05 +0000 (00:39 -0700)]
[interp][wasm] Remove more varargs to conserve stack. (mono/mono#17388)
Commit migrated from https://github.com/mono/mono/commit/
958b9b2658f6d866ba451781cfa2180e2b340f35
Egor Bogatov [Thu, 17 Oct 2019 23:01:44 +0000 (02:01 +0300)]
Enable GSS on Linux and Android (mono/mono#17223)
Commit migrated from https://github.com/mono/mono/commit/
4908d1f19a615b033ec148b49c8fab83f1e6f0ec
Vlad Brezae [Thu, 17 Oct 2019 11:23:12 +0000 (14:23 +0300)]
[interp] Constant folding for integers (mono/mono#17362)
* [interp] Move instructions together
For easy check if an instruction is unary or binary operation. We consider conversion instructions to be unary operators and compare instructions to be binary operators.
* [interp] Add stloc.np also for longs
* [interp] Add stats for total number of emitted instructions
Also make the killed_instructions counter actually track the total amount of killed instructions. It was not previously tracking instructions killed as part of addition of stloc.np / movloc.
* [interp] Improve logging during cprop
Make dumping instruction support also InterpInst's not just compacted instructions.
* [interp] Constant folding of common unary operators
* [interp] Constant fold binary operations
* [interp] Remove MINT_CONV_U8_I4 opcode
It is equivalent with MINT_CONV_I8_U4.
Commit migrated from https://github.com/mono/mono/commit/
ec653e70bfaba99e9fd88ceb3ff475eda83cb8f1
Jay Krell [Thu, 17 Oct 2019 10:25:18 +0000 (03:25 -0700)]
[cxx] Int vs. enum, static for efficiency, cleanup, fix typo. (mono/mono#17377)
[cxx] Int vs. enum, static for efficiency, cleanup, fix typo.
Commit migrated from https://github.com/mono/mono/commit/
e8b6fcc9451eded4ba370649bcb41fad405f0b2a
Jay Krell [Thu, 17 Oct 2019 10:24:46 +0000 (03:24 -0700)]
[cxx][x86] int/ptr casts. (mono/mono#17345)
Commit migrated from https://github.com/mono/mono/commit/
e97e1f994d0310b4f988fad343793019cf5e273d
Vlad Brezae [Wed, 16 Oct 2019 20:13:10 +0000 (23:13 +0300)]
[interp] Always intrinsify MemoryBarrier method
As we do it on jit.
Commit migrated from https://github.com/mono/mono/commit/
ae0fbd366e3125d8da99663a492f6116de4214b9
Vlad Brezae [Wed, 16 Oct 2019 20:01:54 +0000 (23:01 +0300)]
[interp] Avoid using full barriers for volatile operations
This commit avoid unnecessary memory barriers on x86 and amd64.
Volatile writes have release semantics, volatile reads have acquire semantics. Organize the code a little bit to indicate this. On x86 and amd64 we don't require barrier for acquire and release semantics since they are provided by the arch, so we can skip them. Ideally we should have 3 memory barrier interp instructions for each type, but, currently, they would all seem to call mono_memory_barrier so it is useless at this point.
Commit migrated from https://github.com/mono/mono/commit/
0102263645b73422d84dbe7fac3bdee65c7447a7
Johan Lorensson [Thu, 17 Oct 2019 06:55:50 +0000 (08:55 +0200)]
Upgrade build scripts to support VS2019. (mono/mono#17269)
Changes will default Windows SDK version as well as Platform Toolset to
the default versions used in the targeted VS version. If the projects are
opened up in VS2015, it should default to Windows SDK 8.1 and v140, but if
the same projects are opened in VS2019, it will default to latest Windows SDK 10
and v142. This way the project files should adapt to used VS version, meaning
that we could still build them using VS2015 (what's currently used on CI) but also
using VS2017 and VS2019. There should not be a need to install any previous versions
of build tools, unless an older version is targeted. It is also possible to set
PlatformToolset when calling msbuild and that should adapt to corresponding default
Windows SDK version for targeted toolset version.
Commit makes many changes and adjustments, aligning all vcxproj files but changes
should not affect build output.
Commit migrated from https://github.com/mono/mono/commit/
4f8a82c9fdebd7e9dcc5392a8b3a0fd129789bc0
Jay Krell [Thu, 17 Oct 2019 04:46:03 +0000 (21:46 -0700)]
Use functions instead of macros for is_in/is_out. (mono/mono#17350)
Use functions instead of macros for is_in/is_out.
Commit migrated from https://github.com/mono/mono/commit/
edafa021d3b8e5b5762a297afa38ae58c21997b1
dotnet-maestro[bot] [Wed, 16 Oct 2019 21:12:15 +0000 (23:12 +0200)]
[master] Update dependencies from dotnet/core-setup dotnet/corefx (mono/mono#17355)
* Update dependencies from https://github.com/dotnet/core-setup build
20191015.17
- Microsoft.NETCore.App - 5.0.0-alpha1.19515.17
* Update dependencies from https://github.com/dotnet/corefx build
20191015.14
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19515.14
* Reenable a test that was fixed
Commit migrated from https://github.com/mono/mono/commit/
1dbad7cd881f1051fe21e72911bd4ce0228cb954
Jay Krell [Wed, 16 Oct 2019 20:26:02 +0000 (13:26 -0700)]
[cxx][x86][amd64] Remove unused STORE_MEM_IMM. (mono/mono#17347)
[cxx][x86][amd64] Remove unused STORE_MEM_IMM.
And there was an int/ptr cast error within.
Commit migrated from https://github.com/mono/mono/commit/
c0d50719eab15fbf7fe8259fd3df065af7eb91f3
Aleksey Kliger (λgeek) [Wed, 16 Oct 2019 19:35:49 +0000 (15:35 -0400)]
[bcl][jit] implement Interlocked.Exchange<T> in terms of object (mono/mono#17341)
* [bcl][jit] implement Interlocked.Exchange<T> in terms of object
Exchange<T> is supposed to be picked up as an intrinsic. But if it isn't,
since T has a class constraint, call the `Exchange (ref object, ref object, ref
object)` overload instead.
This works around a limitation in the JIT:
https://github.com/mono/mono/blob/mono/mono@
82a07273c22b996b08fa88ee2e6632d782ac2242/mono/mini/mini-trampolines.c#L704-L713
if we're in the common call trampoline, and the caller is generic method and
the callee is a generic method, if we're using generic sharing for the caller,
but there's no generic jit info for the callee, we will not patch the call
site.
In this case we had Exchange<T> calling Exchange_T<T>
where the callee is an icall (and evidently didn't have generic jit info).
So every time we called Exchange<T>, we would go through the trampoline when
trying to call Exchange_T<T> without patching the call site.
Addresses part of https://github.com/mono/mono/issues/17334
* Bump Mono
* Also drop CompareExchange_T<T>
* Sprinkle some Unsafe magic.
Mark the non-icall methods that we expect the JIT to treet as intrinsics with [Intrinsic]
* aot-runtime doesn't need Volatile.Read<T>/Write<T> code
Both of those methods are implemented as calls to the object overload of Volatile.Read/Write
Commit migrated from https://github.com/mono/mono/commit/
f017835ac11371038aec3ea66c513c8234d73187
Egor Bogatov [Wed, 16 Oct 2019 19:24:16 +0000 (22:24 +0300)]
remove GenericVectorTests from rsp (mono/mono#17366)
Commit migrated from https://github.com/mono/mono/commit/
58b53299b76c7f788a18116676ea8aa9c00a0b9c
Jay Krell [Wed, 16 Oct 2019 18:56:09 +0000 (11:56 -0700)]
[cxx][netcore] Goto around init. (mono/mono#17348)
[cxx][netcore] Goto around init.
Commit migrated from https://github.com/mono/mono/commit/
de9ccfa63fc373d20759275c5eb5f3706869def3
Jay Krell [Wed, 16 Oct 2019 18:28:24 +0000 (11:28 -0700)]
[cxx][x86] ifndef DISABLE_JIT around mono_arch_emit_prolog. (mono/mono#17346)
Commit migrated from https://github.com/mono/mono/commit/
70675241410f886b096ee79decaf6c3da047640a
Egor Bogatov [Wed, 16 Oct 2019 18:20:48 +0000 (21:20 +0300)]
fix netcore build with cygwin (mono/mono#17361)
Commit migrated from https://github.com/mono/mono/commit/
c13f36bdfe4558277b92fba714385d0ee377bf0b
Egor Bogatov [Wed, 16 Oct 2019 18:16:51 +0000 (21:16 +0300)]
[netcore] Implement System.IO.HasOverriddenBeginEndRead(Write)… (mono/mono#17237)
* Implement HasOverriddenBeginEndRead and HasOverriddenBeginEndWrite
* fix typo
* clean up
* more clean up
* more clean up
* convert into intrinsics
* handle end* methods
* Update intrinsics.c
* make cache_System_IO_Stream_slots static
* fix race condition
* Rollback to icall
* Update icall.c
* Address feedback
* Address feedback
Commit migrated from https://github.com/mono/mono/commit/
886cd73784befd68b45c4fa3fa4f6864fe366139
Alexander Köplinger [Wed, 16 Oct 2019 16:52:13 +0000 (18:52 +0200)]
[ci] Improve netcore build telemetry by running nupkg and tests through build.sh (mono/mono#17349)
Follow-up to https://github.com/mono/mono/pull/17331.
We were running nuget pack and tests explicitly in the Azure Pipelines
config so we weren't capturing failure telemetry.
Commit migrated from https://github.com/mono/mono/commit/
cd6e574b87b4746afa980165a52e0eb0a95be58e
Jay Krell [Wed, 16 Oct 2019 12:25:55 +0000 (05:25 -0700)]
Replace mono_assembly_name_free use with mono_assembly_name_free_internal. (mono/mono#16982)
Replace mono_assembly_name_free use with mono_assembly_name_free_internal.
Maybe just remove the GC mode change and remove the internal form.
We don't really equate malloc/free with GC/locks/hangs, though arguably we should. Arguably this change is right.
Commit migrated from https://github.com/mono/mono/commit/
a03027cab08e9b2caddef8cdd8b62b8d2d6430c8
Vlad Brezae [Wed, 16 Oct 2019 10:56:14 +0000 (13:56 +0300)]
[interp] Add constant propagation of integers (mono/mono#17326)
* [interp] Make StackValue more intuitive
Replace the opcode field with an enum which will represent what type of value is contained (STACK_VALUE_LOCAL, STACK_VALUE_I4 etc)
* [interp] Add the mint type to the local data
Makes the emitting code easier and we no longer compute the mint type for each local access, which is fairly expensive.
* [interp] Handle indirect locals saner during cprop
Instead of checking for the indirect flag when loading from a local, simply never store a StackValue into such a local since we can't use it. We use the same logic when not pushing on the stack values for such locals.
* [interp] Add constant folding for integers
We decode the values from LDC_I4 and LDC_I8 opcodes and track/propagate the values on the stack and in the locals using the existing infrastructure. When loading a local, we try to load using the known constant value instead, so we might get to kill that local.
* [interp] Similar to stloc.np we can optimize pop/push pairs
If the pushing instruction pushes the same value that was popped by the previous instruction, we can kill them both
* [tests] Remove issue that seems to have been fixed for a while
Commit migrated from https://github.com/mono/mono/commit/
0aabccef9bf6f17313fa384349a8089e8d8b0642
Jay Krell [Wed, 16 Oct 2019 08:12:41 +0000 (01:12 -0700)]
Fix C++ WebAssembly build. (mono/mono#17302)
Commit migrated from https://github.com/mono/mono/commit/
7d3fc17e815073e24d1f1506305e6ae0c4753be7
Filip Navara [Wed, 16 Oct 2019 05:43:42 +0000 (07:43 +0200)]
Fix SafeHandle marshalling in ref/in/out parameters (mono/mono#17330)
* Fix SafeHandle marshalling in ref/in/out parameters
* Reorder code to make it exception safe, update comments
* Revert the code reordering because it breaks the invariant that new handle returned from native code should always create new SafeHandle on the managed side
* Fix test_0_safehandle_ref test. The test was expecting incorrect behavior, verified on .NET Core 3 and .NET Framework 4.8.
* Address PR feedback
* Fix cut & paste error
* Fix build
* Really fix the test_0_safehandle_ref tests
* Add more tests for SafeHandle marshalling
* Add exclusion for broken CoreFX test
Commit migrated from https://github.com/mono/mono/commit/
0c02bb1207af75c176c369e411d9f4407e21030d
Zoltan Varga [Wed, 16 Oct 2019 01:45:04 +0000 (21:45 -0400)]
[jit] Fix is_reference checks for intrinsics with byref parameters. (mono/mono#17338)
Found by https://github.com/mono/mono/issues/17335.
Commit migrated from https://github.com/mono/mono/commit/
08e8a7f2c3c43366358901d304bfe2808962577a
Ryan Lucia [Tue, 15 Oct 2019 23:40:24 +0000 (19:40 -0400)]
[loader] Add an explicit define DISABLE_DLLMAP to control dllmap usage (mono/mono#17315)
* [loader] Add an explicit define ENABLE_DLLMAP to control dllmap usage
* Update configure.ac
* Update configure.ac
* Add dllmap to enable-minimal
* Change to DISABLE_DLLMAP
* Grab some missing MonoDllMap uses
Commit migrated from https://github.com/mono/mono/commit/
3fa5f6c66e5d87e25425f2ced2c21d546aaf3cfe
Jo Shields [Tue, 15 Oct 2019 20:21:21 +0000 (16:21 -0400)]
Initial telemetry for netcore builds (mono/mono#17331)
* Load VSTS telemetry helpers into build.sh script
* First cut adding some basic VSTS-compatible telemetry on failures
* Don't make `ci=true` the default, make it a build.sh flag
Commit migrated from https://github.com/mono/mono/commit/
dc0eea6fd1c76c1060751d24ba8d0e93b8ea0277
Filip Navara [Mon, 14 Oct 2019 23:44:42 +0000 (01:44 +0200)]
Update CoreFX.issues.rsp
See https://github.com/mono/mono/pull/17232#issuecomment-
541973035.
Commit migrated from https://github.com/mono/mono/commit/
ac1d05ad4066456ddeab9748ab28989dd2a70ee2
Filip Navara [Mon, 14 Oct 2019 22:35:26 +0000 (00:35 +0200)]
[netcore] Avoid suspending threads in Environment.Exit, it can hang process (mono/mono#17318)
CoreCLR doesn't suspend threads on exit (https://github.com/dotnet/corefx/pull/41450#issuecomment-
536755093, https://github.com/dotnet/coreclr/pull/1813).
Fixes mono/mono#17317
Fixes mono/mono#15006
Fixes mono/mono#15010
Fixes mono/mono#15181
Unblocks mono/mono#17232
Commit migrated from https://github.com/mono/mono/commit/
a194de4cdf2b3e3567672edf75aee1b5624d199f
Filip Navara [Sat, 12 Oct 2019 10:29:27 +0000 (12:29 +0200)]
Remove broken sin/cos optimization for x86
Commit migrated from https://github.com/mono/mono/commit/
76068d8d6130f837f004bd435b23175886319a02
Filip Navara [Sat, 12 Oct 2019 10:27:47 +0000 (12:27 +0200)]
Remove broken sin/cos optimization for x64
Commit migrated from https://github.com/mono/mono/commit/
05df3970c21fc31d17a1d79e6738fa43d78709fd
Johan Lorensson [Mon, 14 Oct 2019 16:55:07 +0000 (18:55 +0200)]
Fix msvc build warning, empty source main-core.c. (mono/mono#17305)
Commit migrated from https://github.com/mono/mono/commit/
734b77688467defe62010b3f4eeb6d1694a7e596
Ryan Lucia [Wed, 9 Oct 2019 17:16:48 +0000 (13:16 -0400)]
[loader] Locking and coop related cleanup; fix leak
Commit migrated from https://github.com/mono/mono/commit/
e7b199377c1876c308b8420230b5ea74bf7a2aa9
Ryan Lucia [Tue, 8 Oct 2019 22:02:05 +0000 (18:02 -0400)]
[loader] Move PInvoke and DllMap code into separate source file
Commit migrated from https://github.com/mono/mono/commit/
bf3afd6cad3974706287d0943c3a5d0e823c1e5f
Ryan Lucia [Wed, 9 Oct 2019 17:37:35 +0000 (13:37 -0400)]
[netcore] Remove unused InternalLoadUnmanagedDllFromPath
As of https://github.com/dotnet/coreclr/pull/27090
Commit migrated from https://github.com/mono/mono/commit/
80db55591af3bc85f3f2d0735c316b9b08350a79
Ryan Lucia [Tue, 8 Oct 2019 20:10:03 +0000 (16:10 -0400)]
[netcore] Use a single NativeLibrary.cs for all platforms
Commit migrated from https://github.com/mono/mono/commit/
96050effa6e0461b986ac33ab15940b3a9d93353
Dotnet-GitSync-Bot [Sat, 12 Oct 2019 06:50:00 +0000 (23:50 -0700)]
Mirror changes from mono/coreclr (mono/mono#17297)
* Enable fast-paths on Mono for Array (dotnet/coreclrmono/mono#27144)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* [CoreLib] Remove String fields moved to shared
* Stub Array Try* methods
Commit migrated from https://github.com/mono/mono/commit/
4e81814709b0ebbab4ed6e5bde22370b0fd5e4ac
Ryan Lucia [Sat, 12 Oct 2019 00:49:24 +0000 (20:49 -0400)]
[loader] Fix gnu/lib-names.h define (mono/mono#17294)
Commit migrated from https://github.com/mono/mono/commit/
9832bbb0ac059418c5edeb6388678be89e44f560
Jay Krell [Fri, 11 Oct 2019 23:47:20 +0000 (16:47 -0700)]
[runtime] Add portable cached array creation functions and replace gcc-specific impl. (mono/mono#16855)
* Remove unused mono_class_get_field_from_name_cached.
* Replace gcc-specific:
mono_array_class_get_cached
mono_array_new_cached
mono_array_new_cached_handle
with portable forms that are easy enough to use and general enough.
Before was "easier" because cache provided for you -- possibly multiple.
Before was more general because rank was a parameter -- and had to be a constant.
It was always 1.
Commit migrated from https://github.com/mono/mono/commit/
33d62537d4f7ceeabd8439b26724450a88981d58
Egor Bogatov [Fri, 11 Oct 2019 19:09:08 +0000 (22:09 +0300)]
Enable more hw intrinsics for AOT (mono/mono#17160)
* Enable more hw intrinsics for AOT
* Address feedback
* does it fix the failure?
* fix loadedllvm
* Address feedback
* fix copy-paste
* forgot MONO_LLVM_INTERNAL
Commit migrated from https://github.com/mono/mono/commit/
9cc5ea3862894a10d87a51e302893b0165e4850c
Kyle White [Fri, 11 Oct 2019 15:15:21 +0000 (11:15 -0400)]
Update MERP event type to MonoAppCrash (mono/mono#17131)
* Update parameters in MERP WerReportMetadata xml
To enable backend analysis, we need to update our parameters to match our back end event type, which is MonoAppCrash.
It doesn't make sense to me that the previous implementation constructed the XML here in Mono, but depended on the user (VSMac in this case) to add the "correct" event type. The parameters in the XML, must match exactly what is expected for the given EventType, and so we should ensure they are always in-sync by defining them here. Thus, I removed the usage of `eventType` in `mono_merp_enable` and hard coded the expected eventType.
* [merp] Don't pass eventType from managed
The eventType must me MONO_MERP_EVENT_TYPE_STR ("MonoAppCrash") - the backend
determines the format of the other fields based on the event type, so it
doesn't make sense to pass other values from managed since the runtime controls
the other fields.
For compatability Mono.Runtime.EnableMicrosoftTelemetry will still take a
string parameter (now called "unused" instead of "eventType_str") but it will
not pass it down to the internal call.
* Bump corlib version
* [merp] Revert paramerters in WerReportMetadata.xml
Still need event type to be `MonoAppCrash` but the parameters will be the same as before.
Commit migrated from https://github.com/mono/mono/commit/
481b3005c63daa38d163e46ef5bb43288b1403b7
Imran Hameed [Thu, 10 Oct 2019 23:05:34 +0000 (16:05 -0700)]
Generate LLVM IR for OP_XEQUAL that is recognized by LLVM's vector pattern recognizers.
Commit migrated from https://github.com/mono/mono/commit/
7c7d406fc01e6f867519c8aa3959d5a96a896a3e
Vlad Brezae [Thu, 10 Oct 2019 19:29:19 +0000 (22:29 +0300)]
[interp] Kill more instructions (mono/mono#17226)
* [interp] Replace STLOC to dead local with MINT_POP
* [interp] Optimize MINT_POP
It was only used for 0 and 1 values. The implementation for values larger than 1 was broken anyway.
* [interp] Remove unnecessary usage of MINT_POP1
When storing a static field from a CEE_STFLD instruction.
* [interp] Prevent optimizing away the stack, after a branch
We know the contents of the stack following a branch, so we could have optimized away some instructions preceding the branch. We shouldn't do this because the code we are branching to expects a certain stack size.
* [interp] Clear instructions which push unused values on stack
* [interp] Properly initialize stack when pushing local
Commit migrated from https://github.com/mono/mono/commit/
165c114aaa68a52c5aa10ae1df93816f71061840
Ryan Lucia [Thu, 10 Oct 2019 13:23:16 +0000 (09:23 -0400)]
[eglib] Add newline for failure check prints (mono/mono#17262)
Commit migrated from https://github.com/mono/mono/commit/
1b6bbfaf367211bb785467731ae1a111a9487dfd
Johan Lorensson [Thu, 10 Oct 2019 13:22:54 +0000 (15:22 +0200)]
Incorrect constrained virtual call in method using gsharedvt for reference type. (mono/mono#17227)
* Incorrect constrained virtual call in method using gsharedvt for reference type.
For generic constrained virtual calls using reference type's, the
virtual call will be dispatched using instance vtable. When the same
virtual call is taking place in a gsharedvt method, mono_gsharedvt_constrained_call
gets called that will assist making the call, the problem is that it will
use the constrained class for reference types meaning that it will not call
the most derived implementation of the method. This difference in the behavior
compared to none gsharedvt versions of methods, gives inconsistent results.
One way this will reproduce is by using Dictionary<Type, EmptyStruct>. For
methods that will take both Type (reference type) and EmptyStruct (value type)
like Add, calling that through IDictionary (hiding details from compiler) will
use the gsharedvt version of the method. Internally that method will call
Type.GetHashCode (), and since Type really is a RuntimeType it overrides
GetHashCode. But since mono_gsharedvt_constrained_call will use the constrained
class instead of the instance class, the called method will be
Object.GetHashCode, that gives a different result. When later ContainsKey
is called using the same Type, it only takes a reference value, so not
using a gsharedvt version of the method, then the most derived version of
GetHashCode will be called, given a different hash, not finding item
in dictionary.
Fix is to make sure behavior in mono_gsharedvt_constrained_call match
behavior for regular constrained virtual calls when having a reference type.
This makes sure we always call the most derived version of the method.
Commit also adds a test for this specific scenario using a dictionary.
* Updated to a more low-level test.
Commit migrated from https://github.com/mono/mono/commit/
0db52289a39cf21618ec604f2b0940bbfbfd616b
Bernhard Urban-Forster [Thu, 10 Oct 2019 09:21:23 +0000 (11:21 +0200)]
[mini] trace snippet should restore return value (mono/mono#17251)
* [mini] trace snippet should restore return value
This is a problem on architectures with a floating point stack (x86).
Without this PR and without `--trace` the managed-to-native wrapper for `Math.Ceiling` has a basic block like this at the end:
```
AFTER LOWER-VTYPE-OPTS 4: [IN: BB6(5) BB3(1), OUT: BB1(3) ]
fmove R34 <- R16
ldaddr R35 <- R10
load_membase R37 <- [R35 + 0x0]
store_membase_reg [R36] <- R37
il_seq_point il: 0x2d
```
`R16` contains the return value. `ldaddr`/`load_membase`/`store_membase_reg` is the sequence for LMF popping. `mono_spill_global_vars` does this with it:
```
SPILL BLOCK 4:
fmove R34 <- R16
ff 34 16
0 loadr8_membase R34 <- [%ebp + 0xffffffd4]
1 nop
ldaddr R35 <- R10
ii 35 5
1 add_imm R35 <- %ebp [-36] clobbers: 1
load_membase R37 <- [R35 + 0x0]
ii 37 35
1 load_membase R37 <- [R35 + 0x0]
store_membase_reg [R36] <- R37
ii -1 37
1 store_membase_reg [%edi] <- R37
il_seq_point il: 0x2d
-1
1 il_seq_point il: 0x2d
```
The local register allocator takes care of the FP stack handling:
```
processing: 0 loadr8_membase %fr0 <- [%ebp + 0xffffffd4]
[%fr0]
processing: 0 load_membase %eax <- [%ebp + 0xffffffdc]
[%fr0]
processing: 0 store_membase_reg [%edi] <- %eax
[%fr0]
processing: 0 il_seq_point il: 0x2d
[%fr0]
```
At the end of the basic block we have one value left on the FP stack. That's good as we are in the `cfg->bb_exit` basic block, so this is ought to be the return value.
Let's enable `--trace=M:System.Math:Ceiling`. It will insert some code in order to copy arguments/return value to some datastructure that can then be printed by the trace code:
```
processing: 0 loadr8_membase %fr0 <- [%ebp + 0xffffffd4]
[%fr0]
processing: 0 iconst %eax <- [
11116832]
[%fr0]
processing: 0 iconst %eax <- [52]
[%fr0]
processing: 0 localloc_imm %eax <-
[%fr0]
processing: 0 localloc_imm %ecx <-
[%fr0]
processing: 0 store_membase_reg [%eax + 0x30] <- %ecx
[%fr0]
processing: 0 x86_lea_membase %edx <- %ebp
[%fr0]
processing: 0 store_membase_reg [%ecx] <- %edx
[%fr0]
processing: 0 store_membase_imm [%eax + 0x28] <- [
11116832]
[%fr0]
processing: 0 storer8_membase_reg [%ebp + 0xffffffcc] <- %fr0
[]
processing: 0 x86_lea_membase %ecx <- %ebp
[]
processing: 0 store_membase_reg [%eax + 0x2c] <- %ecx
[]
processing: 0 store_membase_reg [%esp + 0x4] <- %eax
[]
processing: 0 store_membase_imm [%esp] <- [
11116832]
[]
processing: 0 voidcall [mono_trace_leave_method] clobbers: c
[]
processing: 0 x86_lea_membase %eax <- %ebp
[]
processing: 0 load_membase %eax <- [%ebp + 0xffffffdc]
[]
processing: 0 store_membase_reg [%edi] <- %eax
[]
processing: 0 il_seq_point il: 0x2d
[]
```
At the very beginning we push some value on the FP stack, same as before. However the code inserted by the tracing code will pop that value. Now, when returning to the, it will pop again something from the FP stack, but alas it's gonna be garbage.
With this PR it looks like this:
```
processing: 0 loadr8_membase %fr0 <- [%ebp + 0xffffffd4]
[%fr0]
processing: 0 iconst %eax <- [
11116832]
[%fr0]
processing: 0 iconst %eax <- [52]
[%fr0]
processing: 0 localloc_imm %eax <-
[%fr0]
processing: 0 localloc_imm %ecx <-
[%fr0]
processing: 0 store_membase_reg [%eax + 0x30] <- %ecx
[%fr0]
processing: 0 x86_lea_membase %edx <- %ebp
[%fr0]
processing: 0 store_membase_reg [%ecx] <- %edx
[%fr0]
processing: 0 store_membase_imm [%eax + 0x28] <- [
11116832]
[%fr0]
processing: 0 storer8_membase_reg [%ebp + 0xffffffcc] <- %fr0
[]
processing: 0 x86_lea_membase %ecx <- %ebp
[]
processing: 0 store_membase_reg [%eax + 0x2c] <- %ecx
[]
processing: 0 loadr8_membase %fr0 <- [%ebp + 0xffffffcc]
[%fr0]
processing: 0 store_membase_reg [%esp + 0x4] <- %eax
[%fr0]
processing: 0 store_membase_imm [%esp] <- [
11116832]
[%fr0]
processing: 0 voidcall [mono_trace_leave_method] clobbers: c
[%fr0]
processing: 0 x86_lea_membase %eax <- %ebp
[%fr0]
processing: 0 load_membase %eax <- [%ebp + 0xffffffdc]
[%fr0]
processing: 0 store_membase_reg [%edi] <- %eax
[%fr0]
processing: 0 il_seq_point il: 0x2d
[%fr0]
```
Leaving us the return value on the FP stack before returning.
Fixes https://github.com/mono/mono/issues/16410
Commit migrated from https://github.com/mono/mono/commit/
6ebf07f2cd4f71218c6a4a2ed5f855a5ac9ce9e3
Jay Krell [Thu, 10 Oct 2019 08:26:14 +0000 (01:26 -0700)]
Fix g_assert_not_reached message regression. (mono/mono#17263)
Fix g_assert_not_reached message regression.
Commit migrated from https://github.com/mono/mono/commit/
8c5581a6f2190cbfee3c223ef8ccaf84802de041
Jay Krell [Wed, 9 Oct 2019 20:56:06 +0000 (13:56 -0700)]
Remove varargs from g_assert and g_assert_not_reachable. (mono/mono#17254)
Remove varargs from g_assert and g_assert_not_reachable (save 200+ bytes per frame in wasm interp).
g_assertf unchanged.
I have a strong suspicion, this will save approximately 432 - sizeof (InterpFrame) bytes of stack
per function call in the WebAssembly interpreter.
It will not significantly benefit or hurt any other system.
Systems with disabled asserts will receive a small size improvement.
WebAssembly has no provision for varargs.
Emscripten emulates it.
It appears the emulation allocates room in the frame per outgoing varargs call.
No stack packing.
So each g_assert takes space.
Alternative would be to discourage or disable or remove asserts.
Commit migrated from https://github.com/mono/mono/commit/
8718b75b7a89f04e2423d11a009f11b37ef802df
Bernhard Urban-Forster [Wed, 9 Oct 2019 18:16:04 +0000 (20:16 +0200)]
[mini] print inserted instruction in verbose logging (mono/mono#17249)
[mini] print inserted instruction in verbose logging
before:
```
fmove R11 <- R9
ff 11 9
1 nop
```
after:
```
fmove R11 <- R9
ff 11 9
0 loadr8_membase R11 <- [%ebp + 0x8]
1 nop
```
Commit migrated from https://github.com/mono/mono/commit/
1cf081529e5e37dd9472f7c7b0d0ead659e9b54f
Filip Navara [Wed, 9 Oct 2019 13:47:43 +0000 (15:47 +0200)]
[mini] Fix check for FastAllocateString that used old name (mono/mono#17219)
* Fix check for FastAllocateString that used old name
* Fix linker scripts
* Update the icall name for FastAllocateString to match managed name
* Update size check in managed allocator
* One more 64-bit target fix
Commit migrated from https://github.com/mono/mono/commit/
cbc8cc658bee5d8447f538bf5e6775bd8dd0dae9
Vlad Brezae [Wed, 9 Oct 2019 11:37:41 +0000 (14:37 +0300)]
[sgen] Fix invalid value passed to write barrier (mono/mono#17236)
When doing memory copy dest is the destination address and src is the source address. If we are copying a single reference, we need to emit a write barrier and pass to the write barrier the value, not the pointer where the value is stored.
Commit migrated from https://github.com/mono/mono/commit/
8e649c35450e77e68ff468ced77987e4c0b51f99
Johan Lorensson [Wed, 9 Oct 2019 08:06:09 +0000 (10:06 +0200)]
Running --enable-msvc-only didn't find jay.vcxproj. (mono/mono#17228)
Commit migrated from https://github.com/mono/mono/commit/
7fad4a12e223bb3fc89ae75d448b93ecabc825f0
Filip Navara [Tue, 8 Oct 2019 21:37:34 +0000 (23:37 +0200)]
[netcore] Fix NULL dereference when running LLVM JIT
Commit migrated from https://github.com/mono/mono/commit/
28b3446d9eb433a23b595996d4a32dcea5f46b14
Jay Krell [Wed, 9 Oct 2019 04:54:44 +0000 (21:54 -0700)]
Revert mono_runtime_set_main_args in mono/mono@
44ff0597b835d0af62f526169dba3b365c9c3411. (mono/mono#17233)
It breaks Xamarin.Android.
Commit migrated from https://github.com/mono/mono/commit/
cacf99b97314870585af79e78191b836f9e072b5
Vlad Brezae [Tue, 8 Oct 2019 22:08:44 +0000 (01:08 +0300)]
[interp] Small cleanups (mono/mono#17229)
* [intepr] Add define for constant
* [interp] Pass separately pop_vt_sp argument
Cleans up the code a bit. There is no need to do fancy bit operations for such a slow opcode.
Commit migrated from https://github.com/mono/mono/commit/
579e385b96c5fd4d9e0b597d4820e3bd2e6cd24a
Filip Navara [Tue, 8 Oct 2019 21:45:17 +0000 (23:45 +0200)]
[netcore] Port CoreCLR implementation of Exception.SetCurrentStackTrace (mono/mono#17243)
* Port CoreCLR implementation of Exception.SetCurrentStackTrace
* Update SerializationRemoteStackTraceString
* Update Exception.cs
Commit migrated from https://github.com/mono/mono/commit/
63025d93fd36e834a5f0aca46b659cad0d01d2a2
Alexander Köplinger [Tue, 8 Oct 2019 15:39:41 +0000 (17:39 +0200)]
[netcore] Disable some SafeWaitHandle tests everywhere, not just Linux (mono/mono#17230)
The tests are kinda bogus since they create a SafeWaitHandle from `new IntPtr(1)` which causes a crash during finalization when releasing that handle.
See https://github.com/mono/mono/issues/17224
Commit migrated from https://github.com/mono/mono/commit/
209c4bae3ec1827d1b0e4799b12a51e88012554c
Filip Navara [Tue, 8 Oct 2019 11:06:38 +0000 (13:06 +0200)]
Fix check in fix_libc_name to trigger only for libc, not or other names with same prefix (mono/mono#17222)
See https://github.com/mono/mono/pull/17210#pullrequestreview-
298663220
Commit migrated from https://github.com/mono/mono/commit/
e8ed2494ca4af4d64706ac3ab06ba405391977c6
Steffen Kieß [Tue, 8 Oct 2019 10:04:45 +0000 (12:04 +0200)]
Clean up map.c /map.h (mono/mono#16746)
* [Mono.Posix] Move Mono_Posix_{From,To}MremapFlags() to support/sys-mman.c
Since mono/mono@
b522eab5ff5466debaacf9e971e26cfc464ebba5 Mono_Posix_FromMremapFlags()
and Mono_Posix_ToMremapFlags() contain manual changes for NetBSD. Move the
functions from support/map.c to support/sys-mman.c so that they won't be
overwritten when create-native-map is rerun.
* [Mono.Posix] Fix prototypes in support/stdio.c
In mono/mono@
ed892ccf27849c082ce6ca46fa8b96d86ca7c329 wrapper functions for several
stdio functions were added, but the prototypes in map.h were manually
written, not using create-native-map. This commit changes the prototypes so
that they match the output of create-native-map.
* [Mono.Posix] Undefine HAVE_STRUCT_SOCKADDR_IN6 in support/map.c on MSVC
In mono/mono@
22b6b9581418260397b701c17b16c3eb55136de7 a manual change to support/map.c
was added to prevent Mono_Posix_FromSockaddrIn6() and
Mono_Posix_ToSockaddrIn6() from being built for windows even if
HAVE_STRUCT_SOCKADDR_IN6 is defined. Instead undefine it in a header file
to avoid manual changes to map.c.
With this commit map.c, map.h and NativeConvert.generated.cs contain no
manual changes anymore.
Commit migrated from https://github.com/mono/mono/commit/
8bb7b8645a2622462f065d53f252b922bb304134