Aleksey Kliger (λgeek) [Sat, 5 Oct 2019 17:01:56 +0000 (13:01 -0400)]
[merp] Put thread into async context before running summarizer (mono/mono#17194)
Followup work for https://github.com/mono/mono/pull/17090
In order to get managed method info for unmanaged stacktraces, we call
mini_jit_info_table_find_ext which calls decode_exception_debug_info which may
allocate if it's not in async context.
Do the switch in mono_threads_summarize_execute so that non-supervising threads
all switch when they run the sigterm_signal_handler. mono_threads_summarize
already does it for the supervisor thread.
Fixes https://github.com/mono/mono/issues/17180
Commit migrated from https://github.com/mono/mono/commit/
cb52186661254bb17e809ccb753198e7e59c2d90
Aleksey Kliger (λgeek) [Sat, 5 Oct 2019 13:59:05 +0000 (09:59 -0400)]
[merp] exit_status is 0 if we ran the uploader successfully (mono/mono#17185)
Not 1 (TRUE)
Commit migrated from https://github.com/mono/mono/commit/
2f7fd4f03e464946ea752800ca06aa2676e9d75f
Marek Safar [Sat, 5 Oct 2019 07:16:00 +0000 (09:16 +0200)]
[System.Private.CoreLib] Fixes build
Commit migrated from https://github.com/mono/mono/commit/
fce0e64de9a96694d99f14069c7655ad429af01b
Ryan Lucia [Fri, 4 Oct 2019 17:41:56 +0000 (13:41 -0400)]
[reflection] Only duplicate MonoMarshalSpec strings for custom types (mono/mono#17175)
* [reflection] only duplicate MonoMarshalSpec strings for custom types
* Add test
Commit migrated from https://github.com/mono/mono/commit/
05217395db99f0d02a6737ed0491fa65db96632d
Egor Bogatov [Fri, 4 Oct 2019 15:27:01 +0000 (18:27 +0300)]
[llvm] Propogate --enable-llvm-asserts to llvm/build.mk (mono/mono#17149)
* fix Enable llvm asserts
* fix chmod
Commit migrated from https://github.com/mono/mono/commit/
26754eecff93d568f4531e31c7c1bce3202645b1
Vlad Brezae [Fri, 4 Oct 2019 11:20:52 +0000 (14:20 +0300)]
[interp] Improve copy propagation (mono/mono#17154)
* [interp] Refactor tracking of stack/local values
Previously we had just an InterpInst* inside StackContentInfo, which was representing the instruction that pushed a certain local/value on the stack. This makes many things awkward, since an instruction is logically different from a value, that a local or a stack slot have. If we clear an instruction, it doesn't necessarily mean that the value that the instruction produced can't be stored on stack or in a local.
This commit creates a new structure StackValue, which holds the value.
* [interp] Generalize contents of StackValue
StackValue contains an opcode and some data to enable reconstruction of the value. For example instead of doing a LDLOC for a local, we can see if the local has a known value and use it instead (this could be a LDLOC from another local, whose value was propagated, or in the future a LDC). This will make more sense when we also start to track constant values.
Also decouple MOVLOC instructions from the cprop pass. They serve no purpose there. They are useful though when we do deadce, since we currently don't know how to kill instructions that change the stack.
* [interp] Handle dup opcode during copy propagation
* [interp] Avoid losing track of stack values for some opcodes
For some opcodes, that access stack values below the top of the stack, we were assuming they pop everything and then push the stack back, in order to prevent optimizing away instructions that pushed some of these values, since the original instruction expects those values to reside on the stack. We handle these instruction separately and keep track of the values of the stack, so we can further propagate the stack values, even though we currently can't optimize away those instructions.
* [interp] Propagate values for ctor arguments
* [interp] MINT_CASTCLASS no longer clobbers top of stack
Commit migrated from https://github.com/mono/mono/commit/
d1b3ee2e3234657044bc5d0f4a9facf0fa06599c
Johan Lorensson [Fri, 4 Oct 2019 07:16:05 +0000 (09:16 +0200)]
Always do copy_stack_data on entering GC safe/unsafe mode. (mono/mono#17150)
Commit migrated from https://github.com/mono/mono/commit/
2aa7adb269c795b721a9fcbac98969efb5b4a006
Aleksey Kliger (λgeek) [Fri, 4 Oct 2019 05:17:49 +0000 (01:17 -0400)]
[merp] Don't overrun buffer in copy_summary_string_safe … (mono/mono#17176)
* [merp] Don't overrun buffer in copy_summary_string_safe
MonoFrameSummary:str_destr is an array of MONO_MAX_SUMMARY_NAME_LEN bytes, not
MONO_MAX_SUMMARY_NAME_LEN + 1 bytes.
Fixes Coverity CID 1454563
* [merp] Use g_strlcpy for copy_summary_string_safe
Fixes Coverity CID 1454563
We would sometimes write to MonoSummaryFrame:str_descr which is
MONO_MAX_SUMMARY_NAME_LEN bytes long at index MONO_MAX_SUMMARY_NAME_LEN which
is one past the end of the array.
* nit: rename confusing parameter names
old names were confusing - we were copying from 'out' to 'in'. Now we copy to
'dest' from 'src'
Commit migrated from https://github.com/mono/mono/commit/
ea2a460cf68b6d16a3b379842e91c0bdf942ca16
Vlad Brezae [Thu, 3 Oct 2019 19:29:55 +0000 (22:29 +0300)]
[arm] Fix fetching of method addresses (mono/mono#17099)
After https://github.com/mono/mono/commit/
9ff3b0d65ee4, in an aot image we can emit addresses either as bl offset (which uses 4 bytes) or as ldr pc, =<label>; <addr> (which uses 8 bytes). Before this commit we were dereferencing an instruction pointer, in get_call_table_entry, assuming 8 bytes per entry. This could overflow and crash if we used in fact only 4 bytes per entry. Fix this by including the entry size in the aot image.
Fixes random crashes on arm CI on full-aotmixed suite.
Commit migrated from https://github.com/mono/mono/commit/
8c1ef74bb125bf49d6b1e3f2e80ac235adb27bd8
dotnet-maestro[bot] [Thu, 3 Oct 2019 18:45:29 +0000 (20:45 +0200)]
[master] Update dependencies from dotnet/corefx (mono/mono#17166)
* Update dependencies from https://github.com/dotnet/corefx build
20191002.6
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19502.6
* Reenable libgdiplus/System.Drawing.Common tests
* Update dependencies from https://github.com/dotnet/corefx build
20191002.7
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19502.7
Commit migrated from https://github.com/mono/mono/commit/
06c3637681e4dc2d450c5f0296203493cc536387
Alexander Köplinger [Thu, 3 Oct 2019 16:45:14 +0000 (18:45 +0200)]
[netcore] Update .gitignore
Commit migrated from https://github.com/mono/mono/commit/
43ccc6c26b07fcd4ed41df6d70248c9c3d961e20
Alexander Köplinger [Thu, 3 Oct 2019 16:44:00 +0000 (18:44 +0200)]
[netcore] Move ignored test to global ignore file instead of the Linux-specific
It affects all platform
Commit migrated from https://github.com/mono/mono/commit/
5bf18642ff9ab89832505c66af9e7a5b5a743dd7
Sam Patel [Thu, 3 Oct 2019 14:43:45 +0000 (10:43 -0400)]
Merge pull request mono/mono#17105 from naricc/naricc/UnitializedArray-Comment
Add a comment explaining why GC.AllocateUninitializedArray is not an icall
Commit migrated from https://github.com/mono/mono/commit/
83a5343d125bfd874a70633419ef18f8dca28c55
Johan Lorensson [Thu, 3 Oct 2019 09:21:36 +0000 (11:21 +0200)]
Optional only build MSVC runtime using make file system on Windows. (mono/mono#16915)
* Build MSVC only runtime using make file system.
Add a new option to only build MSVC version of mono runtime and native
tools, --enable-msvc-only. In the past, --enable-msvc build both
mingw as well as MSVC runtime, this commit adds an option to only build
MSVC version of runtime and native tools using make file system.
Commit updates all native make file making sure mingw/gcc builds are
not done if --enable-msvc-only has been used. It also makes sure we
build and use MSVC based tools as part of build and tests.
Result will be a build without any mingw/gcc artifacts, but where all
existing make files still works with the MSVC build artifacts.
This commits is also preparing to switch the .NETCore build over to use
MSVC build runtime in order to get LLVM support, something that is
currently only supported on Windows MSVC build.
* Add link to mono-sgen.exe and clean windows binaries.
* Fix failures in mono/tests test-aot on Windows.
* Add fullaot-mixed tests on Windows x64.
* Run msbuild in parallel.
* Default to x64 mingw host on cygwin build.
Commit migrated from https://github.com/mono/mono/commit/
55be8289ff1601824707bb2ef9d554b01123f713
Nathan Ricci [Wed, 2 Oct 2019 17:14:48 +0000 (13:14 -0400)]
Spelling corrections.
Commit migrated from https://github.com/mono/mono/commit/
d0461a9d8d662cc686b841d186a0379e6fca8fc7
Jo Shields [Wed, 2 Oct 2019 14:46:42 +0000 (10:46 -0400)]
Fix missing corerun/ directory in `make dist` tarballs (mono/mono#17126)
```
configure.ac:6695: error: required file 'netcore/corerun/Makefile.in' not found
Makefile.am:24: error: required directory ./netcore/corerun does not exist
```
Commit migrated from https://github.com/mono/mono/commit/
d8040ba86520ae584f36628bd7eece1558970f41
Jay Krell [Wed, 2 Oct 2019 10:59:45 +0000 (03:59 -0700)]
Some external_only/internal split, and inlining. (mono/mono#17012)
mono_type_get_type
mono_type_get_signature
mono_type_is_byref
mono_type_get_class
mono_type_get_array_type
Commit migrated from https://github.com/mono/mono/commit/
6fb01aa269e7654db21f32c4d44df0d6e0a93e67
Jay Krell [Wed, 2 Oct 2019 09:51:59 +0000 (02:51 -0700)]
[jit amd64] Add const and remove x87. (mono/mono#16700)
Commit migrated from https://github.com/mono/mono/commit/
8d84b6fd38a00f41eb5d5ced1b4edc1136bb8c4b
Vlad Brezae [Wed, 2 Oct 2019 07:23:45 +0000 (10:23 +0300)]
[mini] Use clr memory model by default (mono/mono#17136)
* [mini] Use clr memory model by default
Otherwise we can have potential crashes in the bcl on arm targets, since a lot of code that assumes this memory model is now shared with mono.
Keep the old clr-memory-model option alive for now, to avoid potential build problems, if building older mono with newer mono.
* [build] Remove clr-memory-model option
It is default now
* [man] Add entry for weak-memory-model
Commit migrated from https://github.com/mono/mono/commit/
0ce8c78e0c19b1a0f6b555bb367fd3d25b0f00ba
Alexis Christoforides [Wed, 2 Oct 2019 05:11:35 +0000 (01:11 -0400)]
[merp] Include any managed methods in the 'unmanaged_frames' portion … (mono/mono#17090)
* [merp] Include any managed methods in the 'unmanaged_frames' portion of the output also
This can help correlate the two lists when we have mixed managed & unmanaged stacks in our crash output.
* Wehn symbol/function address is not found, still output the IaP
* Don't set native_offset to ip, that's not what it means
* [merp] Bump protocol version
* Minor formatting fix
* Remove paths from assembly image names
* Remove unused var
* Refactor filling in managed info for stack frame
* Revert "Remove paths from assembly image names"
This reverts commit mono/mono@
defe86b471f37e12fa66a104747cac932943dca1.
Commit migrated from https://github.com/mono/mono/commit/
10e9159eaa92364f03c8359c47e6129aba1f9bda
Kyle White [Wed, 2 Oct 2019 02:01:35 +0000 (22:01 -0400)]
[merp] Use macOS version not Darwin version in MERP reports (mono/mono#17130)
* Use macOS version not Darwin version in MERP
Fixes mono/mono#17004
* Update mono-merp.c
Ensure this is only for Mac
* Don't allocate in macos_version_string
Use a static buffer.
Also some formatting fixes.
Commit migrated from https://github.com/mono/mono/commit/
0004522028ad30bfb7299a6e50cbab98a63ffeaf
Vlad Brezae [Tue, 1 Oct 2019 09:09:54 +0000 (12:09 +0300)]
[sgen] Fix allocator spelling (mono/mono#17111)
Commit migrated from https://github.com/mono/mono/commit/
f9ca01e3a5348f79f818116d2b4690ea9bb847d9
Marek Safar [Tue, 1 Oct 2019 08:11:29 +0000 (10:11 +0200)]
[netcore] Update coreclr tests package name
Commit migrated from https://github.com/mono/mono/commit/
e5f218786d5cf427a5bc1794c32df02a5f89bb46
Egor Bogatov [Tue, 1 Oct 2019 01:28:55 +0000 (04:28 +0300)]
Enable hw intrinsics in AOT mode (mono/mono#17005)
* Introduce -mattr flag
* fix build on arm targets
* remove mono_memory_barrier
* Address feedback
* Address feedback
* cleanup
* fix crash
* fix "bmi" (it's not "bmi1")
* cleanup
* ignore System.Drawing.Tests.IconTests.CorrectColorDepthExtracted test
* fix build on arm
* fix build
* fix build
Commit migrated from https://github.com/mono/mono/commit/
5537a7c2ba6fca532c8b4e380278766d659981c0
Vlad Brezae [Mon, 30 Sep 2019 18:15:42 +0000 (21:15 +0300)]
[sgen] Add stats for allocated gchandles (mono/mono#17074)
Commit migrated from https://github.com/mono/mono/commit/
eb887a8c74a4b7444154200638fc336d0d0f198f
Alexander Köplinger [Mon, 30 Sep 2019 13:32:18 +0000 (15:32 +0200)]
[netcore] Disable System.Drawing.Tests.IconTests.CorrectColorDepthExtracted test
It is broken on newer libgdiplus.
Commit migrated from https://github.com/mono/mono/commit/
7f37f76b6d75ed6236f6f33958784180e6f20446
Marek Safar [Fri, 27 Sep 2019 08:19:58 +0000 (10:19 +0200)]
[netcore] Add target for running coreclr tests
Commit migrated from https://github.com/mono/mono/commit/
f88da6cc14d6aa01048526e6f59f7cddafdce2cb
Nathan Ricci [Fri, 27 Sep 2019 18:48:00 +0000 (14:48 -0400)]
Updated comment in GC.cs about unitialized array.
Commit migrated from https://github.com/mono/mono/commit/
bc63dc68f80d075a544f5fe548abeb9127a60673
Vlad Brezae [Fri, 27 Sep 2019 09:36:04 +0000 (12:36 +0300)]
[mini] Expand clr-memory-model effect (mono/mono#17093)
* [mini] Add memory barriers to more stores inside objects
We should now have membars for all stores of an object ref inside another object (for the stores done by the jit). Used by clr-memory-model debug option.
* [mini] Add memory barrier for storing objref in static fields
For clr-memory-model debug option.
Commit migrated from https://github.com/mono/mono/commit/
194506d495a2e2b7b2fad5dbb655f404cecb2c04
Aleksey Kliger (λgeek) [Thu, 26 Sep 2019 21:30:37 +0000 (17:30 -0400)]
[runtime] Respect runtime_version in mono_init_internal (mono/mono#17085)
In mono/mono@
6d2c77fb3373971b4c615a70fe43f3622e3c91d8 we changed the representation of
the runtimes that we will probe from a NULL-terminated array to a linked list.
Unfortunately we made a typo, and in the case where the caller of
mono_init_internal provided a runtime_version, we still picked
DEFAULT_RUNTIME_VERSION instead of the given runtime_version.
This is an issue for embedders like XA that use the "mobile" runtime - all
their assemblies are compiled with the "mobile" version number (2.0.5.0) but
Mono running with the default runtime configuration will remap to 4.0.0.0. As
a result, when there are references to 2.0.5.0 assemblies, the load requests
will be remapped to 4.0.0.0 which will never see the already loaded 2.0.5.0
assemblies, and we will fall back on the embedder's preload hook or filesystem
probing every single time. This is a performance fail.
Commit migrated from https://github.com/mono/mono/commit/
1dc63ced73eefe7c19cbe51efd6b1b85026e8b0a
Alexander Köplinger [Thu, 26 Sep 2019 21:10:51 +0000 (23:10 +0200)]
Revert "Inline TLS access. (mono/mono#16882)" (mono/mono#17092)
Reverts mono/monomono/mono#16882
This broke the Mono Android SDKs build in master though for some reason it doesn't show up in the PR build:
```
[2019-09-26T03:19:55.366Z] Undefined symbols for architecture x86_64:
[2019-09-26T03:19:55.366Z] "_mono_tls_key_jit_tls", referenced from:
[2019-09-26T03:19:55.366Z] _mono_tls_get_jit_tls in libmain_a-main-sgen.o
[2019-09-26T03:19:55.366Z] "_mono_tls_key_lmf_addr", referenced from:
[2019-09-26T03:19:55.366Z] _mono_tls_get_lmf_addr in libmain_a-main-sgen.o
[2019-09-26T03:19:55.366Z] ld: symbol(s) not found for architecture x86_64
[2019-09-26T03:19:55.366Z] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[2019-09-26T03:19:55.366Z] gmake[6]: *** [Makefile:1634: mono-sgen] Error 1
[2019-09-26T03:19:55.366Z] gmake[6]: Leaving directory '/Users/builder/jenkins/workspace/archive-mono/master/android/debug/sdks/builds/android-host-Darwin-debug/mono/mini'
```.
Commit migrated from https://github.com/mono/mono/commit/
bffd4c6b99213a0b154d7efac9b0581df67775e8
Vlad Brezae [Thu, 26 Sep 2019 19:38:59 +0000 (22:38 +0300)]
[sgen] Report roots from togglerefs (mono/mono#17063)
Commit migrated from https://github.com/mono/mono/commit/
bada36245443d57428e4048670f709d57b45cd69
Marek Safar [Thu, 26 Sep 2019 11:57:42 +0000 (13:57 +0200)]
[netcore] Correctly send exit code to the caller
Commit migrated from https://github.com/mono/mono/commit/
8da9eebcc6cc2f0dbdb75f88ee48ecb682b68771
Vlad Brezae [Thu, 26 Sep 2019 17:16:04 +0000 (20:16 +0300)]
[sgen] Fix heavy binary protocol build (mono/mono#17037)
[sgen] Fix heavy binary protocol build
Commit migrated from https://github.com/mono/mono/commit/
470e53f6b446f6adabb0ce4164b8540b9f65f09d
imhameed [Thu, 26 Sep 2019 16:29:54 +0000 (09:29 -0700)]
Merge pull request mono/mono#17031 from EgorBo/bmi-mulx
[LLVM] Implement Bmi2.MultiplyNoFlags
Commit migrated from https://github.com/mono/mono/commit/
5e30301ff32ec1a8c83519bab1464437655efe32
Alexis Christoforides [Mon, 23 Sep 2019 19:38:52 +0000 (15:38 -0400)]
[crashing] Remove Mono signal handlers when starting to handle a crash
Fixes https://github.com/mono/mono/issues/16803
Commit migrated from https://github.com/mono/mono/commit/
f52678864de6423da3274efb1131c24b0b450d1e
Alexis Christoforides [Thu, 26 Sep 2019 13:30:01 +0000 (09:30 -0400)]
[merp] Output native library module name when 'whitelist all' mode is enabled (mono/mono#16899)
Partially fixes https://github.com/mono/mono/issues/16689
Commit migrated from https://github.com/mono/mono/commit/
4727b2475f89cf7343edbd095647635c0b26f67a
Bernhard Urban [Thu, 26 Sep 2019 08:45:56 +0000 (10:45 +0200)]
[interp] always require GC Unsafe mode in exception checkpoint (mono/mono#17016)
[interp] always require GC Unsafe mode in exception checkpoint
Follow-up for https://github.com/mono/mono/pull/16955
/cc @BrzVlad
Commit migrated from https://github.com/mono/mono/commit/
c81b6f5ca9bbbf47b303322841b5821b780b14f2
Vlad Brezae [Thu, 19 Sep 2019 14:46:11 +0000 (17:46 +0300)]
[debugger] Properly close debugger thread when connection hangs
When we detach from the debugger, we reset the state by starting a new debugger thread (why don't we just use the existing thread?). As per commit https://github.com/mono/mono/commit/mono/mono@
540ef385faa230bc226c7a83bfabd0730520911e we should shut down the debugger thread when the connection drops. However, since that commit was acting as a Dispose command was sent instead, it would end up relentlessly spawning and closing new debugger threads up until the runtime is shut down. This commit makes sure we don't respawn once the connection hangs.
Commit migrated from https://github.com/mono/mono/commit/
f5bb650f784f7d9021178633e7da3b7984122b68
Egor Bogatov [Thu, 26 Sep 2019 07:51:36 +0000 (10:51 +0300)]
LLVM: Add comments (string metadata) for calls (mono/mono#16956)
* Add string metadata to all calls (comments)
* Update mini-llvm.c
* rename tramp_%d to full name too
Commit migrated from https://github.com/mono/mono/commit/
4a72dadb34f313d242908b086f204cd5346d0bbc
Thays Grazia [Wed, 25 Sep 2019 20:12:33 +0000 (17:12 -0300)]
[threading] embedded mono hangs (mono/mono#16907)
* [threading] embedded mono hangs
When embedded mono is executing a C++ code, it didn't start to execute a C# code, we don't need to suspend the thread to run GC.
Fixes mono/mono#16192
Fixes mono/mono#14725
* Changing what was discussed with Aleksey during our 1on1
* Changing what was suggested by Aleksey
* Separating mono_init_version that is being used on tests from the embedded ones
Commit migrated from https://github.com/mono/mono/commit/
5b108b5726ec196f4b61d30f406919ce70211754
Jay Krell [Wed, 25 Sep 2019 18:40:38 +0000 (11:40 -0700)]
[Coop] Unconvert ves_icall_Mono_TlsProviderFactory_IsBtlsSupported. (mono/mono#16995)
Commit migrated from https://github.com/mono/mono/commit/
ed0fa35dc2909b346253ede7b10ce19a2566b511
Egor Bogatov [Wed, 25 Sep 2019 16:28:53 +0000 (19:28 +0300)]
[netcore] Disable annoying SourceLink warrnings (mono/mono#17055)
Currently netcore-build doesn't need submodules (except LLVM) so a task somewhere in arcade/microsoft.build.tasks.git always complain if those are not cloned.
Set EnableSourceControlManagerQueries=false to ignore the warnings.
Commit migrated from https://github.com/mono/mono/commit/
39ff579432fc6261469f9f0ce6304ca29a5ef141
EgorBo [Wed, 25 Sep 2019 11:58:53 +0000 (14:58 +0300)]
revise all X86 intrinsics
Commit migrated from https://github.com/mono/mono/commit/
2ceb062c9b3b250c8749ab28a976b23aedafccea
Jay Krell [Wed, 25 Sep 2019 10:30:27 +0000 (03:30 -0700)]
Fix comment about mono_thread_interruption_request_flag. (mono/mono#17036)
Fix https://github.com/mono/mono/pull/16906/files#r327660329.
Commit migrated from https://github.com/mono/mono/commit/
baa9adc06af08b9c7dcc1609553795f589a39240
EgorBo [Wed, 25 Sep 2019 01:04:38 +0000 (04:04 +0300)]
Implement Bmi2.MultiplyNoFlags
Commit migrated from https://github.com/mono/mono/commit/
ba471607a32e0117d83fd3ffd1f50f51d18ac5e6
Egor Bogatov [Tue, 24 Sep 2019 18:53:23 +0000 (21:53 +0300)]
LLVM: Intrinsify MathF.Round (mono/mono#16840)
* improve MathF.Round
* prefer vroundss
* enable round only for jit
Commit migrated from https://github.com/mono/mono/commit/
37e46aa9aeec213c94d991da55e16a78b5adf9de
Bernhard Urban [Tue, 24 Sep 2019 18:53:10 +0000 (20:53 +0200)]
[checked-build] update allowed thread states (mono/mono#16971)
Commit migrated from https://github.com/mono/mono/commit/
153b5def01ae036ad1b9318cc54973a10919f0a7
Egor Bogatov [Tue, 24 Sep 2019 18:45:32 +0000 (21:45 +0300)]
Add loop related optimizations to LLVM JIT (mono/mono#16436)
* Add loop-related optimizations
* Update llvm-jit.cpp
* Update llvm-jit.cpp
* Update llvm-jit.cpp
Commit migrated from https://github.com/mono/mono/commit/
8f8596761250d15d64a983d34f7de09645601d16
Egor Bogatov [Tue, 24 Sep 2019 18:44:03 +0000 (21:44 +0300)]
[netcore] Implement missing Bmi1/Bmi2 intrinsics (mono/mono#16919)
* Finalize BMI1
* cleanup
* Update simd-intrinsics-netcore.c
* Update simd-intrinsics-netcore.c
* fix LLVM-AOT
Commit migrated from https://github.com/mono/mono/commit/
ed622e91125b5846895d6dcca5366b1775b47d6d
Bernhard Urban [Tue, 24 Sep 2019 11:07:19 +0000 (13:07 +0200)]
[threads] clear small_id_key TLS when unregistering a thread (mono/mono#16973)
* [threads] clear small_id_key TLS when unregistering a thread
Fixes
```
* thread mono/mono#12, name = 'tid_a507', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1be66144)
* frame mono/mono#0: 0x1be66144 libsystem_c.dylib`__abort + 184
frame mono/mono#1: 0x1be6608c libsystem_c.dylib`abort + 152
frame mono/mono#2: 0x003e1fa0 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="* Assertion at ../../../../../mono/utils/hazard-pointer.c:158, condition `mono_bitset_test_fast (small_id_table, id)' not met\n", fatal=4, user_data=0x00000000) at runtime.m:1251:3
frame mono/mono#3: 0x003abf44 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:149:2 [opt]
frame mono/mono#4: 0x003abfb4 monotouchtest`monoeg_assertion_message(format=<unavailable>) at goutput.c:184:22 [opt]
frame mono/mono#5: 0x003904dc monotouchtest`mono_thread_small_id_free(id=<unavailable>) at hazard-pointer.c:0:2 [opt]
frame mono/mono#6: 0x003a0a74 monotouchtest`unregister_thread(arg=0x15c88400) at mono-threads.c:588:2 [opt]
frame mono/mono#7: 0x00336110 monotouchtest`mono_thread_detach_if_exiting at threads.c:1571:4 [opt]
frame mono/mono#8: 0x003e7a14 monotouchtest`::xamarin_release_trampoline(self=0x166452f0, sel="release") at trampolines.m:644:3
frame mono/mono#9: 0x001cdc40 monotouchtest`::-[__Xamarin_NSTimerActionDispatcher release](self=0x166452f0, _cmd="release") at registrar.m:83445:3
frame mono/mono#10: 0x1ce2ae68 Foundation`_timerRelease + 80
frame mono/mono#11: 0x1c31b56c CoreFoundation`CFRunLoopTimerInvalidate + 612
frame mono/mono#12: 0x1c31a554 CoreFoundation`__CFRunLoopTimerDeallocate + 32
frame mono/mono#13: 0x1c31dde4 CoreFoundation`_CFRelease + 220
frame mono/mono#14: 0x1c2be6e8 CoreFoundation`__CFArrayReleaseValues + 500
frame mono/mono#15: 0x1c2be4c4 CoreFoundation`CFArrayRemoveAllValues + 104
frame mono/mono#16: 0x1c31ff64 CoreFoundation`__CFSetApplyFunction_block_invoke + 24
frame mono/mono#17: 0x1c3b2e18 CoreFoundation`CFBasicHashApply + 116
frame mono/mono#18: 0x1c31ff10 CoreFoundation`CFSetApplyFunction + 160
frame mono/mono#19: 0x1c3152cc CoreFoundation`__CFRunLoopDeallocate + 204
frame mono/mono#20: 0x1c31dde4 CoreFoundation`_CFRelease + 220
frame mono/mono#21: 0x1c304a80 CoreFoundation`__CFTSDFinalize + 144
frame mono/mono#22: 0x1bfa324c libsystem_pthread.dylib`_pthread_tsd_cleanup + 644
frame mono/mono#23: 0x1bf9cc08 libsystem_pthread.dylib`_pthread_exit + 80
frame mono/mono#24: 0x1bf9af24 libsystem_pthread.dylib`pthread_exit + 36
frame mono/mono#25: 0x0039df84 monotouchtest`mono_threads_platform_exit(exit_code=<unavailable>) at mono-threads-posix.c:145:2 [opt]
frame mono/mono#26: 0x0033bb84 monotouchtest`start_wrapper(data=0x1609e1c0) at threads.c:1296:2 [opt]
frame mono/mono#27: 0x1bf9b914 libsystem_pthread.dylib`_pthread_body + 128
frame mono/mono#28: 0x1bf9b874 libsystem_pthread.dylib`_pthread_start + 44
frame mono/mono#29: 0x1bfa3b94 libsystem_pthread.dylib`thread_start + 4
```
* Update mono/utils/mono-threads.c
Co-Authored-By: Aleksey Kliger (λgeek) <akliger@gmail.com>
Commit migrated from https://github.com/mono/mono/commit/
749493d4b3a388b91bd454cc153000049b04b526
Thays Grazia [Mon, 23 Sep 2019 21:16:59 +0000 (18:16 -0300)]
[debugger] New way to filter exceptions to support VSWin features (mono/mono#16825)
* Creating a new version of MOD_KIND_EXCEPTION_ONLY to support VsWin features, discussed with Joaquin Jares.
Because we don't have this functionality of get every other exception that is not specified, VsWin was getting every exception and filtering later. But this causes a slowness during the debugger because we stop all thread on each exception that we get, even if they are caught and we don't want to stop.
* Fixing other unit test because now we have 2 nested classes.
Fixing indentation.
* Creating a flag in the MOD_KIND_EXCEPTION_ONLY protocol event and not creating a new protocol event.
* Changing what was suggested by Zoltan.
* Coding style
* Bump API snapshot submodule
Commit migrated from https://github.com/mono/mono/commit/
7e6d863686af20509f4a0dc7cd4fca351e295347
Alexander Köplinger [Mon, 23 Sep 2019 20:44:59 +0000 (22:44 +0200)]
Correctly check for HAVE_STAT_BIRTHTIME in configure.ac checks for System.Native (mono/mono#16999)
The check was done incorrectly, the include files need to be separated by newlines otherwise we would get a false negative result.
config.log contained this:
```
conftest.c:279:23: warning: extra tokens at end of #include directive [-Wextra-tokens]
#include <sys/types.h>, #include <sys/stat.h>
^
//
```
This means that when doing File.GetCreationTime() we'd fall back to returning the last modified time.
It regressed when we switched to System.IO.File to the CoreFX implementation i.e. System.Native in https://github.com/mono/mono/commit/mono/mono@
8f5cef936491e8b20888bbf18d426482c890637c.
Fixes https://github.com/mono/mono/issues/16974
Commit migrated from https://github.com/mono/mono/commit/
9b98db9ca949bbb706a3d647662985347816d9f7
Alexis Christoforides [Mon, 23 Sep 2019 19:49:53 +0000 (15:49 -0400)]
[merp] Use function names even in 'private crashes' mode (mono/mono#16897)
Partially fixes https://github.com/mono/mono/issues/16689
Commit migrated from https://github.com/mono/mono/commit/
bc43f32c9d7eb5db32f580da85d14a98518b1d8b
Jay Krell [Mon, 23 Sep 2019 09:10:23 +0000 (02:10 -0700)]
[interp] Improve debuggability with enum. (mono/mono#16721)
Commit migrated from https://github.com/mono/mono/commit/
7497e4933c6fc0819f8f202829c26c410e4f0e5c
Thays Grazia [Sun, 22 Sep 2019 19:12:10 +0000 (16:12 -0300)]
[debugger] Crash when debugging iOS application that throws (mono/mono#16958)
* Doing the same fix from Android to IOS.
* On mini-exceptions.c check if there is no ji we can continue and generate the exception without checking wrapper_type.
Fixes mono/mono#16824
Commit migrated from https://github.com/mono/mono/commit/
1a277c31a095a1b5b8212ed6c0425fad7bb4a42b
EgorBo [Sat, 21 Sep 2019 18:05:13 +0000 (21:05 +0300)]
netcore: fix debug build
Commit migrated from https://github.com/mono/mono/commit/
6257369adcf940d81196c476fbbf6978cb008ada
Jay Krell [Sat, 21 Sep 2019 16:35:19 +0000 (09:35 -0700)]
Inline TLS access. (mono/mono#16882)
The same functions are referenced by JIT and runtime.
The JIT uses cannot be inlined. The runtime can.
Since I could not get anything else to build and the change is simple and mechanical, now two sets of functions are provided, inline and extern. Extern just calls inline.
This PR appears to change all the uses, but it is only the JIT uses. The runtime ones just work and keep the old names.
We should also consider building desktop with LTO/LTCG, which would do all this automatically, smarter, more generally. A quick experiment shows it grows the runtime size, which is why I say desktop.
Commit migrated from https://github.com/mono/mono/commit/
aca55a42aa5117f4406b68b1ac217063cc7ab3ec
Jay Krell [Sat, 21 Sep 2019 09:09:41 +0000 (02:09 -0700)]
Partially inline mono_method_signature_checked/internal. (mono/mono#16927)
* Inline common fast paths of mono_method_signature_checked and mono_method_signature_internal.
* PR: Restore profilers to use mainstream functions.
Commit migrated from https://github.com/mono/mono/commit/
b20c690e3e96c16a7a5c4ab580060db4ccf28d86
Bernhard Urban [Fri, 20 Sep 2019 22:02:20 +0000 (00:02 +0200)]
[arm64_32] fix pointer size in CallInfo (mono/mono#16970)
Note that in the output below `a`, `b`, etc. are NSObjects, so they are really passed as pointer.
Before:
```
* thread mono/mono#1, name = 'tid_303', queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame mono/mono#0: 0x04f301d4 aWatchOSExtension`::xamarin_localized_string_format_9(format="hello%@%@%@%@%@%@%@%@%@", a=0, b=1, c=2, d=3, e=4, f=5, g=6, h=7, i=0x00000000) at nsstring-localization.m:81:9
78 void *
79 xamarin_localized_string_format_9 (NSString *format, id a, id b, id c, id d, id e, id f, id g, id h, id i)
80 {
-> 81 return [NSString localizedStringWithFormat: format, a, b, c, d, e, f, g, h, i];
82 }
83
84 }
(lldb) mbt 4
* thread mono/mono#1
* frame mono/mono#0: 0x04f301d4 aWatchOSExtension`::xamarin_localized_string_format_9(format="hello%@%@%@%@%@%@%@%@%@", a=0, b=1, c=2, d=3, e=4, f=5, g=6, h=7, i=0x00000000) at nsstring-localization.m:81:9
frame mono/mono#1: 0x04d9984c aWatchOSExtension`interp_to_native_trampoline + 156
frame mono/mono#2: 0x04f41d5c aWatchOSExtension`ves_pinvoke_method(frame=0x05167af8, sig=0x1518afd0, addr=(aWatchOSExtension`::xamarin_localized_string_format_9(NSString *, id, id, id, id, id, id, id, id, id) at nsstring-localization.m:80), string_ctor=0, context=0x14550960, save_last_error=0) at interp.c:1411:2 [opt]
NSString::xamarin_localized_string_format_9 @ 68 "calli.nat" || frame mono/mono#3: 0x04f3bfa4 aWatchOSExtension`interp_exec_method_full(frame=0x05167d38, context=<unavailable>, clause_args=0x00000000, error=0x05168540) at interp.c:3290:5 [opt]
```
After:
```
* thread mono/mono#1, name = 'tid_303', queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame mono/mono#0: 0x04c2c1e0 aWatchOSExtension`::xamarin_localized_string_format_9(format="hello%@%@%@%@%@%@%@%@%@", a=0, b=1, c=2, d=3, e=4, f=5, g=6, h=7, i=8) at nsstring-localization.m:81:9
78 void *
79 xamarin_localized_string_format_9 (NSString *format, id a, id b, id c, id d, id e, id f, id g, id h, id i)
80 {
-> 81 return [NSString localizedStringWithFormat: format, a, b, c, d, e, f, g, h, i];
82 }
83
84 }
```
Commit migrated from https://github.com/mono/mono/commit/
0f181a9dc4bc5d08e7876a726237c3d10e671b16
Jay Krell [Fri, 20 Sep 2019 21:58:16 +0000 (14:58 -0700)]
[Coop] ves_icall_property_info_get_default_value. (mono/mono#16614)
This includes resolving a somewhat deep problem involving
a void* that is usually to a int/float, but can be a MonoObject** or at least MonoString**.
An additional MonoStringHandleOut parameter is pass around to address this.
Perhaps it should be MonoObjectHandleOut for more generality.
Commit migrated from https://github.com/mono/mono/commit/
12d3dcecc6bdac25d485a90b6e077c1ec9d29bbe
Bernhard Urban [Fri, 20 Sep 2019 20:15:55 +0000 (22:15 +0200)]
[interp] avoid exception checkpoint when in thread is in GC Safe state (mono/mono#16955)
[interp] avoid exception checkpoint when in thread is in GC Safe state
Usually the interpreter operates in GC Unsafe state. There is an exception however, and that is when it executes a `managed-to-native` wrapper in cooperative (or hybrid) suspend.
The wrapper does essentially:
1. enter GC Safe state via `mono_threads_enter_gc_safe_region_unbalanced`
2. call native function
3. exit GC state via `mono_threads_exit_gc_safe_region_unbalanced`
Usually upon return of a native function call, the interpreter would check for thread interruption and, if applicable, throw an exception. That, however, would mess with the GC state as the interpreter operates in GC Safe state at this moment.
Note that ignoring thread interruption at that point shouldn't be a problem, because after 3. the `managed-to-native` wrapper will check for thread interruption anyway.
Contributes to https://github.com/mono/mono/issues/16819
Commit migrated from https://github.com/mono/mono/commit/
e27159174a017efb3ebc66c9c66fc1785c4bd930
Jay Krell [Fri, 20 Sep 2019 17:12:01 +0000 (10:12 -0700)]
Use ld -Bsymbolic when linking AOT. (mono/mono#14511)
The runtime already does this itself.
Commit migrated from https://github.com/mono/mono/commit/
8b4c1ef8285dc5d54d72a21d5574d11b04feb431
Alexander Köplinger [Fri, 20 Sep 2019 15:27:15 +0000 (17:27 +0200)]
[netcore] Move to new arcade post build using yaml stages (mono/mono#16966)
This is required by the newer arcade builds.
We can simplify our scripts since we no longer need the special publishwitharcade.proj.
Added copyright and license to the .nuspecs since the new arcade validation now
verifies this against a set of Microsoft policies.
We also need to make the .nupkg pre-release by appending the -preview suffix as stable versions are not permitted in non-stable feeds.
Commit migrated from https://github.com/mono/mono/commit/
6bc988b0870b7d4d56a73c13b45fe5158f81c64d
Filip Navara [Thu, 19 Sep 2019 16:21:21 +0000 (18:21 +0200)]
Fix check for SafeHandle types
Commit migrated from https://github.com/mono/mono/commit/
338170ecceaf6d8e69ad1812d416dfaf728096f3
Jay Krell [Fri, 20 Sep 2019 02:36:18 +0000 (19:36 -0700)]
[Coop] InterlockedCompare/Exchange (object/T) (mono/mono#16873)
* [Coop] InterlockedExchange (object and T), InterlockedCompareExchange (object and T).
- Usually intrinsified.
- Always?
- Avoid coop handles by manually always using ref to object.
- For efficiency on input, and efficiency wrt MonoError.
- For correctness on output (due to aliasing in the wrappers).
- To probably avoid assertion failure in runtime around icall marshaling of generics.
- Unclear on location.
* Balance parens in prints, so they are balanced in the code.
* Reduce local arrays from 16 to auto-sized 1.
* Update and reformat System.Threading.Interlocked signature recognition.
* Rename the generic again to "_T" (or "Generic"?) on the theory
that the aot-runtime.c signature check is too strict/incorrect,
but that if we loosen it, it is not clearly specific to the generic.
* Revise corlib version again.
* Bump API snapshot submodule
Commit migrated from https://github.com/mono/mono/commit/
d49d7b47165b2c629a916a2c3b0fb11067e49151
Zoltan Varga [Fri, 20 Sep 2019 01:43:49 +0000 (21:43 -0400)]
[llvm] Handle recursive calls as a direct call. (mono/mono#16944)
Fixes https://github.com/mono/mono/issues/16943.
Commit migrated from https://github.com/mono/mono/commit/
c730a2a2e35682121d69d3c76cbd7af371f01c41
Jay Krell [Thu, 19 Sep 2019 20:49:43 +0000 (13:49 -0700)]
Inline mono_thread_interruption_request_flag. (mono/mono#16906)
Note that the name mono_thread_interruption_request without trailing flag
was already taken.
Commit migrated from https://github.com/mono/mono/commit/
d02c121f79507132f56527ba1338f8186b66dd46
Filip Navara [Thu, 19 Sep 2019 18:08:07 +0000 (20:08 +0200)]
[netcore] Show line numbers when xunit tests fail (mono/mono#16931)
Commit migrated from https://github.com/mono/mono/commit/
81b5819528f4b3520fbc51cc9b0b355bfa0cc515
Jay Krell [Thu, 19 Sep 2019 16:19:59 +0000 (09:19 -0700)]
Balance parens in prints, so they are balanced in the code. (mono/mono#16930)
Commit migrated from https://github.com/mono/mono/commit/
06a814e66f8da460cb4d6f94141dc6ba9882cc0d
Jay Krell [Thu, 19 Sep 2019 10:41:29 +0000 (03:41 -0700)]
Inline mono_object_unbox_internal and mono_object_get_data. (mono/mono#16856)
Commit migrated from https://github.com/mono/mono/commit/
8d23dc71b6d30c799e43e359ad622618d684b7a5
Filip Navara [Wed, 18 Sep 2019 16:06:49 +0000 (18:06 +0200)]
Implement Marshal.SetLastWin32Error
Commit migrated from https://github.com/mono/mono/commit/
85056b086f950799b79a8f999e9a3edd406b0785
Johan Lorensson [Thu, 19 Sep 2019 06:45:44 +0000 (08:45 +0200)]
Fix build warnings in libmonoruntime. (mono/mono#16802)
Commit migrated from https://github.com/mono/mono/commit/
ad997d3725e9fa03d04798f5f39f74c6fc7f989b
Johan Lorensson [Thu, 19 Sep 2019 06:45:00 +0000 (08:45 +0200)]
Explicit disable hybrid suspend when cooperative suspend is enabled. (mono/mono#16798)
hybrid suspend won't get disabled when using --enable-cooperative-suspend
triggering configure error:
Hybrid suspend and Cooperative suspend cannot be both enabled.
Fix explicit set hybrid suspend default behavior to no if cooperative
suspend has been configured.
Commit migrated from https://github.com/mono/mono/commit/
077e76c47088348c6c4b5d16d821dfea67367683
Ryan Lucia [Wed, 18 Sep 2019 21:18:30 +0000 (17:18 -0400)]
Make case-insensitive class lookup work correctly with exported types (mono/mono#16652)
* Make case-insensitive class lookup work correctly with exported types
* Search all matching namespaces
* Skip AOT cache for case-insensitive lookups
Commit migrated from https://github.com/mono/mono/commit/
529a11cf5b7557851472d7cb646559e0d3b02763
Egor Bogatov [Wed, 18 Sep 2019 19:08:35 +0000 (22:08 +0300)]
[netcore] Implement more System.Runtime.Intrinsics.X86.Bmi1/Bmi2 (mono/mono#16891)
* Implement more BMI1/BMI2
* implement more bmi1 intrinsics
* Update simd-intrinsics-netcore.c
Commit migrated from https://github.com/mono/mono/commit/
9a4a62450129deb77b749739d7c01adfdaa5b9dd
Neale Ferguson [Wed, 18 Sep 2019 13:54:27 +0000 (09:54 -0400)]
- Some more prep for SIMD on s390x (mono/mono#16903)
- Use __builtin_bswapxx for s390x rather than inline assembler
- s390x ABI specifies that %f8-%f15 are protected between calls so avoid using or save/restore as required
- Save the "protected" FP registers in the context structure
Commit migrated from https://github.com/mono/mono/commit/
86f7cef7f43f9289e9aea96799875ed9578c50ab
Vlad Brezae [Wed, 18 Sep 2019 13:16:17 +0000 (16:16 +0300)]
[mini] Add missing membars when initializing rgctx entries (mono/mono#16904)
[mini] Add missing membars when initializing rgctx entries
Whenever we are publishing changes to the rgctx arrays, we are racing with rgctx_lazy_fetch_trampoline, so we need to make sure any pointers we set there must have their contents initialized.
Commit migrated from https://github.com/mono/mono/commit/
b2739b5196250a467ce0c315b3fc93065267bfee
Jay Krell [Tue, 17 Sep 2019 21:39:09 +0000 (14:39 -0700)]
All existing safepoints appear to be mooted by pinned coop handles. (mono/mono#16695)
Perhaps they are never needed then.
Commit migrated from https://github.com/mono/mono/commit/
12c48df242f61c6e028030499a43b140f41873e1
Alexander Köplinger [Tue, 17 Sep 2019 19:18:54 +0000 (21:18 +0200)]
[netcore] Fix compiler warnings (mono/mono#16883)
This fixes the compiler warnings when building netcore-only on macOS.
Commit migrated from https://github.com/mono/mono/commit/
e1f5738371c199810e1ee04fb7238cd0746e2600
Vlad Brezae [Tue, 17 Sep 2019 16:27:51 +0000 (19:27 +0300)]
[interp] Fix stack size regression (mono/mono#16887)
Partly revert https://github.com/mono/mono/commit/mono/mono@
b18840e92cb5b1afef6c0e5df05cc026eb32efbf
Commit migrated from https://github.com/mono/mono/commit/
906c71b8bf990a9f6dce535a1842a2b3d22a5272
Jay Krell [Tue, 17 Sep 2019 10:23:19 +0000 (03:23 -0700)]
[interp] Use +=, *= etc. Seems to generate identical code though. (mono/mono#16848)
i.e. a = a op b is *not* double evaluating a.
Commit migrated from https://github.com/mono/mono/commit/
fb71d475437ffab6fbfb97962f375af5571c775f
Ryan Lucia [Tue, 17 Sep 2019 09:23:05 +0000 (05:23 -0400)]
Temporarily disable embedded ppdb data decompression (mono/mono#16868)
This addresses mono/mono#16373. We will work on a proper fix, but this at least unblocks Roslyn CI
Commit migrated from https://github.com/mono/mono/commit/
6252794ebe6cd6f04131dbb1ea0da3a8cd4c6ab1
Bernhard Urban [Tue, 17 Sep 2019 09:15:19 +0000 (11:15 +0200)]
[arm64_32] make "Debug Mode" work on Watch series 4 with --interpreter (mono/mono#16865)
[arm64_32] make "Debug Mode" work on Watch series 4 with --interpreter
Main objective for reviewers: This PR shouldn't change anything for `arm64`.
Context: "Debug Mode" on the Apple Watch allows execution of regular machine code and thus is pretty similar to FullAOT on iPhone, i.e. it doesn't require bitcode, but _still_ doesn't allow `signal(3)` so cooperative suspend is required.
Apple Watch Series 4 and onward use an ARM64 chip, but with a different ABI, also known as `arm64_32`. This PR changes the AOT compiler and related trampolines so that the AOT compiler can generate all necessary code to run the interpreter on this target.
Changes:
--------------------------------------
[arm64_32] set register size to 8 in cross compiler too
-----------------------------------------
[machine] update `target_mgreg_t` definition
`SIZEOF_REGISTER` is usually the same as `TARGET_SIZEOF_VOID_P`, except when `MONO_ARCH_ILP32 is defined.
`target_mgreg_t` should represent the width of the hardware register, that is, `SIZEOF_REGISTER`.
---------------------------------------------
[arm64_32] fix AOT image layout
---------------------------------------------
[arm64_32] make trampolines bitwidth aware
* replace pointer loads/stores with bitwidth-dependent macro
* reflect `specific` trampolines so that only two instructions are used for ILP32, since the related pair in the data page only needs 2 * 32bits too
* replace some `sizeof (target_mgreg_t)` with `TARGET_SIZEOF_VOID_P` (former is hardware register size, latter is pointer size)
---------------------------------------------
These regression tests are _not_ passing: https://github.com/mono/mono/issues/16864 Also some of monotouch-tests are crashing, see https://github.com/mono/mono/issues/16819
Here is a screenshot of a debug session in VSMac:
<img width="1321" alt="Screenshot 2019-09-16 at 19 13 22" src="https://user-images.githubusercontent.com/75403/
64981326-
1dfbc000-d8bc-11e9-9d16-
48036f36b638.png">
Contributes to https://github.com/mono/mono/issues/10641
Commit migrated from https://github.com/mono/mono/commit/
578e1a9dda135516d51f00680939facbc63061ba
Nikolay Sivov [Mon, 16 Sep 2019 17:42:43 +0000 (20:42 +0300)]
[cominterop] Default to [in] parameter direction when not specified explicitly.
Treat [In, Out], [In] and unspecified as input arguments. Important change from
current behavior is to allow parameter without directional attributes.
Use case example is _MethodInfo.Invoke() method called from native client.
Commit migrated from https://github.com/mono/mono/commit/
08521a1c43780a711113ef42043f664f256e8978
Jay Krell [Tue, 17 Sep 2019 08:55:46 +0000 (01:55 -0700)]
[interp] Cleanup dispatch macros. (mono/mono#16784)
- Factor out reptition into already existing macros.
- Remove the default for computed goto which is dead.
Computed goto has no notion of default. It is just
an unchecked array access.
Extracted from https://github.com/mono/mono/pull/16721.
Commit migrated from https://github.com/mono/mono/commit/
af185d2c1e39169557e996b3fd1ead6acb174486
Zoltan Varga [Tue, 17 Sep 2019 07:53:52 +0000 (03:53 -0400)]
[llvm] Use IntPtrType () for byref arguments instead of a pointer, the latter causes problems when pointer operations are used along with phi nodes. Fixes https://github.com/mono/mono/issues/16808. (mono/mono#16874)
Commit migrated from https://github.com/mono/mono/commit/
1031c4650df27fc77206c38a912228fb0862e198
Vlad Brezae [Tue, 17 Sep 2019 07:32:20 +0000 (10:32 +0300)]
[interp] Optimize multidimensional array access (mono/mono#16822)
* [interp] Pass rank instead to LDELEMA
It feels more intuitive and uses less computations.
* [interp] Avoid unnecessary type check
Loading element address of array requires type checks only if the elements of the array are references.
* [interp] Avoid using MINT_CALLRUN for Get intrinsic
It is very slow. Use ldelema/ldobj pair instead.
* [interp] Optimize MINT_LDELEMA
* [interp] Rename ldelema_fast to ldelema1
ldelema_fast was handling arrays with a single dimension. Rename it to better suggest this.
* [interp] Avoid using MINT_CALLRUN for Set intrinsic
* [interp] Remove some duplicated and confusing code
* [interp] Fix stack type of MINT_NEWARR result
Commit migrated from https://github.com/mono/mono/commit/
aaaa2bdd5e5795dfba689cde110999a9a9225fb2
Johan Lorensson [Mon, 16 Sep 2019 21:19:00 +0000 (23:19 +0200)]
Fix warnings in eglib gspawn.c on platforms lacking fork/execv. (mono/mono#16801)
Commit migrated from https://github.com/mono/mono/commit/
e8570d950075153de81ab49410109ed7c7b4688f
Filip Navara [Mon, 16 Sep 2019 21:16:14 +0000 (23:16 +0200)]
[netcore] Make Environment calls thread-safe (mono/mono#16852)
* [netcore] Make Environment calls thread-safe
* Address PR feedback
* Address PR feedback
Commit migrated from https://github.com/mono/mono/commit/
17fe4757a3c4a77bedd7e451ef092f49c6e3a57f
Ryan Lucia [Mon, 16 Sep 2019 21:14:42 +0000 (17:14 -0400)]
[debugger] remove extraneous ErrorCode declaration (mono/mono#16862)
With the single point of exit, this means the main ErrorCode isn't being written to and uninitialized memory is returned.
Commit migrated from https://github.com/mono/mono/commit/
a23da4b8b33aa6929e2f82303d5a390b0cc5c422
Zoltan Varga [Mon, 16 Sep 2019 19:42:57 +0000 (15:42 -0400)]
[wasm] Initial netcore support. (mono/mono#16718)
* [runtime] Fix configure support for netcore+out of tree builds. Add wasm support for generating netcore/config.make.
* [runtime] Add bundle support for the netcore assembly loader.
* [netcore] Add missing linker exclusion.
* [wasm] Add netcore builds, enabled by defining ENABLE_WASM_NETCORE in Make.config.
The targets are 'package-wasm-runtime-netcore' and 'package-wasm-bcl-netcore'.
The binaries are copied to out/wasm-runtime-netcore-<CONFIG> and out/wasm-bcl/netcore.
* [wasm] Add netcore support to the build system and packager.
* Fix the build.
* Fix the dynamic build.
Commit migrated from https://github.com/mono/mono/commit/
422d559ea45f2e7e998825da26c3fd79a03d5e99
Jay Krell [Mon, 16 Sep 2019 07:10:47 +0000 (00:10 -0700)]
Strike a size and conditional branch balance between (mono/mono#16836)
https://github.com/mono/mono/pull/16835
and
https://github.com/mono/mono/pull/16834
The main 4 call opcodes should have no conditionality here.
The non-virtuals no extra branch.
The other opcodes all have one condition and branch into common code.
Everything could be smaller or faster but not both.
Commit migrated from https://github.com/mono/mono/commit/
9f3effc1775f2889e43dd3888abf6081c354ee59
Jay Krell [Mon, 16 Sep 2019 04:10:12 +0000 (21:10 -0700)]
[Coop] ParseRouteInfo, fix some leaks, cleanup. (mono/mono#16815)
Commit migrated from https://github.com/mono/mono/commit/
67fb575d11ef63aba77f1ece1e2dff23c2029467
Johan Lorensson [Mon, 16 Sep 2019 00:51:07 +0000 (02:51 +0200)]
Fix infrequent hangs in test-runner. (mono/mono#16793)
* Fix infrequent hangs in test-runner.
test-runner has been plagued with very infrequent hangs causing long
timeouts on CI. Turns out that there is a race in AsyncStreamReader
used by Process class for handling stdout/stderr when closing down
process. Since AsyncStreamReader::Dispose didn't make sure no pending
async read requests were still in flight before closing the stream
and underlying handle, it led to a race condition deadlocking the
complete process, hanging test-runner. A similar race has also been
observed but instead of causing a deadlock, it could also manifest as an
System.ObjectDisposedException when doing EndRead while another thread
is disposing the underlying stream. Hitting that race didn't deadlock
the process but failed to complete invoke of test-runner.
Fix is to better protect the async callback and the thread doing the
dispose call. In order to make sure we don't close underlying handle
while still having async reads in flight, fix also checks async result
for completion and if not completed when trying to dispose AsyncStreamReader
it will try to cancel outstanding pending IO and wait for completion
before closing the stream.
Since the issue has only been seen on Windows, the fix will try
to cancel pending IO and wait for completion before closing stream
on Windows. On other platforms, old behavior will be preserved, meaning
that the implementation will still be vunarable to race between pending
reads and close of stream, but since problem has not been observed on
other platforms and since there is no good way of cancel outstanding
blocking reads, old behavior is kept.
At some point in future we should look into replacing the implementation
of AsyncStreamReader and use cancelation tokens, but since we don't have
all corefx support around cancelation in Mono BCL, that currently won't
solve the issue, meaning that we need to bring in more classes. Since the
problem also occur in test-runner using the build BCL profile, even more
needs to be added to that profile in order to get similar support. But due
to the infrequency of the problem and that it has only been observed on
Windows, the isolated fix seems more reasonable.
* Build error fix.
* Review feedback.
* Fix type cast not working on linux builds.
* Adjust icall naming in icall-def.h.
Commit migrated from https://github.com/mono/mono/commit/
7fa706a316f043068e4d37a7d512bd44295e14b0
Jay Krell [Mon, 16 Sep 2019 00:50:25 +0000 (17:50 -0700)]
[Coop] GetValueInternal. (mono/mono#16811)
Commit migrated from https://github.com/mono/mono/commit/
8da3616e7fe0ad17d249f8f00df96d3e6c683729
Johan Lorensson [Mon, 16 Sep 2019 00:49:53 +0000 (02:49 +0200)]
Fix warnings in libmono. (mono/mono#16813)
Commit migrated from https://github.com/mono/mono/commit/
9249d38079f97896da7f97ca54342d58eddc52a6
Zoltan Varga [Mon, 16 Sep 2019 00:45:13 +0000 (20:45 -0400)]
[netcore] Change an ArrayList to a List<T>. (mono/mono#16842)
* [netcore] Change an ArrayList to a List<T>.
* [netcore] Call the generic version of Array.IndexOf () in the ICollection wrappers. Update exclusions file.
Commit migrated from https://github.com/mono/mono/commit/
cdb04c042f1e57053047e28373ef35fe2a898270
Egor Bogatov [Mon, 16 Sep 2019 00:43:10 +0000 (03:43 +0300)]
LLVM: Dump Module instead of Function in JIT mode (mono/mono#16837)
Since each function has its own module (in JIT mode) it makes sense to dump the whole module for MONO_VERBOSE_METHOD instead of just LLVM::Function.
It adds metadata, attributes and global variables (so it will be possible to copy-paste it to godbolt)
Example
static int Test(int x)
{
return x / 10;
}
Diff for Unoptimized IR: https://www.diffchecker.com/NrF413Ts
Diff for Optimized IR: https://www.diffchecker.com/jbEkeFFS
So now we can see global variables and metadata for each function (and can easily paste them to godbolt.org)
NOTE: optimized IR for this case contains "dead" variables (dump_module allowed us to see such), we probably need some Module-wide optimizations to strip dead code such as -globaldce
NOTE2: why do we emit exceptions in the first place for this case at all?
Commit migrated from https://github.com/mono/mono/commit/
0438397b8afc51aac45da55c155162e13e83cf19
Jay Krell [Sun, 15 Sep 2019 19:26:41 +0000 (12:26 -0700)]
[interp] Speed up passing this parameter. (mono/mono#16846)
Commit migrated from https://github.com/mono/mono/commit/
304f3add20dcdb32a3c4c095779efba3a8f5bca1