Alexander Köplinger [Mon, 19 Aug 2019 09:23:23 +0000 (11:23 +0200)]
thread names: coop, constants, usually ignore-error. (mono/mono#16272)
- Convert setting thread name to be coop-compatible.
- For constant thread names, just retain the constant, not a copy.
This includes producing and using constant unicode thread names on Windows.
- Make setting a thread name often non-fatal, except where mandated by public API.
- From earlier PR: mono_free (mono-publib.c) would no longer be referenced and therefore
no longer exported. That broke profilers and maybe other externals.
Choices:
1 Use it instead of g_free randomly sometimes.
2 Call it randomly sometimes.
3 include it in external-only.c or object.c
4 Mark it external only (breaks profiler).
5 Use a .def file or Unix equivalent.
5 is best, 2 is done here, the advantages/disadvantages
among most choices are subtle. 3 is probably better than 2
but is slightly bigger change, to put off -- you'd stop
compiling mono-publib.c and move it to include/extra_redist.
The advantage of not-.def file is perhaps that it is exposed
by the compiler, so maybe easy to port and work with.
People are more comfortable with obscure C extensions than
any linker options, and there are multiple linkers to contend
with. Arguably there are fewer compilers.
Commit migrated from https://github.com/mono/mono/commit/
9001c4fa83aa2327038627e9f003ce9432a8e8d5
Jay Krell [Mon, 19 Aug 2019 09:20:37 +0000 (02:20 -0700)]
Reduce size of internal MonoErrors by 3 pointers, while trying to be compatible with old size.(mono/mono#16218)
There is an incompatibility here.
If Mono hands off an InternalError and it is accessed
like an ExternalError, like memset(sizeof()), bad.
Hopefully nobody does that.
There is also compatability -- embedders can continue to embed MonoError
in their own data. Its size and hopefully alignment is unchanged.
Commit migrated from https://github.com/mono/mono/commit/
cf0ce4f55ad92529bf969bef1cbf5cc6a502fdef
Jay Krell [Mon, 19 Aug 2019 09:19:10 +0000 (02:19 -0700)]
[interp] Replace frame.args with frame.stack, the same except for type (mono/mono#16316)
Contributes to mono/mono#16172.
Commit migrated from https://github.com/mono/mono/commit/
047c7d35faa441e9d73364b681e5826a7c00051f
Vlad Brezae [Mon, 19 Aug 2019 08:59:21 +0000 (11:59 +0300)]
[interp] Make sure we allocate stack for MINT_LD_DELEGATE_INVOKE_IMPL (mono/mono#16224)
* [interp] Make sure we allocate stack for MINT_LD_DELEGATE_INVOKE_IMPL
This opcode is pushing a function pointer from the delegate, so it needs to have stack reserved.
* [interp] Fix overflow of stack space
Commit migrated from https://github.com/mono/mono/commit/
975b543e92e296db338ac699c8d87c46f1fbbe42
Jay Krell [Mon, 19 Aug 2019 03:22:06 +0000 (20:22 -0700)]
warning: mono-threads-wasm.c no previous prototype for function mono_background_exec (mono/mono#16289)
Commit migrated from https://github.com/mono/mono/commit/
cecea63691e412e0363de91a9bea594caf1ae2cc
Jay Krell [Sun, 18 Aug 2019 14:36:33 +0000 (07:36 -0700)]
[interp] Reduce register/stack pressure slightly. (mono/mono#16303)
No savings on Linux/amd64/gcc/clang.
Commit migrated from https://github.com/mono/mono/commit/
d1f47e7b48826abd41eaab5c492f41cf4d22ac3f
Zoltan Varga [Sat, 17 Aug 2019 16:22:07 +0000 (12:22 -0400)]
Merge pull request mono/mono#16210 from EgorBo/opt-llvm-jit
Auto-detect current cpu in LLVM JIT
Commit migrated from https://github.com/mono/mono/commit/
13fb0134a0d924a0d140e186bac83eb6ee40f8f9
Jay Krell [Thu, 25 Jul 2019 10:19:02 +0000 (03:19 -0700)]
thread names: coop, constants, usually ignore-error.
- Convert setting thread name to be coop-compatible.
- For constant thread names, just retain the constant, not a copy.
This includes producing and using constant unicode thread names on Windows.
- Make setting a thread name often non-fatal, except where mandated by public API.
- From earlier PR: mono_free (mono-publib.c) would no longer be referenced and therefore
no longer exported. That broke profilers and maybe other externals.
Choices:
1 Use it instead of g_free randomly sometimes.
2 Call it randomly sometimes.
3 include it in external-only.c or object.c
4 Mark it external only (breaks profiler).
5 Use a .def file or Unix equivalent.
5 is best, 2 is done here, the advantages/disadvantages
among most choices are subtle. 3 is probably better than 2
but is slightly bigger change, to put off -- you'd stop
compiling mono-publib.c and move it to include/extra_redist.
The advantage of not-.def file is perhaps that it is exposed
by the compiler, so maybe easy to port and work with.
People are more comfortable with obscure C extensions than
any linker options, and there are multiple linkers to contend
with. Arguably there are fewer compilers.
Commit migrated from https://github.com/mono/mono/commit/
0c6cb9fbc3f97e15acf6be07eb46c19a288b3937
Jay Krell [Fri, 16 Aug 2019 21:16:03 +0000 (14:16 -0700)]
[Coop] Convert mono_attach_load_agent. (mono/mono#15954)
Based on https://github.com/mono/mono/pull/15868.
Most cleanup and leak fixes moved and expanded to https://github.com/mono/mono/pull/15950.
Commit migrated from https://github.com/mono/mono/commit/
16a81cf520d82a9e4c0ff10654a627e55dc51b58
Ryan Lucia [Fri, 16 Aug 2019 20:54:47 +0000 (16:54 -0400)]
[netcore] Enable netcore resolution logic for mono_assembly_byname_lookup (mono/mono#16256)
* Use netcore_load_reference in mono_assembly_request_byname
* Add ALC static Resolve event code from CoreCLR
* Wire up the AssemblyResolve event
* Enable newly passing test
* Set requesting assembly in InternalLoad
* Remove infinite recursion
* Only call netcore_load_reference from mono_assembly_request_byname
* Remove test completely
Commit migrated from https://github.com/mono/mono/commit/
1e457cdd1e5b1efc8860ab58a9fb7a00c82bc0c2
Jay Krell [Fri, 16 Aug 2019 13:33:04 +0000 (06:33 -0700)]
Ignore NULL in mono_marshal_free_dynamic_wrappers and mono_free_method. (mono/mono#14150)
Commit migrated from https://github.com/mono/mono/commit/
e54f03168d223debdab1717eb24055662211e4f8
Jay Krell [Fri, 16 Aug 2019 13:32:48 +0000 (06:32 -0700)]
Fill in more MONO_PATCH_INFO_NONE support. (mono/mono#13990)
Commit migrated from https://github.com/mono/mono/commit/
66afab580309acb23a5ed022a2e424c400907c65
Jay Krell [Fri, 16 Aug 2019 13:32:07 +0000 (06:32 -0700)]
[interp] Localize c, i32, o as suggested. (mono/mono#16268)
This saves 16 stack bytes for clang, gcc is unmoved probably figured it out on its own.
Commit migrated from https://github.com/mono/mono/commit/
f52bfb94d514d65d1a1532d2956b4099266da607
Jay Krell [Fri, 16 Aug 2019 13:26:49 +0000 (06:26 -0700)]
[interp] Fix more MonoError reuse (mono_object_new_checked). (mono/mono#16263)
* [interp] Fix more MonoError reuse (mono_object_new_checked).
* Inline mono_interp_new/mono_object_new_checked now that we are in outlined mono_interp_newobj.
Commit migrated from https://github.com/mono/mono/commit/
4d9e6ae20e536394c9ff65c61238045db294c08e
Steve Pfister [Fri, 16 Aug 2019 11:52:22 +0000 (07:52 -0400)]
[corlib] Fix sharing mode validation rules (mono/mono#16247)
Fixes https://github.com/mono/mono/issues/16032
When we switched to corefx File.Copy on unix, the behavior changed where it opened a source and destination stream in order to pass the safe handles to Interop.Sys.CopyFile. This exposed a flaw in our sharing validation rules in MonoIO.Open, which threw an exception in this scenario:
new FileStream("source.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, 2048, FileOptions.DeleteOnClose);
new FileStream("source.txt", FileMode.Open, FileAccess.Read, FileShare.Read, 2048, FileOptions.None);
Simplified the FileShare check down to:
1. If the caller specifies FileShare.None, then it's an exclusive lock and no
sharing is allowed.
2. If the caller specifies some other FileShare option, then FileShare.None
cannot be specified.
Commit migrated from https://github.com/mono/mono/commit/
da2c0159e9736ebb7f6d8fbe1ebc8671e4cab7e7
Egor Bogatov [Fri, 16 Aug 2019 10:43:08 +0000 (13:43 +0300)]
[netcore] Add patch-local-dotnet-aot-llvm rule (mono/mono#16120)
* Add patch-local-dotnet-aot-llvm rule
* Update Makefile
* Add run-sample-local-dotnet-llvm
Commit migrated from https://github.com/mono/mono/commit/
4dca4f66197fa118b02593b54f79570367ab46d2
Jay Krell [Fri, 16 Aug 2019 08:37:20 +0000 (01:37 -0700)]
intepreter: remove last element from various arrays (mono/mono#16134)
add const
combine lines for searchability
Commit migrated from https://github.com/mono/mono/commit/
0c637a73a9663bf6ca984037c4a5eac16ac91913
Jay Krell [Fri, 16 Aug 2019 07:13:22 +0000 (00:13 -0700)]
[interp] Fully outline enum_hasflag to save stack. (mono/mono#16228)
Alternative to https://github.com/mono/mono/pull/16197.
If you are going outline, you sometimes might as well take it all with you
instead of bouncing back and forth for a partial inlining.
Commit migrated from https://github.com/mono/mono/commit/
35fc20b6375b338f8b9965fecfebb5e815e42c55
Zoltan Varga [Fri, 16 Aug 2019 03:48:35 +0000 (23:48 -0400)]
Merge pull request mono/mono#16261 from vargaz/tp-no-random
[runtime] Use a PRNG in the threadpool instead of the os random number generator.
Commit migrated from https://github.com/mono/mono/commit/
5461fb78c745ab48cb97f8b7c65a08632f725102
Zoltan Varga [Fri, 16 Aug 2019 01:59:42 +0000 (21:59 -0400)]
Merge pull request mono/mono#16257 from EgorBo/llvm-ptr
Align C# pointers with LLVM pointers for primitive types
Commit migrated from https://github.com/mono/mono/commit/
764091677eb717da8cf5799c2b625fd529c3e93a
Jay Krell [Thu, 15 Aug 2019 22:14:37 +0000 (15:14 -0700)]
[mini] Cleanup alloca: call twice instead of once, and shrink allocation slightly. (mono/mono#16158)
It is an actual function call at least on Windows.
Commit migrated from https://github.com/mono/mono/commit/
6c05cfab5996387321164d84c267d3100b6bfb66
Jay Krell [Thu, 15 Aug 2019 22:06:50 +0000 (15:06 -0700)]
[interp] Fix more MonoError reuse. (mono/mono#16262)
Commit migrated from https://github.com/mono/mono/commit/
b654aa1ca858666539a677e96d00f594fd81c630
Jay Krell [Thu, 15 Aug 2019 21:56:33 +0000 (14:56 -0700)]
[Coop] Convert emit_invoke_call. (mono/mono#15964)
Removing calls to mono_string_new_checked.
Extracted from https://github.com/mono/mono/pull/15900.
Commit migrated from https://github.com/mono/mono/commit/
dfbf1a1bd3a792997461f8a43bdb6b5bf7738382
Jay Krell [Thu, 15 Aug 2019 21:48:18 +0000 (14:48 -0700)]
Wrap more external-only functions in GC mode transitions. (mono/mono#15895)
mono_compile_method
mono_runtime_set_main_args
mono_runtime_run_main
mono_runtime_exec_managed_code
mono_load_remote_field
mono_load_remote_field_new
mono_store_remote_field
mono_store_remote_field_new
Commit migrated from https://github.com/mono/mono/commit/
44ff0597b835d0af62f526169dba3b365c9c3411
Zoltan Varga [Thu, 15 Aug 2019 19:46:00 +0000 (15:46 -0400)]
Llvm optimizations (mono/mono#16191)
* [jit] Disable inlining for ThrowHelper methods for non-netcore as well. Add an OP_NOT_REACHED after calls to these methods to let LLVM know they don't return.
* [llvm] Use the cold calling convention instead of the preserveall one, it has the same effect and its better supported.
* [llvm] Call the aot init function using the cold cconv.
* [llvm] Make the condition in the poll function unlikely.
* [llvm] Add a wrapper around the GC poll icall so it can be called with a cold calling convention.
* Move the noreturn check before the code which is shared with calli.
Commit migrated from https://github.com/mono/mono/commit/
870aec4aadfd8b523b62070137643b0cc3a97399
Jo Shields [Thu, 15 Aug 2019 17:56:04 +0000 (13:56 -0400)]
Add missing FCONV_TO_U8 on ILP32 (WatchOS 5) (mono/mono#16276)
Commit migrated from https://github.com/mono/mono/commit/
4ec4d7a3b3b8784a28551b192b01446aaff617a4
Jay Krell [Thu, 15 Aug 2019 17:37:34 +0000 (10:37 -0700)]
Retain thread names as UTF8 instead of only UTF16. (mono/mono#15945)
Windows can still have its Unicode thread names, since we have UTF16 initially, just don't retain it.
This does penalize ves_icall_System_Threading_Thread_GetName_internal (non-netcore only),
which has to convert back to UTF16 each time.
But seems like a net win overall.
There is also a little prep work here for constant thread names and some temporary measures as multiple changes head toward the same code.
Rename `mono_thread_set_name_internal` to `mono_thread_set_name`.
Close possible race conditions.
Extracted from https://github.com/mono/mono/pull/15859.
Commit migrated from https://github.com/mono/mono/commit/
7b64f1cd005ef4f8e7f0aa5655debca2754b1755
Jay Krell [Thu, 15 Aug 2019 17:23:24 +0000 (10:23 -0700)]
[interp] Outline newobj and newobj_vt. (mono/mono#16267)
In this variation, the exception handling and resume are split between the main function and the helper function, and no address-taken occurs on ip/sp/vt_sp.
The order is a little tangled but convincing.
The helper function returns MonoException* or checks context->has_resume_state and then returns, and then the caller does the checks again.
Based on past analysis this will conserve stack, but that was not double checked here.
i.e. due to `&valuetype_this`, though it is conditional and the code could be split up into inline and outline.
Commit migrated from https://github.com/mono/mono/commit/
f35c755fea61f679a000cbf31b7249e0e320b689
Jo Shields [Thu, 15 Aug 2019 14:37:04 +0000 (10:37 -0400)]
Fix failing OSX Android lane (mono/mono#16274)
Linker order matters when using .a files, so zlib.a MUST come after
sgen.a if sgen.a was compiled with support for compressed ppdb
Commit migrated from https://github.com/mono/mono/commit/
dd6bd568a0067a1206e9460017d2f4edb63f2c32
Vlad Brezae [Thu, 15 Aug 2019 11:57:26 +0000 (14:57 +0300)]
[exceptions] Don't debug hang on ThreadAbortException (mono/mono#16240)
It is pretty much useless.
Commit migrated from https://github.com/mono/mono/commit/
6fc089bf8b253df82a04822f7a34bf0c8c59ab52
Jay Krell [Thu, 15 Aug 2019 08:56:38 +0000 (01:56 -0700)]
Reduce redundant setting of thread name. (mono/mono#16253)
Maintain a counter and only set if the counter has changed.
This cannot be fully thread safe, so is not.
Any thread can set any other thread name at any time.
You could be atomic to do better, and loop to do even better,
but the thread name could still be changed again right after the loop exists.
The previous code was also not reliable in this way, since again the name
could be changed right away.
mono/mono#16248
Commit migrated from https://github.com/mono/mono/commit/
63e1828f7e1c9694f34fd7189df6abc5cde1f192
Jay Krell [Thu, 15 Aug 2019 08:42:12 +0000 (01:42 -0700)]
[interp] [wasm] p vs. o on newobj (mono/mono#16264)
Commit migrated from https://github.com/mono/mono/commit/
5ec452666ad4c8a5d9cbab1c78b83789fc1f224f
Jay Krell [Thu, 15 Aug 2019 08:41:49 +0000 (01:41 -0700)]
[interp] Fix some, not all, of the error management. (mono/mono#16232)
From mono/mono#16190.
Commit migrated from https://github.com/mono/mono/commit/
fd4956fbf277ec56a13137e01b48efb98a5556f5
Jay Krell [Thu, 15 Aug 2019 08:39:45 +0000 (01:39 -0700)]
[interp] Short-circuit MINT_STELEM_REF on NULL. (mono/mono#16229)
Presumably this is not a useful semantic change,
to skip those functions, given NULL.
(We will probably want to outline all of this also, later).
Commit migrated from https://github.com/mono/mono/commit/
7766f9b9262701d98eb79758e24d29aab614cc65
Jay Krell [Thu, 15 Aug 2019 08:39:27 +0000 (01:39 -0700)]
[interp] Compute locals later to reduce register/stack pressure and conserve stack. (mono/mono#16231)
i.e. do not def before a function call and use after, do both after.
Commit migrated from https://github.com/mono/mono/commit/
fc724e6cf0c690b8c40ccfe12b0d2316747b1142
Jay Krell [Thu, 15 Aug 2019 08:39:03 +0000 (01:39 -0700)]
[interp] Split leave into pieces, partially outlined, to conserve stack, (mono/mono#16213)
but without changing how exception handling macros access labels and locals.
This saves 16 bytes of stack on Linux/amd64/gcc and likely similar everywhere,
as it takes an address-taken local out of interp_exec_method_full (stackval tmp_sp).
See
https://github.com/mono/mono/pull/16171
https://github.com/mono/mono/pull/16171/commits/mono/mono@
a6a8f0d5ffa875da9cda63444e401c37810a690f for a
full outlining.
Commit migrated from https://github.com/mono/mono/commit/
dde3452690d2836d790054faaf719a958cee7bb8
Nikolay Sivov [Wed, 14 Aug 2019 21:55:54 +0000 (00:55 +0300)]
[cominterop] Fix copy-paste error in ComVisibleAttribute testing helper.
This type was introduced with mono/mono@
29a95bafd87830c430432546af4bf7076ba5542f.
Commit migrated from https://github.com/mono/mono/commit/
5b66d3d5187906d708fd9c22e67e5581f117bb37
Thays Grazia [Wed, 14 Aug 2019 22:51:42 +0000 (19:51 -0300)]
Enable and document debug with sdb with netcore config.
Commit migrated from https://github.com/mono/mono/commit/
dcfec3966c027c4a9411b34138a530839b2b9889
Zoltan Varga [Wed, 14 Aug 2019 23:45:27 +0000 (19:45 -0400)]
[runtime] Use a PRNG in the threadpool instead of the os random number generator, its good enough, and its much faster.
Commit migrated from https://github.com/mono/mono/commit/
928aab1b841bb92d0eace058d4860be63ef3d76a
Egor Bogatov [Wed, 14 Aug 2019 23:39:13 +0000 (02:39 +0300)]
address feedback
Commit migrated from https://github.com/mono/mono/commit/
93eceec724659e85c12e165793926e705a44f761
Jay Krell [Wed, 14 Aug 2019 23:07:56 +0000 (16:07 -0700)]
Remove ampersand from cfg->error per old agreement. (mono/mono#16219)
Commit migrated from https://github.com/mono/mono/commit/
2463605f01643e21753cb73874ae683457280d77
Egor Bogatov [Wed, 14 Aug 2019 22:38:58 +0000 (01:38 +0300)]
handle primitive pointers in llvm
Commit migrated from https://github.com/mono/mono/commit/
ed4be03b79b4337a33c688e0c9368af23ab9ed37
Vlad Brezae [Wed, 14 Aug 2019 21:18:45 +0000 (00:18 +0300)]
[interp] Fix icall signature (mono/mono#16227)
Commit migrated from https://github.com/mono/mono/commit/
4e793ad30c24b30097ba3e9865799b6d9e7e0390
Jo Shields [Wed, 14 Aug 2019 20:58:07 +0000 (16:58 -0400)]
Fix linking of OS-provided zlib (mono/mono#16177)
* Fix linking of OS-provided zlib
This is a reduced version of https://github.com/mono/mono/pull/16091
without the Z_PREFIX stuff
* Get rid of HAVE_ZLIB, be explicit about HAVE_SYS_ZLIB vs HAVE_STATIC_ZLIB
* Proposed fixes from Alex
Commit migrated from https://github.com/mono/mono/commit/
f2d813c90df3a6c4d15eab240b0a68ec055c8f5b
Aleksey Kliger (λgeek) [Wed, 14 Aug 2019 19:07:26 +0000 (15:07 -0400)]
[metadata] Create strongly typed versions of mono_assembly_request_prepare (mono/mono#16094)
* [metadata] Create strongly typed versions of mono_assembly_request_prepare
Addresses the family of issues similar to Coverity mono/mono#1443346.
This came up as part of the Coverity review, and Coverity notices that this is
writting beyond the end of the structure. While this is correct, this requires
that the idiom be properly followed - that is, that the structure being passed
is of the given size.
Replaced instead with a method that eliminates the room for error with methods
that will initialize the whole structure, and the actual size computation is
done inside the method with the proper type sizes.
While I used methods, I feel that this should use macros.
Commit migrated from https://github.com/mono/mono/commit/
ce92c4376f31e9caf964938a3899d179bdc97e51
Egor Bogatov [Wed, 14 Aug 2019 10:59:00 +0000 (13:59 +0300)]
ignore stacktrace tests
Commit migrated from https://github.com/mono/mono/commit/
abb43f9361192c26ce2355a1f254852efd07abbf
Jay Krell [Wed, 14 Aug 2019 10:34:54 +0000 (03:34 -0700)]
[interp] Reduce frame size by partially outlining load remote field. (mono/mono#16196)
Extracted from https://github.com/mono/mono/pull/16171.
Ultimately over 100 bytes can be saved.
Tactically not outlined or indirected:
vt_sp change
ip advancement
error handling
Also partially fixes the error reuse from https://github.com/mono/mono/pull/16190.
Commit migrated from https://github.com/mono/mono/commit/
d1c0974e46bf0edd5f337e72b6032e903d90b703
Jay Krell [Wed, 14 Aug 2019 10:33:58 +0000 (03:33 -0700)]
Make small_id_mutex not recursive. (mono/mono#15485)
(Later non-recursive Windows mutexes should be SRWLOCK and only statically initialized.)
Commit migrated from https://github.com/mono/mono/commit/
60ac98ee29d267646629bc39558f44e4e5af8b4e
Jay Krell [Wed, 14 Aug 2019 10:28:00 +0000 (03:28 -0700)]
Use ERROR_DECL. (mono/mono#16220)
Commit migrated from https://github.com/mono/mono/commit/
8c5d0a790e4677150c71fc58949f0420e1a50cf1
Jay Krell [Wed, 14 Aug 2019 10:27:22 +0000 (03:27 -0700)]
[interp] Remove address-taking of vt_sp. (mono/mono#16215)
Theoretically could help reduce frame size but it has not been seen to.
Commit migrated from https://github.com/mono/mono/commit/
74b0d01e07c01d0bbc40c2b80ca4d007b037270a
Jay Krell [Wed, 14 Aug 2019 10:25:44 +0000 (03:25 -0700)]
[interp] Outline `mono_interp_calli_nat_dynamic_pinvoke` to reduce stack. (mono/mono#16201)
Now that we have that function, also change from malloc to alloca.
This is part of mono/mono#16171 and ultimately over 100 bytes were saved.
Commit migrated from https://github.com/mono/mono/commit/
4c17442dc31553109a8792e0f6d32221392d798c
Jay Krell [Wed, 14 Aug 2019 10:24:50 +0000 (03:24 -0700)]
Completely replace mono_error_ok with is_ok and make first external_only. (mono/mono#16217)
Commit migrated from https://github.com/mono/mono/commit/
136205ab45ca3fe01c49a321103e1563885c8da1
Jay Krell [Wed, 14 Aug 2019 10:22:40 +0000 (03:22 -0700)]
Skip degenerate qsort: num < 2, size == 0, base == 0 (mono/mono#16016)
Fixes https://github.com/mono/mono/issues/15994
Some is redundant for some qsort implementations.
Commit migrated from https://github.com/mono/mono/commit/
12de10007cf9a2973452c9cf2df36692808fefb6
Jay Krell [Wed, 14 Aug 2019 10:19:08 +0000 (03:19 -0700)]
Fix warning LNK4221 warning in assembly-load-context.obj (mono/mono#16004)
LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
Commit migrated from https://github.com/mono/mono/commit/
6873d5370d78c2385aa5a1782fed5fc9bd7d36f4
Jay Krell [Wed, 14 Aug 2019 10:17:23 +0000 (03:17 -0700)]
[interp] Outline `get_virtual_method_fast` to save 16 bytes of stack. (mono/mono#16198)
Ultimately over 100 bytes are savable in a few steps.
Commit migrated from https://github.com/mono/mono/commit/
9123ac0197071f084f463899f082e44cd5722e08
Jay Krell [Wed, 14 Aug 2019 10:17:01 +0000 (03:17 -0700)]
[interp] Outline `set_resume_state` to conserve stack in main interpreter loop (mono/mono#16200)
This is not intuitive but I definitely saw it.
Commit migrated from https://github.com/mono/mono/commit/
dbf13301c8bb48982da0a1021619631d1c52c0db
Thays Grazia [Wed, 14 Aug 2019 01:47:28 +0000 (22:47 -0300)]
[debugger] Debugger tries to execute a single step when the thread is already terminated (mono/mono#16208)
* Debugger tries to execute a single step when the thread is already terminated.
* Fixing how to get thread tls.
Commit migrated from https://github.com/mono/mono/commit/
f812d90fa1b62590169f9d12e4aae76ea76b1387
Egor Bogatov [Tue, 13 Aug 2019 19:24:54 +0000 (22:24 +0300)]
auto-detect cpu in llvm jit
Commit migrated from https://github.com/mono/mono/commit/
6c514405387e6c47eb064ac922492d784f644ed7
Aleksey Kliger (λgeek) [Tue, 13 Aug 2019 19:16:05 +0000 (15:16 -0400)]
[runtime] Initialize thread suspend policy at startup, inline getter (mono/mono#16149)
* [runtime] Initialize thread suspend policy at startup, inline getter
On some benchmarks we saw mono_threads_suspend_policy() using a lot of CPU
time.
Rather than doing an init-on-first-use, initialize the policy once upfront when
the JIT it starting up and make the getter method static inline.
* move mono_threads_suspend_policy_init into mono_thread_info_init
* [mini] Initialize suspend policy for `mono --version`
Need to initialize the suspend policy before printing its name. Otherwise the
suspend policy is unset since no other runtime initialization is done for `--version`.
Commit migrated from https://github.com/mono/mono/commit/
592de53a1f687d115fef86978e56a7fe7b4340c2
Alexander Köplinger [Tue, 13 Aug 2019 14:41:03 +0000 (16:41 +0200)]
[netcore] Cleanup System.Private.CoreLib.csproj (mono/mono#16199)
- The eng/Versions.props was already imported by the arcade targets causing a double-import warning:
> warning MSB4011: "/Users/alexander/dev/mono/eng/Versions.props" cannot be imported again. It was already imported at "/Users/alexander/.nuget/packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.19379.1/tools/DefaultVersions.props (17,3)". This is most likely a build authoring error. This subsequent import will be ignored.
- Remove BaseAddress and TRACE from the project file, this was done upstream at https://github.com/dotnet/coreclr/commit/mono/mono@
bc430cdd2010bf7790854a60380d00c506c346a6
- Remove unecessary DebugSymbols/DebugType settings, we already set them in the global PropertyGroup
Commit migrated from https://github.com/mono/mono/commit/
ff77b427f4f0c9ef7f926a302564ee239619e471
Aleksey Kliger (λgeek) [Tue, 13 Aug 2019 13:31:31 +0000 (09:31 -0400)]
[sre] Outline typebuilder_setup_fields loop body (mono/mono#16184)
The loop body uses coop handles, so wrap it in HANDLE_FUNCTION_ENTER/HANDLE_FUNCTION_RETURN
Commit migrated from https://github.com/mono/mono/commit/
1f4ac5d767570b5c4c73ce75b6c9c49bfcb5fc56
Jay Krell [Tue, 13 Aug 2019 13:30:28 +0000 (06:30 -0700)]
[interp] Replace `mono_error_ok` with `is_ok`. (mono/mono#16193)
The locally unknown function, despite being small/fast, forces saving values in stack and nonvolatile registers
around calling it.
Both nonvolatile registers and stack are at a premium here, whereas usually stack is cheap.
The macro is just a read from offset 0 and checking for zero.
Commit migrated from https://github.com/mono/mono/commit/
ef199425a2867b20695cb1c4e6df4b699dd8891a
Egor Bogatov [Mon, 12 Aug 2019 19:57:47 +0000 (22:57 +0300)]
[netcore] decimal should have alignment=8 (mono/mono#15666)
* Fix System.Runtime.InteropServices tests
* Update marshal.c
* Update marshal.c
* Update marshal.c
Commit migrated from https://github.com/mono/mono/commit/
c36f0a126ecb41ba44bb57e098cb6cece8124d68
Zoltan Varga [Mon, 12 Aug 2019 18:44:54 +0000 (14:44 -0400)]
Merge pull request mono/mono#16151 from spouliot/ios-intr-enable-sre
[sdk] Enable the SRE runtime code inside iOS builds
Commit migrated from https://github.com/mono/mono/commit/
5bc4944bf09ccf0a56a28c8e5a957d6001f51063
Aleksey Kliger (λgeek) [Mon, 12 Aug 2019 17:09:59 +0000 (13:09 -0400)]
[interp] Fix stub_get_resume_state write to out parameter (mono/mono#16145)
Addresses Coverity CID 1452245
Commit migrated from https://github.com/mono/mono/commit/
ad64c781eba4e9fcbf104a64828cdf7fc1d910a3
Ryan Lucia [Mon, 12 Aug 2019 15:46:12 +0000 (11:46 -0400)]
[netcore] Pass MONO_ASMCTX_LOADFROM on LoadFrom calls (mono/mono#16075)
Commit migrated from https://github.com/mono/mono/commit/
cadd114f6435e732d532733cd92db49c11fabc6c
Ankit Jain [Mon, 12 Aug 2019 15:03:13 +0000 (11:03 -0400)]
[msbuild] Bump to track xplat-master and update roslyn (mono/mono#16155)
Prompted by mono/msbuildmono/mono#126:
This includes:
- merge mono-2019-06
- SDK update to track dotnet release/3.0.100-preview8
- Roslyn updated to 3.3.0-beta2-19381-14
Commit migrated from https://github.com/mono/mono/commit/
c028454befe4ab6f9bf59f90e4136fc197014216
Aleksey Kliger (λgeek) [Mon, 12 Aug 2019 13:50:58 +0000 (09:50 -0400)]
[debugger] Cleanup MonoError on in isFixedSizeArray (mono/mono#16146)
Cleanup MonoError on error paths. Also change `return FALSE` to `return 0`.
Addresses Coverity CID 1452205
Commit migrated from https://github.com/mono/mono/commit/
dd3f6e0d31a055f616e42561383e0365c8fc6e4c
Nikolay Sivov [Mon, 12 Aug 2019 10:42:59 +0000 (13:42 +0300)]
[mono] Fix some compiler warnings (mono/mono#16159)
* [mini] Remove unused variables.
* [mini] Remove unused function.
Single call site is conditionally compiled.
* [sgen] Remove unused variable.
* [utils] Fix misleading indentation warnings.
Commit migrated from https://github.com/mono/mono/commit/
612e0644b6a183d15e66a3761d995b5f8b837d4b
Jay Krell [Mon, 12 Aug 2019 10:35:30 +0000 (03:35 -0700)]
[remoting+interp] [remoting+debugger] Fix use of dangling local. (mono/mono#16173)
Commit migrated from https://github.com/mono/mono/commit/
c70b4cc3cc8ef19b9b5c25a96ad23421d1b65175
Jay Krell [Mon, 12 Aug 2019 10:34:46 +0000 (03:34 -0700)]
[interp] Remove unnecessary loops, that optimizer might handle. (mono/mono#16169)
Commit migrated from https://github.com/mono/mono/commit/
4e5544f02de02eb72df30c3a94cc650c3768ad0d
Vincent Povirk [Mon, 12 Aug 2019 10:05:05 +0000 (05:05 -0500)]
[w32process-win32] Don't duplicate CreateProcess search logic. (mono/mono#16156)
When given a null application name, CreateProcess already
searches the path and appends .exe in some cases. .NET's
Process class behaves in the same way (see
https://github.com/mono/mono/pull/16089#issuecomment-
519984244).
The duplicated logic is unnecessary and broken in several ways.
Failures are ignored and the command line arguments are
executed. Relative paths are expected not to end in "exe".
Many corner cases work differently from .NET and CreateProcess.
This change makes it impossible for process_complete_path to fail,
so I removed the gboolean return and pulled out the output
parameter. Its caller wasn't handling the return value correctly
anyway.
Commit migrated from https://github.com/mono/mono/commit/
7413bb84ec909502d922cb0b45d8d998f7e5d259
Zoltan Varga [Mon, 12 Aug 2019 02:32:01 +0000 (22:32 -0400)]
Merge pull request mono/mono#16136 from EgorBo/fix-inlining
[netcore] Fix inlining
Commit migrated from https://github.com/mono/mono/commit/
835282004ca3f466f809a7440b7e79f189cc86cc
Vlad Brezae [Fri, 9 Aug 2019 17:28:30 +0000 (20:28 +0300)]
[interp] Fix overflow of execution stack (mono/mono#16115)
We were not tracking max_stack_height for a few opcodes.
Commit migrated from https://github.com/mono/mono/commit/
b52830cf1120bdeaf693080e22b3af87e3aef9e8
Zoltan Varga [Fri, 9 Aug 2019 16:58:01 +0000 (12:58 -0400)]
Merge pull request mono/mono#16139 from steveisok/run-single-ios-sdk-test
Added the option to run a single test in the iOS SDK
Commit migrated from https://github.com/mono/mono/commit/
54c07051a8f3c633dd9392bff4adb12a8b5f03cd
Ryan Lucia [Fri, 9 Aug 2019 15:44:50 +0000 (11:44 -0400)]
[netcore] Make mono_assembly_request_prepare take an ALC (mono/mono#16061)
* Make mono_assembly_request_prepare take an ALC
* Typo
* Fix pedump
* Use default ALC
* Make v1 preload hook external-only
* Convert pedump and monodis
* fixup: use default ALC in netcore preload hook
trusted platform assemblies should be loaded into the default ALC
Commit migrated from https://github.com/mono/mono/commit/
a1bb37cd52a15184fc6b5da4d680249132421c78
Alexander Köplinger [Wed, 7 Aug 2019 18:40:10 +0000 (20:40 +0200)]
[build] Remove ILDISASM variable from platform Makefiles
It was written by configure.ac to config.make and is unused anyway.
Commit migrated from https://github.com/mono/mono/commit/
f15fe47075a5981d20c8d3d7ccff5de1be97e502
Alexander Köplinger [Wed, 7 Aug 2019 18:23:25 +0000 (20:23 +0200)]
[build] Remove EXTERNAL_MCS setting in platform Makefiles
Setting an explicit mcs is no longer supported by the rest of the build scripts.
Commit migrated from https://github.com/mono/mono/commit/
8697b31082e5f21447e46c4cf4389ec950a645a3
Egor Bogatov [Fri, 9 Aug 2019 09:55:50 +0000 (12:55 +0300)]
fix inlining
Commit migrated from https://github.com/mono/mono/commit/
a7e428d82f3042960e42a638e26afe73b1381eda
Egor Bogatov [Thu, 8 Aug 2019 16:38:39 +0000 (19:38 +0300)]
Make System.Runtime.Intrinsics.X86.*.IsSupported intrinsic
Commit migrated from https://github.com/mono/mono/commit/
7deb53514dfd0c0662c2a8a95e019b9ec6244f3d
Egor Bogatov [Thu, 8 Aug 2019 15:29:53 +0000 (18:29 +0300)]
fix minor issues
Commit migrated from https://github.com/mono/mono/commit/
9442ed95d7b781fd2562f73bbd5f4fac326f32b2
Alexis Christoforides [Fri, 9 Aug 2019 07:31:57 +0000 (10:31 +0300)]
[merp] Use a separate program as the hang supervisor. (mono/mono#15715)
* [merp] Use a separate program as the hang supervisor.
Fixes https://github.com/mono/mono/issues/15646
macOS does not like signals being sent from the forked supervisor process, possibly towards anywhere but definitely when sent to the parent process. The following message is currently spewed after the supervisor process attempting to send a SIGSEGV to a hanged Mono process:
"The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec()."
We follow that direction and introduce a new binary that, when available in the mono executable's binary directory, is used to abort the parent process for us.
Commit migrated from https://github.com/mono/mono/commit/
2c4b60fe24bfbccb3fa1553aed1065ce072343e1
Ryan Lucia [Thu, 8 Aug 2019 22:07:54 +0000 (18:07 -0400)]
[netcore] Don't return REFERENCE_MISSING in netcore_load_reference
Commit migrated from https://github.com/mono/mono/commit/
6a459c25d771dec436bb6a8785c683f6b15fe6f7
Zoltan Varga [Fri, 9 Aug 2019 07:20:03 +0000 (03:20 -0400)]
Merge pull request mono/mono#16125 from vargaz/wasm-keep-config-cache
[wasm] Add a KEEP_CONFIG_CACHE option to Make.config to avoid deleting the autoconf cache file on make clean.
Commit migrated from https://github.com/mono/mono/commit/
e71604d695f57dc39a496509dddd99f898d39eb2
Alexander Köplinger [Thu, 8 Aug 2019 22:07:41 +0000 (00:07 +0200)]
[tests] Fix accessing field of MarshalByRefObject in remoting1.cs (mono/mono#16119)
We need to copy it to a local variable first.
This was exposed by a new Roslyn optimization for String.Concat (see https://github.com/dotnet/roslyn/issues/37830).
Commit migrated from https://github.com/mono/mono/commit/
ec35e146360962d49a26d628d2254c85c5322449
Aleksey Kliger (λgeek) [Thu, 8 Aug 2019 18:06:21 +0000 (14:06 -0400)]
[perfcounter] Define mono_perfcounter_foreach even if perfcounters are disabled. (mono/mono#16100)
Fixes netcore build on win32
Commit migrated from https://github.com/mono/mono/commit/
36af44e3be4a0f73586e886b96f86ee500f8ab32
imhameed [Thu, 8 Aug 2019 00:05:55 +0000 (17:05 -0700)]
[sdb][interp] Use the interpreter's resume state to compute the IL offset in compute_frame_info. (mono/mono#15936)
[sdb][interp] Use the interpreter's resume state to compute the IL offset in compute_frame_info.
This recovers the relevant bits of the "resume state" from the interpreter and uses that to recalculate the `il_offset` for the top frame.
Fixes https://github.com/mono/mono/issues/15687.
Commit migrated from https://github.com/mono/mono/commit/
fc4d234ef61bc3150be6a3d15e8e80a6bc9fbfa5
imhameed [Wed, 7 Aug 2019 19:15:55 +0000 (12:15 -0700)]
[llvm] Explicitly check for errors when calling LegacyIRCompileLayer::addModule. (mono/mono#16082)
[llvm] Explicitly check for errors when calling LegacyIRCompileLayer::addModule.
LLVM built with LLVM_ENABLE_ASSERTIONS=On will crash if errors are not
explicitly consumed.
Commit migrated from https://github.com/mono/mono/commit/
4462f10fb66e85b66d8d5497653fdbcd2775eb93
Ryan Lucia [Wed, 7 Aug 2019 18:17:19 +0000 (14:17 -0400)]
Relax locking (mono/mono#15986)
* Remove usage of loader lock
Originally added in https://github.com/mono/mono/commit/mono/mono@
c4cbd3b700eea52c84c68c9450d80357b3be681d but no longer relevant
* Make get_agent_domain_info lock-free and relax loader lock
* Syntax errors
* Undo first commit, other than the commit message
* Fixes
Commit migrated from https://github.com/mono/mono/commit/
aece3efc9939a22e970f0d30a654bfaece61aea0
Ryan Lucia [Tue, 6 Aug 2019 18:12:59 +0000 (14:12 -0400)]
[netcore] Re-enable IsAssignableFrom test
This was fixed a while back but never removed from the exclusions
Commit migrated from https://github.com/mono/mono/commit/
dcd57151613af34b213e0bd49de70e402d19cc47
Zoltan Varga [Wed, 7 Aug 2019 15:17:12 +0000 (11:17 -0400)]
Merge pull request mono/mono#16085 from kjpou1/wasm-sdk-v0.2.0
[wasm][sdk] Bump SDK Version 0.2.0
Commit migrated from https://github.com/mono/mono/commit/
d18daefdbc9fa6ad530f1d28642f305d308cc90a
Jay Krell [Wed, 7 Aug 2019 14:40:57 +0000 (07:40 -0700)]
There is no need to zero static data, and it is racy (mono/mono#15699)
if there are multiple threads calling (unlikely).
This zeroing was made moot by mono/mono@
470354fa817716739615ff0c6cfefca42ec8b385 January 2019.
Commit migrated from https://github.com/mono/mono/commit/
e8d28feb1e7a8cb0820704aee66410f4ae13c252
Thays Grazia [Wed, 7 Aug 2019 14:06:56 +0000 (11:06 -0300)]
Allow generating DIM bitcode (mono/mono#16070)
Commit migrated from https://github.com/mono/mono/commit/
e690fb0240027d95908f1d7ffa3d401b8d1167ba
Alexander Köplinger [Wed, 7 Aug 2019 13:54:09 +0000 (15:54 +0200)]
[utils] Move MAP_ANONYMOUS check after sys/mman.h import
The flag is defined in that header on OSX. Followup to mono/mono@
2abe569ede069f172c3213a49cfb07c39c5c58dc
Commit migrated from https://github.com/mono/mono/commit/
521d4c839555a9df6d0dcade229072c7b8b9ee21
Aleksey Kliger (λgeek) [Wed, 7 Aug 2019 13:42:39 +0000 (09:42 -0400)]
[w32socket] Translate ELOOP and ENAMETOOLONG (mono/mono#16039)
Translate to WSAELOOP and WSAENAMETOOLONG, respectively.
See https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
Addresses part of https://github.com/mono/mono/issues/16024
Commit migrated from https://github.com/mono/mono/commit/
aea457cdb3ea8217ef702e8a521e732f6f3e3693
Nikolay Sivov [Wed, 7 Aug 2019 13:05:44 +0000 (16:05 +0300)]
[trace] Improve enter/leave output formatting (mono/mono#16036)
* [trace] Use specific integer types for return value traces.
* [trace] Improve argument list formatting for ENTER lines.
Return value changes are especially visible for bools, where currently 4 bytes integers are printed.
Commit migrated from https://github.com/mono/mono/commit/
10c5e6407ec5f3f691cd65b4fe6591e05cb224aa
Nikolay Sivov [Wed, 7 Aug 2019 12:45:19 +0000 (15:45 +0300)]
[win32] Fix some compilation warnings (mono/mono#15956)
* [mini] Remove unused variable.
* [mini] Mark win32 exception handling functions static.
* [mini] Remove unused variable.
* [mini] Suppress unused function warning.
* [metadata] Fix unused function warning for Win32 build.
Commit migrated from https://github.com/mono/mono/commit/
d34381f72e0a04febdb6d6ea084377d0d635e15f
iamphi [Wed, 7 Aug 2019 12:42:57 +0000 (05:42 -0700)]
Fix compilation on OSX 10.9 (mono/mono#14411)
Found solution from:
https://github.com/eclipse/omr/issues/902#issuecomment-
288559044
Commit migrated from https://github.com/mono/mono/commit/
2abe569ede069f172c3213a49cfb07c39c5c58dc
Zoltan Varga [Wed, 7 Aug 2019 10:06:00 +0000 (06:06 -0400)]
[runtime] Fix an autoconf warning. (mono/mono#16078)
[runtime] Fix an autoconf warning.
<!--
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/
ba1c949a24594c65d9fca77fb13c3af09c54c16b
Vlad Brezae [Wed, 7 Aug 2019 09:47:41 +0000 (12:47 +0300)]
[interp] Fix DEBUG_INTERP build (mono/mono#16057)
Commit migrated from https://github.com/mono/mono/commit/
e702e8286fc3a7267fdd9eda572b0539446701cc