Alexis Christoforides [Fri, 8 Nov 2019 16:40:04 +0000 (11:40 -0500)]
[merp] Remove extraneous waitpid invocation (mono/mono#17723)
The extraneous call basically guarantees that the call right after will fail. Fixes merp stating that its process has failed when it hasn't.
Commit migrated from https://github.com/mono/mono/commit/
23f2baa71ed905e3298c10189adec8134bc6ed7c
Jo Shields [Fri, 8 Nov 2019 15:42:20 +0000 (10:42 -0500)]
Merge pull request mono/mono#17749 from directhex/dotnet-llvm-monorepo
[LLVM] Change llvm submodule to dotnet-org fork of official LLVM git repo
Commit migrated from https://github.com/mono/mono/commit/
3948a065af512e9ac6298a68e98035b5ac1f4d3c
lateralusX [Fri, 8 Nov 2019 08:39:07 +0000 (09:39 +0100)]
Fix Windows LLVM build using new repository structure.
Commit migrated from https://github.com/mono/mono/commit/
fad91a1c1e09df85040f8772d91eb6a5369303b4
Zoltan Varga [Thu, 7 Nov 2019 23:18:12 +0000 (18:18 -0500)]
[aot] Improve the aot mangler a bit, handle bool/char as a primitive type and avoid emitting a System prefix. (mono/mono#17739)
Commit migrated from https://github.com/mono/mono/commit/
c0a9d6bf7622cebacd1c1d56a56db9b0a5edab20
Ryan Lucia [Thu, 7 Nov 2019 20:02:23 +0000 (15:02 -0500)]
[netcore] Propagate ALCs through reflection functions (mono/mono#16949)
* [reflection] Pass assembly load context through mono_reflection_get_type_with_rootimage
The entry points are mono_reflection_type_from_name_checked and
mono_reflection_get_type_checked which for now pass in an ambient ALC, but
should be updated to take an ALC argument.
Internally mono_reflection_get_type_with_rootimage is recursive through a half
dozen helper functions which all get an ALC argument too.
The principle place where the ALC is used is in
_mono_reflection_get_type_from_info which passes it to
mono_assembly_loaded_internal and to replace the call to mono_assembly_load by
a direct call to mono_assembly_request_byname with an explicit ALC set in the
request.
* Mark mono_assembly_load as external only
* Pass an alc through non-static reflection functions
* Fix usage in wasm debugger
* Relax assertions due to wasm
Commit migrated from https://github.com/mono/mono/commit/
2c22d0de2edb09cfb008e587c40ee525fbe3749c
Jo Shields [Thu, 7 Nov 2019 16:58:32 +0000 (11:58 -0500)]
[llvm] redirect from mono llvm-mirror fork to dotnet llvm-project fork
Commit migrated from https://github.com/mono/mono/commit/
b61263e994a326e3b3d302bca0194f73f0b6534e
Aleksey Kliger (λgeek) [Thu, 7 Nov 2019 16:42:52 +0000 (11:42 -0500)]
[profiler] Fix log profiling of native to managed wrappers (mono/mono#17740)
* [profiler] Add test case for pinvokes and reverse pinvokes
* [profiler] Fix crash in native to managed wrappers
When we call back to managed from a pinvoke, we're in GC Safe mode and the
profiler instrumentation is inserted in the wrapper before it does the
transition to GC Unsafe. So we need an extra transition before the profiler
calls its locking functions
Fixes https://github.com/mono/mono/issues/17687
* [coop] Mark internal GC Unsafe functions with MONO_PROFILER_API
Allow the profiler to transition to GC Unsafe mode
* [profiler] ptestrunner.pl fix profiler modules directory
we used to specify mono/mini/.libs but that's not where the profiler plugins live, they're in mono/profiler/.libs. We probably picked up the profiler plugins from the system Mono install.
Commit migrated from https://github.com/mono/mono/commit/
2c56ac54c05b2fca5daa3629c337001c35fae40b
Thays Grazia [Thu, 7 Nov 2019 14:22:25 +0000 (11:22 -0300)]
[embed] Assert when call mono_runtime_object_init (mono/mono#17589)
* Fix assert when calling externally call mono_runtime_object_init, mono_object_get_domain, mono_string_to_utf8
* Adding samples/embed as unit-test
Commit migrated from https://github.com/mono/mono/commit/
4bdacea237f2ae7ed444e0336dad503d9a0535ac
Jay Krell [Thu, 7 Nov 2019 06:36:07 +0000 (22:36 -0800)]
Remove handles from ves_icall_System_Array_InternalCreate. (mono/mono#17681)
Remove handles from ves_icall_System_Array_InternalCreate.
Also combine two allocas.
Commit migrated from https://github.com/mono/mono/commit/
7b4b5e72d9ff818e64df21c4b82c9c5b0a01fdee
Zoltan Varga [Thu, 7 Nov 2019 00:50:59 +0000 (19:50 -0500)]
[runtime] Fix locking in mono_get_seq_points (). (mono/mono#17738)
Fixes https://github.com/mono/mono/issues/17737.
Commit migrated from https://github.com/mono/mono/commit/
0680073b878a9bbbda61be19b9c360f80a6ca156
Johan Lorensson [Wed, 6 Nov 2019 15:51:31 +0000 (16:51 +0100)]
Switch away from Start-Process, Wait-Process in build.ps1. (mono/mono#17730)
Running Start-Process, Wait-Process on msbuild.exe have showed a couple
of hangs in the build script. This is most likely due to msbuild.exe
spawned child processes (like compile servers) running longer than
spawned msbuild.exe process. Since there is no specific requirements
when spawning the process from build.ps1, switch to regular process
exec and LastExitCode.
Commit migrated from https://github.com/mono/mono/commit/
bda239f44ca8068c3a6d6cbcb10704c2387ad2f2
Johan Lorensson [Wed, 6 Nov 2019 15:51:14 +0000 (16:51 +0100)]
Explicit update/init only LLVM BTLS repro on external MSVC build. (mono/mono#17691)
Reduce the scope of git submodule update --init to only LLVM and/or BTLS
repositories when building external MSVC dependencies.
Commit migrated from https://github.com/mono/mono/commit/
1a6c092019877dacd33d57c104ac4cdf8933fd9b
Marek Safar [Wed, 6 Nov 2019 08:29:04 +0000 (09:29 +0100)]
[System.Private.CoreLib] Remove unused Array methods
Commit migrated from https://github.com/mono/mono/commit/
965beadc1e8d1ade051726db17f819451fc0dff9
Jay Krell [Wed, 6 Nov 2019 02:56:10 +0000 (18:56 -0800)]
Handles reduction -- 4 MERP functions. (mono/mono#17711)
Handles reduction -- 4 MERP functions.
Commit migrated from https://github.com/mono/mono/commit/
1e8e3578310f5183ba692c125bfd85d596335ee0
Jay Krell [Tue, 5 Nov 2019 21:38:40 +0000 (13:38 -0800)]
error_init reduction. (mono/mono#17712)
Commit migrated from https://github.com/mono/mono/commit/
aa506ca1bb56251f8791cf7de2dba6c8f87f24b8
Ryan Lucia [Tue, 5 Nov 2019 19:35:00 +0000 (14:35 -0500)]
[loader] Skip the full pinvoke resolution process for __Internal (mono/mono#17701)
Commit migrated from https://github.com/mono/mono/commit/
f477bce54866af7ef417057f141be5e08d0b920e
Bernhard Urban-Forster [Tue, 5 Nov 2019 18:09:32 +0000 (19:09 +0100)]
[mini] Fix Coverity CID 1455161 & 1455162 (mono/mono#17615)
* [mini] Fix Coverity CID 1455161 & 1455162
> Null-checking "ji" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
* do not rely on assert to guard ji-nullness. refactor a bit
Commit migrated from https://github.com/mono/mono/commit/
93b97d5582cf89d20f2deff9f6232402c30ce3bc
Johan Lorensson [Tue, 5 Nov 2019 12:16:32 +0000 (13:16 +0100)]
Fix MSVC intellisense for LLVM sources. (mono/mono#17706)
Commit migrated from https://github.com/mono/mono/commit/
6f73c2dab8b19237800f9150fac6368d15220f5b
Johan Lorensson [Tue, 5 Nov 2019 06:57:06 +0000 (07:57 +0100)]
Fix correct accumulated time for parallelized jobs in SGEN. (mono/mono#17518)
* Fix correct accumulated time for parallelized jobs in SGEN.
Current implementation incorrectly accumulate time for scan jobs for
the follow metrics when running parallel minor GC:
time_minor_scan_major_blocks,
time_minor_scan_los,
time_major_scan_mod_union_blocks,
time_major_scan_mod_union_los
Commit fix so updates are atomic making sure values are correct in cases
where parallel minor GC is used.
* Implement 64-bit atommic add fallback in SGEN.
Commit migrated from https://github.com/mono/mono/commit/
44e6226c31d8ffcae58f81350d71a728edecfe22
Nikolay Sivov [Tue, 5 Nov 2019 06:56:44 +0000 (09:56 +0300)]
[mono] Fix ProcessExit handler argument. (mono/mono#17680)
Problem was spotted with mono tracing hitting ProcessExit handler,
and crashing on first argument.
Commit migrated from https://github.com/mono/mono/commit/
95743afa802ef737ec815506be6667e5379e7c19
Egor Bogatov [Tue, 5 Nov 2019 06:50:37 +0000 (09:50 +0300)]
[netcore] Intrinsify Buffer.IsPrimitiveTypeArray (mono/mono#17438)
* Improve IsPrimitive intrinsic
* Implement it for interpreter
* clean up
* clean up
Commit migrated from https://github.com/mono/mono/commit/
fdc6495a549fbd3a4b222b888a7a72ba7b65330c
Vlad Brezae [Mon, 4 Nov 2019 17:58:38 +0000 (19:58 +0200)]
[interp] Use GetType instrinsic also on net4x (mono/mono#17654)
We didn't do this because it had some issues when GetType was invoked through reflection. This issue would also be present with jit but, because jit doesn't use direct wrappers, the GetType call can't be intrinsified in that scenario. See https://github.com/mono/mono/pull/5350 for the context of the issue.
Commit migrated from https://github.com/mono/mono/commit/
b3b9960ed13a2f8e199bf4c32f9de92e9abf2f4b
Egor Bogatov [Mon, 4 Nov 2019 17:48:04 +0000 (20:48 +0300)]
[netcore] Copy Array.Clear impl from CoreCLR (mono/mono#17411)
* Address feedback
* fix build error
* Fix has_reference usage in object.c
* Fix fallback impl
* Rename to ArrayHasReferences
* Rename to ObjectHasReferences
* Rollback to ArrayHasReferences
* Rename to ObjectHasReference
* remove redundant is_array variable
* ObjectHasReferences can accept any object
* undo changes in Program.cs
* undo changes in Program.cs
Commit migrated from https://github.com/mono/mono/commit/
cf8495e2f73a56770d5a9d876ab865485b4f353b
Filip Navara [Mon, 4 Nov 2019 17:40:13 +0000 (18:40 +0100)]
Intrinsify Activator.CreateInstance<T> for value types with no ctor (mono/mono#17688)
* Intrinsify Activator.CreateInstance<T> for value types with no ctor
* Fix failed test, address feedback
Commit migrated from https://github.com/mono/mono/commit/
07fa0bd3b40d4831800e1da6f68556d690884119
Zoltan Varga [Mon, 4 Nov 2019 17:14:59 +0000 (12:14 -0500)]
[jit] Allow Unsafe.As<TFrom, TTo> on gsharedvt types. (mono/mono#17692)
Commit migrated from https://github.com/mono/mono/commit/
929a8a7fd836cc4d6d746c30d4ef1c5b73aed248
Bernhard Urban-Forster [Mon, 4 Nov 2019 14:56:46 +0000 (15:56 +0100)]
[interp] use mask instead of bool expression (mono/mono#17683)
Discovered by Coverity:
```
>>> CID 1455205: (CONSTANT_EXPRESSION_RESULT)
>>> The expression "flag && 2" is suspicious because it performs a
Boolean operation on a constant other than 0 or 1.
```
Commit migrated from https://github.com/mono/mono/commit/
237f210ea24cbc201b8746fb0003cf7bec8b97b0
Johan Lorensson [Mon, 4 Nov 2019 07:55:36 +0000 (08:55 +0100)]
Mono NetCore Windows only build/test. (mono/mono#17646)
Support for Windows Mono NetCore build/test wihtout any need for
cygwin/wsl/automake just MSBuild and MSVC. Windows build support mirror
technologies used by coreclr/aracade builds msbuild + powershell.
Windows only Mono NetCore build, makes a port of existing build.sh and
Makefile, implementing a build.ps1 and build.targets. So far full build
support + execution of corefx test suite is implemented. Other make file
rules can be added when needed.
MSVC build runtime seems to hits a couple of additional test failures
in corefx test suite that needs to be investigated further.
Building NetCore Mono on Windows can now be done without cygwin or wsl.
Build depends on regular VS install (or build tools), if xunit summary
is requested, python needs to be installed.
Commit migrated from https://github.com/mono/mono/commit/
c0e237b7340a58384e191f7bdc6d954b9585330b
Egor Bogatov [Mon, 4 Nov 2019 03:39:19 +0000 (06:39 +0300)]
[netcore] Improve Array.CreateInstance (mono/mono#17673)
* Rewrite Array.CreateInstance
* Rewrite Array.CreateInstance
* Address feedback
* Convert the icall to NOHANDLES
* fix build errors, remove NOHANDLES
* Fix GC.KeepAlive usage
* Remove icall definition for GC.KeepAlive (it's no an icall)
* Fix failing tests (expect details in the AOORE)
Commit migrated from https://github.com/mono/mono/commit/
137ffe8b7c18d8a153f9311a8b30b53139ee2073
Filip Navara [Sun, 3 Nov 2019 17:28:32 +0000 (18:28 +0100)]
[netcore] Improve default constructor lookup, (mono/mono#17666)
* [netcore] Improve default constructor lookup, cache when no default constructor is found (common for struct)
* Address PR feedback
Commit migrated from https://github.com/mono/mono/commit/
8131518bb12a059ffc71fa6c6030b103b5c6d35b
Alexander Köplinger [Sun, 3 Nov 2019 11:27:43 +0000 (12:27 +0100)]
[netcore] Disable shared compilation for System.Private.CoreLib
There's a dotnet process hanging around which seems to lock the build when called from the SDKs Makefiles.
Commit migrated from https://github.com/mono/mono/commit/
4888c49c26aa7b3239bebb2048e77ae33c800567
Alexander Köplinger [Sat, 2 Nov 2019 23:40:29 +0000 (00:40 +0100)]
[netcore] Fix strong name key for System.Private.CoreLib
It's using the silverlight key: https://github.com/dotnet/coreclr/blob/mono/mono@
34fe045a27e150bde7ee54e0d5f0df635922519d/src/System.Private.CoreLib/System.Private.CoreLib.csproj#L112
Commit migrated from https://github.com/mono/mono/commit/
40c1cd357646dc8406b74f3888f8f6a4c10cfb7b
Alexander Köplinger [Fri, 25 Oct 2019 23:17:01 +0000 (01:17 +0200)]
[netcore] Fix out of tree build for netcore/ folder
Commit migrated from https://github.com/mono/mono/commit/
d89b96a298ef75ef8bcd94bae122fba3a042277a
Bernhard Urban-Forster [Sat, 2 Nov 2019 15:45:36 +0000 (16:45 +0100)]
[interp] s/MONO_API_ERROR_INIT/error_init_reuse/g (mono/mono#17650)
[interp] s/MONO_API_ERROR_INIT/error_init_reuse/g
Commit migrated from https://github.com/mono/mono/commit/
62ee01b36bbc2fbef85ffd456f71eabd2a254c2a
Zoltan Varga [Sat, 2 Nov 2019 07:57:25 +0000 (03:57 -0400)]
[jit] Call mono_class_setup_fields () before accessing field->offset. (mono/mono#17667)
Fixes https://github.com/mono/mono/issues/17665.
Commit migrated from https://github.com/mono/mono/commit/
803c657b24b9110fe69a6df460807dfb1b7e72a1
Jay Krell [Fri, 1 Nov 2019 21:36:06 +0000 (14:36 -0700)]
Move MonoError from managed wrappers to native wrappers. (mono/mono#15894)
Move MonoError from managed wrappers to native wrappers.
Move MonoError from managed wrappers (ilgen) to native wrappers (C preprocessor).
Alternative to https://github.com/mono/mono/pull/15869.
Which says: Previously, we would emit a call to memset
since the struct is large (> 100 bytes). Only the error code
field needs to be initialized.
Which that PR and this PR both fix, in different ways.
In the past:
- This did not work due to a possible dependency on precise GC,
interacting with what gets zeroed or not here.
That is why I put it on the managed side.
We'll see if that reproduces.
(https://github.com/mono/mono/pull/11294/files#diff-efe0070415f3f0c0f24ed0221aa1962aR339
external/coreclr/tests/src/CoreMangLib/cti/system/weakreference/weakreferenceisaliveb.exe.)
- Some indication that embedding API should expose MonoError
and not set_pending_exception. This does not seem relevant
presently, and the code seems better structured and
more efficient this way. It can revisited if/when new public API
is the dominant concern, or do it this way for these functions,
and another way for actual public functions.
(https://github.com/mono/mono/pull/11294#issuecomment-
432443485)
Commit migrated from https://github.com/mono/mono/commit/
4b9dc08ac19cfc3c451bba2fa7fefc7e31fc1ecc
Zoltan Varga [Fri, 1 Nov 2019 16:52:45 +0000 (12:52 -0400)]
[netcore] Cleanups. (mono/mono#17661)
* [netcore] Remove the type_info field from RuntimeType, extend the TypeCache structure instead.
* [netcore] Remove some linker exclusions which are not needed.
Commit migrated from https://github.com/mono/mono/commit/
e9d68e9485611d47c3ad17f3b4d178089e68cab0
Jo Shields [Fri, 1 Nov 2019 14:26:08 +0000 (10:26 -0400)]
[System.Net.Http]: Bring `HttpClient` from CoreFX on monotouch and xammac. (mono/mono#17628)
Commit migrated from https://github.com/mono/mono/commit/
16d1a2e6f124ca80875870841b0ce1a7c605673e
Vlad Brezae [Fri, 1 Nov 2019 12:55:58 +0000 (14:55 +0200)]
[interp] Handle remoting field access same as jit (mono/mono#17641)
Doing this we avoid using slow ldrmfld in the common case of loading fields from instance methods, when we execute on the real object. We could do this also for strmfld but we need to track on the stack if the instance object is this, which is not worth the trouble.
Commit migrated from https://github.com/mono/mono/commit/
166fdf60b0eecb66e36ea744a75366fec9f92170
Vlad Brezae [Fri, 1 Nov 2019 12:55:27 +0000 (14:55 +0200)]
[interp] Optimize call path (mono/mono#17623)
* [interp] Optimize void calls
By avoiding setting of retval
* [interp] Avoid computing param count for every call
* [interp] Remove wrong profiler check
From the times when interp had its own EH mechanism. We raise this event from mono_handle_exception_internal for interp.
* [interp] Remove profiling check code from method exit
We emit MINT_PROF_EXIT opcode when under profiler. Unify profiling enter/exit with tracing enter/exit since they are very similar.
Commit migrated from https://github.com/mono/mono/commit/
170d33c35b76933c1d726922a7c40a9af5a6017d
Filip Navara [Fri, 1 Nov 2019 12:30:41 +0000 (13:30 +0100)]
Lower min/max SSE operations on x64 (mono/mono#17536)
Follow up on mono/mono#17511.
Commit migrated from https://github.com/mono/mono/commit/
8aa3654de586bf87ce69608eac71675eeef74a45
Zoltan Varga [Fri, 1 Nov 2019 07:43:42 +0000 (03:43 -0400)]
[llvm] Fix a case where we treated the dreg of a store_membase instruction as a dreg, its actually the base reg. (mono/mono#17648)
Commit migrated from https://github.com/mono/mono/commit/
dc8d55d4462216db4c3cb5f9eb3167fc6b746575
Vlad Brezae [Thu, 31 Oct 2019 15:49:16 +0000 (17:49 +0200)]
[interp] Avoid emitting MINT_SAFEPOINT for every single call (mono/mono#17625)
Commit migrated from https://github.com/mono/mono/commit/
b484979aa9741673c2f820bdac7f5c925128ad9d
Jonathan Chambers [Thu, 31 Oct 2019 14:13:01 +0000 (10:13 -0400)]
Avoid caching of System.dll image and types as they may be unloaded with appdomain. (mono/mono#17602)
Commit migrated from https://github.com/mono/mono/commit/
3648cb087b0b49c05300789a1bf5724d942ca174
Alexander Köplinger [Thu, 31 Oct 2019 12:37:55 +0000 (13:37 +0100)]
Fix build
Commit migrated from https://github.com/mono/mono/commit/
ca72deed17918505422a6b0ca67201fcf7021af0
Vlad Brezae [Thu, 31 Oct 2019 13:32:50 +0000 (15:32 +0200)]
[interp] Fix interp logging (mono/mono#17636)
* [interp] Don't print NOPs during cprop
They can become numerous and distracting.
* [interp] Fix mono_interp_print_code
Regressed after code_size was changed to byte count instead of short count.
Commit migrated from https://github.com/mono/mono/commit/
1d043a31e7d207739f81b303b7ee2c79ed135859
Zoltan Varga [Thu, 31 Oct 2019 05:33:50 +0000 (01:33 -0400)]
[runtime] Add a --enable-minimal=threads configure option to disable threading support. Use it on wasm. (mono/mono#17611)
Commit migrated from https://github.com/mono/mono/commit/
dc76a95aa9d266c0c9611408b00e63dfeca214b5
Zoltan Varga [Wed, 30 Oct 2019 20:07:44 +0000 (16:07 -0400)]
[eglib] Assert in g_strlcpy () if src/dest is NULL, instead of printing a warning. (mono/mono#17507)
Related to https://github.com/mono/mono/issues/17283.
Commit migrated from https://github.com/mono/mono/commit/
5811404e55e7b61f747ea93226d506e2e3fc3210
Jo Shields [Wed, 30 Oct 2019 19:09:06 +0000 (15:09 -0400)]
Rearrange System.Private.CoreLib for easier monorepo integration (mono/mono#17517)
* [netcore] Move corlib around to match CoreCLR directory layout better
This is a prerequisite to making a sane migration of this whole
directory from mono.git to coreclr.git
Commit migrated from https://github.com/mono/mono/commit/
27921fbbd06baadeb5fa07049c587e2a214d131f
Thays Grazia [Wed, 30 Oct 2019 17:47:15 +0000 (14:47 -0300)]
[dim][regression] Explicit interface override (mono/mono#17583)
* Precedence order:
-> Override interface method in class
-> Method in class
-> DIM
Commit migrated from https://github.com/mono/mono/commit/
fffb1201bdd14e18e19a3c61d0afe25a91a2d501
Bernhard Urban-Forster [Wed, 30 Oct 2019 15:36:04 +0000 (16:36 +0100)]
[interp] fix signature mismatch between jit<>interp for string constructor (mono/mono#17595)
[interp] fix signature mismatch between jit<>interp for string constructor
Commit migrated from https://github.com/mono/mono/commit/
95cad2452622dcc7197bbc312d6b397172b4a313
Marek Safar [Wed, 30 Oct 2019 07:03:41 +0000 (08:03 +0100)]
[System.Private.CoreLib] Remove NativeRuntimeEventSource
Commit migrated from https://github.com/mono/mono/commit/
e4c0b50dec5f90cdd369a842d577bab37ba059fb
Jay Krell [Wed, 30 Oct 2019 15:06:24 +0000 (08:06 -0700)]
Inline TLS access. (mono/mono#17119)
Inline TLS access.
This attempt differs from the previous in that the TLS accessor functions are presented to far less code, i.e. not to main.c, so their data references do not need to be resolved so much.
See https://github.com/mono/mono/commit/mono/mono@
bffd4c6b99213a0b154d7efac9b0581df67775e8 etc.
Commit migrated from https://github.com/mono/mono/commit/
10ac2750e2b29c812e553778aa854e8653e0dadb
Zoltan Varga [Wed, 30 Oct 2019 14:08:50 +0000 (10:08 -0400)]
Remove some unused icalls. (mono/mono#17612)
Commit migrated from https://github.com/mono/mono/commit/
79f5e6c288a542aa67a7626c0e6b7e873b6ba78d
Filip Navara [Wed, 30 Oct 2019 13:39:47 +0000 (14:39 +0100)]
[netcore] Report errors on Windows CI (mono/mono#17616)
* [netcore] Report errors on Windows CI
* Fix Windows build
Commit migrated from https://github.com/mono/mono/commit/
3d397805d4bb5764bc2e8e0da3c83d47c4b1f569
Zoltan Varga [Wed, 30 Oct 2019 04:04:15 +0000 (00:04 -0400)]
[wasm] Print a useful error message instead of a signature mismatch error on missing icalls. (mono/mono#17600)
Commit migrated from https://github.com/mono/mono/commit/
2823ac5d95bd9558de0b164271968ac3cb2d6c58
Zoltan Varga [Wed, 30 Oct 2019 04:03:08 +0000 (00:03 -0400)]
[wasm] Fix build problems. (mono/mono#17596)
* [runtime] Add a stub for MacOsIPInterfaceProperties::ParseRouteInfo icall on non-osx platforms to fix the wasm aot build.
* [wasm] Avoid generating invalid ninja build files if an assembly is specified on the command line and its also an implicit reference.
* Put back and ifdef.
* Fix the windows build.
Commit migrated from https://github.com/mono/mono/commit/
9adce0b6321e4bcc7ca40074b7d1293d3f0e8eb2
Filip Navara [Tue, 29 Oct 2019 20:55:55 +0000 (21:55 +0100)]
Temporary build fix
Commit migrated from https://github.com/mono/mono/commit/
d49d3efd5d7832e8c599a1a34431b5c68650639a
Bernhard Urban-Forster [Tue, 29 Oct 2019 21:36:01 +0000 (22:36 +0100)]
[mini] Initial tiered compilation work (mono/mono#17551)
[mini] Initial tiered compilation work
Enable it with `./autogen.sh --enable-experiment=tiered`.
Let's consider `Simple.cs`:
```csharp
using System.Runtime.CompilerServices;
using System;
public class Simple {
public static void Main (string []args) {
HotMethod ();
Console.WriteLine ("cnt: " + cnt);
HotMethod ();
Console.WriteLine ("cnt: " + cnt);
}
static int cnt = 0;
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void HotMethod () {
for (int i = 0; i <= 1000; i++)
cnt += i;
}
}
```
```console
$ csc Simple.cs
$ MONO_LOG_LEVEL=debug MONO_LOG_MASK=tiered ./mono/mini/mono-sgen --trace=M:Simple:HotMethod --interp=-all Simple.exe
[0x10ec275c0: 0.00000 0] ENTER:i Simple:HotMethod ()()
Mono: tiered: queued Simple:HotMethod ()
[0x10ec275c0: 0.00010 0] LEAVE:i Simple:HotMethod ()(
Mono: tiered: patching 0x7fe855803224 with patch_kind=INTERP @ tier_level=0
Mono: -> caller= Simple:Main (string[]) [{0x7fe85420df88} + 0x34 interp] (0x7fe8558031f0 0x7fe855803258) [0x7fe85420c880 - Simple.exe]
Mono: -> callee=Simple:HotMethod ()
Mono: tiered: patching 0x7fe8558031f2 with patch_kind=INTERP @ tier_level=0
Mono: -> caller= Simple:Main (string[]) [{0x7fe85420df88} + 0x2 interp] (0x7fe8558031f0 0x7fe855803258) [0x7fe85420c880 - Simple.exe]
Mono: -> callee=Simple:HotMethod ()
cnt: 500500
[0x10ec275c0: 0.04093 0] ENTER:c Simple:HotMethod ()()
[0x10ec275c0: 0.04095 0] LEAVE:c Simple:HotMethod ()(
cnt: 1001000
```
Note the suffix after `ENTER:`
* `i` indicates it's executed by the interpreter
* `c` indicates it's a compiled method (JIT)
Another example:
```console
$ make -C mono/mini gshared.exe
$ ./mono/mini/mono-sgen --interp=-all --stats ./mono/mini/gshared.exe
Regression tests: 84 ran, 0 failed in Tests
[...]
Tiered statistics
Methods promoted : 68
```
It's a basic proof-of-concept for now. An incomplete list of future work items:
* Right now it only works for direct calls, need to expand it to virtual/interface calls.
* Calls of the JIT leading into the interpreter again can't be patched yet.
* Kind of related, no concept of versioning compiled methods does exist yet. The interpreter maintains its own table of "transformed" methods, however, when doing the transition from JIT->interpreter, the wrapper+interpmethod will end up in the JIT table. We need a way to have multiple JIT compilation results for the same MonoMethod exist.
* Investigate actual performance. We might have to optimize the interp<>JIT transition.
* Patching is racy. Need to make that atomic.
* All the FIXMEs in this PR
<!--
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/
d274cfbacdb2aeab0184662997882f3d78991e48
Zoltan Varga [Tue, 29 Oct 2019 13:21:23 +0000 (09:21 -0400)]
[eglib] Handle dli.dli_sname being NULL in g_module_address (). (mono/mono#17592)
Should fix the warnings/assertions in g_strlcpy ().
Commit migrated from https://github.com/mono/mono/commit/
b0d966bd7ab887f075f6ce3d1c9858af6b52f30f
dotnet-maestro[bot] [Tue, 29 Oct 2019 11:51:33 +0000 (12:51 +0100)]
[master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx (mono/mono#17577)
* Update dependencies from https://github.com/dotnet/arcade build
20191027.3
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19527.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.19527.3
* Update dependencies from https://github.com/dotnet/core-setup build
20191027.2
- Microsoft.NETCore.App - 5.0.0-alpha1.19527.2
* Update dependencies from https://github.com/dotnet/corefx build
20191027.5
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha.1.19527.5
* Update CoreFX.issues.rsp
GetGCMemoryInfo was moved to GCExtendedTests in https://github.com/dotnet/corefx/commit/mono/mono@
d6dac9e6a7875862b91139334c8ec620f599cd4d.
GetTotalAllocatedBytes and GetAllocatedBytesForCurrentThread seem to pass now.
Commit migrated from https://github.com/mono/mono/commit/
cddf90dda46e7420679636ac1d358f411a5b5fcf
Zoltan Varga [Mon, 28 Oct 2019 14:59:53 +0000 (10:59 -0400)]
[runtime] Implement support for SuppressGCTransitionAttribute. (mono/mono#17534)
Fixes https://github.com/mono/mono/issues/17367.
Commit migrated from https://github.com/mono/mono/commit/
e4cc70f4b5038ec5d6500ba988d0bb67143658bc
Johan Lorensson [Mon, 28 Oct 2019 14:34:42 +0000 (15:34 +0100)]
Additional and adjusted logging for parallel minor GC. (mono/mono#17522)
* Additional and adjusted logging for parallel minor GC.
When running parallel minor GC we currently get incorrect timing
on several loggings and counters due to work being put on thread pool
and accumulated. This commit fix so that the logging is accurate
when running with and without parallelization. In parallel mode a new
logging is also added to show the accumulated split between major and los
remset scan jobs.
The counters time_minor_scan_remsets and time_minor_scan_roots are only
updated when not running parallel GC since they are not correct when
running parallel GC.
* Fix WASM build error.
Commit migrated from https://github.com/mono/mono/commit/
c5edcd1ed443ae5b960d8f8972b0850b7999e44a
Alexander Köplinger [Fri, 25 Oct 2019 18:32:03 +0000 (20:32 +0200)]
[netcore] Fix offsets generation when cross compiling
The offsets-tool.py uses some magic to map `typename` to `<underscore>typename` for looking up runtime types.
This caused issues on netcore because we aliased it to a different name.
To fix this let's keep the `_MonoInternalThread` name instead and just fix the one location where `_MonoThread` is used.
Commit migrated from https://github.com/mono/mono/commit/
450d4746849d228c85748d9ab4ef68f90ac0c7f2
Alexander Köplinger [Fri, 25 Oct 2019 18:27:34 +0000 (20:27 +0200)]
[netcore] Don't load types in aot-compiler.c that don't exist in corefx
Fixes https://github.com/mono/mono/issues/16026
Commit migrated from https://github.com/mono/mono/commit/
fb7b075e4930751421a5feb0b9ac095d832df228
Alexis Christoforides [Sat, 26 Oct 2019 22:48:40 +0000 (18:48 -0400)]
[merp] Introduce a new 'dump mode' that allows different signal behavior when dumping (mono/mono#17537)
* dump_native_stacktrace should always register the sigterm handler.
Cherry picked from the https://github.com/mono/mono/pull/17310
* [merp] Introduce a new 'dump mode' that allows different signal behavior when dumping
The primary reason for this is gaining the ability to interpret SIGTERM properly as a crashing signal when outside of 'dump mode', and as a utility signal during the 'thread summarizer' dumping process.
Commit migrated from https://github.com/mono/mono/commit/
db568c6fe0cb5eab71ed729ec5b412365eacf280
Aleksey Kliger (λgeek) [Sat, 26 Oct 2019 22:45:35 +0000 (18:45 -0400)]
[runtime] Unbalanced GC Unsafe transitions before shutdown (mono/mono#17566)
When embedders call mono_runtime_quit or mono_jit_cleanup, we need to do unbalanced transitions to GC Unsafe, because after mini_cleanup runs we don't have GC thread states anymore and MONO_EXIT_GC_UNSAFE will assert.
* [runtime] Do an unbalanced GC Unsafe transition in mono_jit_cleanup
After mini_cleanup, we don't have GC thread states anymore because all that
stuff was cleaned up, so MONO_EXIT_GC_UNSAFE would assert
* [runtime] Mark mono_runtime_quit external only.
Runtime should use mono_runtime_quit_internal.
After we call the quit_function (aka mini_cleanup) we don't have any GC thread
states anymore because all that stuff got cleaned up. So MONO_EXIT_GC_UNSAFE
can't work.
Commit migrated from https://github.com/mono/mono/commit/
0e3caf00df54199be88cfcb53ed847226defebb4
Jay Krell [Sat, 26 Oct 2019 16:26:15 +0000 (09:26 -0700)]
[cxx][x86] int/ptr casts (mono/mono#17570)
[cxx][x86] int/ptr casts
Commit migrated from https://github.com/mono/mono/commit/
5f3446bd12c32727b926eb0d39769af96a6a389c
Jay Krell [Fri, 25 Oct 2019 15:46:01 +0000 (08:46 -0700)]
[cxx] Compile mini-llvm.c as C++ if configure -enable-cxx. (mono/mono#17558)
[cxx] Compile mini-llvm.c as C++ if configure -enable-cxx.
This is presently catastrophic, because of `MonoJitICallId` varying between C and C++, and therefore the layout of `MonoCallInst`.
Related to:
https://github.com/mono/mono/pull/17557
https://github.com/mono/mono/pull/17445#issuecomment-
546175352
Commit migrated from https://github.com/mono/mono/commit/
893486638cae8efc46323d6c2209fc99febcd05d
Jay Krell [Fri, 25 Oct 2019 15:34:50 +0000 (08:34 -0700)]
[jit][x86][cxx] int/ptr casts (mono/mono#17382)
Commit migrated from https://github.com/mono/mono/commit/
84d64d314bdbbd8cee07bbcb9ec8d030abe0156d
Aleksey Kliger (λgeek) [Fri, 25 Oct 2019 15:28:18 +0000 (11:28 -0400)]
[runtime] Make mono_thread_manage external only (mono/mono#17554)
* [runtime] Make mono_thread_manage external only
runtime should use mono_thread_manage_internal
Commit migrated from https://github.com/mono/mono/commit/
d6ee245c94a8365c1d418ea82f9b83ce11cc53a3
Vlad Brezae [Fri, 25 Oct 2019 14:25:08 +0000 (17:25 +0300)]
[interp] Optimize stelem (mono/mono#17519)
* [interp] Optimize stelem instructions
* [intepr] Optimize stelem_ref and slowpath casts
mono_object_isinst_checked uses coop handles and is very slow. Attempt to use the straightforward mono_class_is_assignable_from_checked.
Makes stelem_ref 5x faster.
Commit migrated from https://github.com/mono/mono/commit/
768fefbad1e3835c3be09828c9c43f2964079f65
Egor Bogatov [Fri, 25 Oct 2019 14:10:57 +0000 (17:10 +0300)]
[llvm] Use -place-safepoints in JIT mode too (mono/mono#17116)
* always use -place-safepoints pass in JIT mode
* ignore loaded llvm
* remove gc.safepoint_poll after optimizations
* fix typo
* cleanup
* cleanup
* cleanup
* cleanup
* Do not emit safepoints on entry thus simple functions (without calls and loops) won't have them at all
* Undo -spp-no-entry=true
* fix failing tests
* do not emit sp in Allocators
Commit migrated from https://github.com/mono/mono/commit/
dc4a7f5ed7094a586cee28c4f9987c40b4f2cea5
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