mono.git
6 years ago[mkbundle] Link against Objective-C runtime and Foundation framework on OSX (#5642)
Alexander Köplinger [Wed, 27 Sep 2017 09:15:12 +0000 (11:15 +0200)]
[mkbundle] Link against Objective-C runtime and Foundation framework on OSX (#5642)

Without it you get errors like the following in old-style mkbundle:

```
Undefined symbols for architecture x86_64:
  "_CFLocaleCopyCurrent", referenced from:
      _ves_icall_System_Globalization_CultureInfo_get_current_locale_name in libmono-2.0.a(libmonoruntimesgen_la-locales.o)
  "_CFLocaleGetIdentifier", referenced from:
      _ves_icall_System_Globalization_CultureInfo_get_current_locale_name in libmono-2.0.a(libmonoruntimesgen_la-locales.o)
  "_CFLocaleGetValue", referenced from:
      _ves_icall_System_Globalization_CultureInfo_get_current_locale_name in libmono-2.0.a(libmonoruntimesgen_la-locales.o)
  "_CFRelease", referenced from:
      _ves_icall_System_Globalization_CultureInfo_get_current_locale_name in libmono-2.0.a(libmonoruntimesgen_la-locales.o)
...
```

We actually documented this in the 3.4 release notes: http://www.mono-project.com/docs/about-mono/releases/3.4.0/#breaking-changes

However this means that you had to use the "-c" mkbundle option
to only generate the .c stub so you could pass those additional libraries.

6 years ago[jit] Add support for unlimited size/number of arguments to the dyn call code (#5612)
Zoltan Varga [Wed, 27 Sep 2017 01:23:56 +0000 (03:23 +0200)]
[jit] Add support for unlimited size/number of arguments to the dyn call code (#5612)

* [jit] Add a mono_arch_dyn_call_get_buf_size () arch specific function which returns the size of the buffer required for a given dyn call. Use this instead of a fixed size buffer, to allow backends to use variable sized buffers later.

* [amd64] Add support for unlimited size/number of arguments to the dyncall code.

* [arm64] Add support for unlimited size/number of arguments to the dyncall code. Part of the fix for #59184.

6 years ago[[runtime] Wait for the thread to really exit in Thread.Join (). Change the check...
Zoltan Varga [Wed, 27 Sep 2017 00:08:31 +0000 (02:08 +0200)]
[[runtime] Wait for the thread to really exit in Thread.Join (). Change the check for started threads in mono_thread_set_name_internal () so it check the thread state and not the tid. Avoid setting the tid to 0 when the thread exits. (#5549)

6 years ago[mini] Add my test suite to the list of magic type assemblies.
Rodrigo Kumpera [Tue, 26 Sep 2017 22:03:18 +0000 (15:03 -0700)]
[mini] Add my test suite to the list of magic type assemblies.

6 years ago[mini] Adjust some test suites to work under mobile.
Rodrigo Kumpera [Tue, 26 Sep 2017 21:57:45 +0000 (14:57 -0700)]
[mini] Adjust some test suites to work under mobile.

6 years ago[Mono.Unix] Fix crasher in StringToHeap (#5639)
Marius Ungureanu [Tue, 26 Sep 2017 20:34:07 +0000 (23:34 +0300)]
[Mono.Unix] Fix crasher in StringToHeap (#5639)

In case StringToHeap (string, Encoding) was called with a null string, it would unconditionally reference the string when trying to query the string's length.

Bug 10074 - Error while updating status of command: MonoDevelop.Ide.Commands.ViewCommands.LayoutList

6 years ago[test] Add gparam Type.IsAssignableFrom and Type.BaseType tests
Aleksey Kliger [Tue, 26 Sep 2017 17:01:43 +0000 (13:01 -0400)]
[test] Add gparam Type.IsAssignableFrom and Type.BaseType tests

Lock down .NET Framework documented behavior

6 years ago[class] Use constraints of gparam T2 in T1.IsAssignableFrom (T2)
Aleksey Kliger [Fri, 22 Sep 2017 14:30:44 +0000 (10:30 -0400)]
[class] Use constraints of gparam T2 in T1.IsAssignableFrom (T2)

Suppose we want to know C.IsAssignableFrom (T1):
```
  class C { }
  class G<T1, T2> where T1 : T2, T2 : C { }
```

Previously, we would get `False`, because we only checked the constraints of T1
if C was an interface or another gparam.  Now Instead we always consider the
constraints in `A.IsAssignableFrom (B)` whenever `B` is a gparam.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58809

6 years ago[test] Add regression test for 58809
Aleksey Kliger [Thu, 21 Sep 2017 18:10:49 +0000 (14:10 -0400)]
[test] Add regression test for 58809

Check that generic parameters's constraints properly affect the subclass and
interface relationships even when the constraints relate several of the generic
parameters themselves.

6 years ago[w32process] Fix inverted kernel and user ticks (#5641)
Ludovic Henry [Tue, 26 Sep 2017 17:51:54 +0000 (13:51 -0400)]
[w32process] Fix inverted kernel and user ticks (#5641)

6 years agoFix shutdown race between mono_thread_manage and mono_thread_detach_internal. (#5599)
Johan Lorensson [Tue, 26 Sep 2017 17:25:23 +0000 (19:25 +0200)]
Fix shutdown race between mono_thread_manage and mono_thread_detach_internal. (#5599)

* Add support for mono_threads_add_joinable_thread and friends on Windows.

Current Windows implementation doesn't have support for the joinable thread
implementation in threads.c. Joinable threads are used by the runtime during
shutdown to coordinate with exit of platform threads.

Since threads detaching and exiting during shutdown could still use or provide
important resources, like GC memory, lacking support for this feature could
potentially expose the implementation to various shutdown race conditions.

Commit also change requested permission on a thread handle when opening it for
synchronization purposes. No need to request all thread access when handle is only
used for synchronization, like in WaitForXXX API calls.

* Fix race between mono_thread_detach_internal and mono_thread_manage.

There is a race during shutdown when main tread is running mono_thread_manage and
attached threads are running mono_thread_detach_internal. The problem is related to
the removal from the registered threads list since mono_thread_manage will pick
threads to wait upon from that list. If a thread removes itself from the list
using mono_thread_detach_internal it will then race against runtime shutdown
and the removal of used resources still in used by mono_thread_detach_intenral,
like MonoInternalThread.

This race could trigger the assert seen in bugzilla:

https://bugzilla.xamarin.com/show_bug.cgi?id=58770

or other undefined behavior depending on where the detached thread resume execution
after main thread has shutdown the runtime, but not yet terminated the process.

The fix makes sure threads that are detaching during shutdown ends up on the joinable
threads list. Threads on that list will be waited upon by the main thread during shutdown,
mono_thread_cleanup. This will make sure the detached thread finishes the remaining of
mono_thread_detach_internal and potential other code still using GC memory during shutdown.
Threads already on the threads list will already be waited upon by mono_thread_manage during
shutdown (if not removed by mono_thread_detach_internal triggering this race), so this change
won't add additional threads to be waited up by the runtime. It just makes the shutdown more
reliable using already available concepts (like the joinable threads list).

* Fix warning C4141 on Windows MSVC compiler.

* Updated with review feedback.

* Prevent race between finalizer and main thread to join same thread multiple times.

Checking against joinable_threads list in mono_threads_add_joinable_thread is not enough.
There is a small chance that the same runtime thread could get on the list twice since
mono_threads_add_joinable_thread could be called multiple times for the the same tid.
This will work under Windows but is undefined behavior on POSIX's platforms.

This could happen if the finalizer thread calls mono_threads_join_threads when a thread
is detaching and have added itself to the joinable_threads, but before unregister_thread
has been called. Finalizer thread will then take tid from list and wait, this will cause
the second call to mono_threads_add_joinable_thread to not find itself in the joinable_threads
and add tid a second time. NOTE, this race only applies to runtime threads added to the
joinable_threads list.

Fix adds an additional method to add runtime threads to the list. This method will only add to
list if its indeed a runtime thread and doesn’t already have an outstanding pending native join
request. This method is called by code previously checking runtime_thread flag before adding to
joinable_threads list. This will prevent the scenario when the same MonoThreadInfo add its tid to
the joinable_threads list multiple times due to above race condition.

6 years agoMerge pull request #5640 from alexrp/master
Alex Rønne Petersen [Tue, 26 Sep 2017 14:38:51 +0000 (16:38 +0200)]
Merge pull request #5640 from alexrp/master

[profiler] Fix some buffer size calculations.

6 years ago[profiler] Fix some buffer size calculations.
Alex Rønne Petersen [Tue, 26 Sep 2017 11:43:28 +0000 (13:43 +0200)]
[profiler] Fix some buffer size calculations.

6 years ago[Tests] Fail with message in case symlink fails
Ludovic Henry [Mon, 25 Sep 2017 20:38:44 +0000 (16:38 -0400)]
[Tests] Fail with message in case symlink fails

6 years agoMerge pull request #5433 from lateralusX/lateralusX/windows-mono-debugger-soft-hang
Johan Lorensson [Tue, 26 Sep 2017 06:33:40 +0000 (08:33 +0200)]
Merge pull request #5433 from lateralusX/lateralusX/windows-mono-debugger-soft-hang

Fix sporadic hang in Mono.Debugger.Soft test suite on Windows.

6 years ago[w32handle] Only own first handle if doing WaitHandle.WaitAny (#5625)
Ludovic Henry [Tue, 26 Sep 2017 03:05:58 +0000 (23:05 -0400)]
[w32handle] Only own first handle if doing WaitHandle.WaitAny (#5625)

This is the behaviour on .NET, even if it goes against the documentation at https://msdn.microsoft.com/en-us/library/tdykks7z(v=vs.110).aspx#Anchor_2

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59281

6 years ago[wasm] Disable test due to emcc bug.
Rodrigo Kumpera [Tue, 26 Sep 2017 00:37:52 +0000 (17:37 -0700)]
[wasm] Disable test due to emcc bug.

6 years ago[wasm] Fix test_0_conv_i under interp.
Rodrigo Kumpera [Tue, 26 Sep 2017 00:01:37 +0000 (17:01 -0700)]
[wasm] Fix test_0_conv_i under interp.

6 years ago[mini] Fix bug categories.
Rodrigo Kumpera [Mon, 25 Sep 2017 23:35:05 +0000 (16:35 -0700)]
[mini] Fix bug categories.

6 years ago[wasm] Add ff signature
Rodrigo Kumpera [Mon, 25 Sep 2017 23:33:11 +0000 (16:33 -0700)]
[wasm] Add ff signature

6 years ago[interp] Don't inline empty calls that take vt arguments.
Rodrigo Kumpera [Mon, 25 Sep 2017 23:32:51 +0000 (16:32 -0700)]
[interp] Don't inline empty calls that take vt arguments.

6 years ago[runtime] Handle RuntimeWrappedException and dynamic methods using a SRE as module...
Rodrigo Kumpera [Mon, 25 Sep 2017 22:35:41 +0000 (15:35 -0700)]
[runtime] Handle RuntimeWrappedException and dynamic methods using a SRE as module. Fixes #59334

A DynamicMethod can be placed in a SRE module and it must respect any RuntimeCompatibilityAttribute set on that assembly.

We do that by updating the runtime side list of cattr in the AssemblyBuilder when a RuntimeCompatibilityAttribute is set using SetCustomAttribute.

6 years ago[class] Short circuit collect_implemented_interfaces_aux on gparams
Aleksey Kliger [Wed, 20 Sep 2017 21:34:59 +0000 (17:34 -0400)]
[class] Short circuit collect_implemented_interfaces_aux on gparams

and also setup_interface_offsets.

A gparam is never a real interface so we can just short circuit
if we see a gparam during interface collection.  (A gparam may be instantiated
with an interface --- but ginst interface offsets are processed anew when the
ginst is initialized in mono_class_init, not somehow extracted from the gtd and
the MonoGenericContext).

6 years ago[class] Mark mono_class_from_generic_parameter external only
Aleksey Kliger [Fri, 15 Sep 2017 14:27:44 +0000 (10:27 -0400)]
[class] Mark mono_class_from_generic_parameter external only

Runtime should use mono_class_from_generic_parameter_internal

6 years ago[runtime] Handle RuntimeWrappedException and dynamic methods.
Rodrigo Kumpera [Wed, 13 Sep 2017 23:12:57 +0000 (16:12 -0700)]
[runtime] Handle RuntimeWrappedException and dynamic methods.

Introduce MonoDynamicMethod that holds the assembly of a DM (and TB).
Use it to determine the RuntimeWrappedException policy for exceptions.

This is needed cuz the assembly of a MonoMethod is normally found using method->parent->image->assembly.

But this doesn't work with DynamicMethods that don't define an owner type as they are forced to corlib's policy.

The default policy for DM's is to not wrap those exceptions and in the case a Module is provided, the policy of that module must be respected.

This commit handles all cases but when a Module is a SRE module.

6 years ago[profiler] Add dedicated coverage profiler (#5622)
Ludovic Henry [Mon, 25 Sep 2017 16:27:47 +0000 (12:27 -0400)]
[profiler] Add dedicated coverage profiler (#5622)

This is to remove the need to depend on the log profiler and mprof-report to generate code coverage reports

6 years ago[ppc64] add instructions needed for builtin types
Bernhard Urban [Mon, 25 Sep 2017 11:32:52 +0000 (11:32 +0000)]
[ppc64] add instructions needed for builtin types

6 years ago[ppc] add native type support for float
Bernhard Urban [Wed, 20 Sep 2017 09:55:47 +0000 (11:55 +0200)]
[ppc] add native type support for float

6 years ago[ppc] add native type support for integer
Bernhard Urban [Wed, 20 Sep 2017 09:55:34 +0000 (11:55 +0200)]
[ppc] add native type support for integer

6 years agoAdd test projects (optional) to net_4_x.sln (#5633)
Egor Bogatov [Mon, 25 Sep 2017 14:02:36 +0000 (17:02 +0300)]
Add test projects (optional) to net_4_x.sln (#5633)

* add tests to net_4_x.sln

* remove redundant string.Format

6 years agoUpdated with review feedback.
lateralusX [Tue, 19 Sep 2017 15:17:23 +0000 (17:17 +0200)]
Updated with review feedback.

6 years agoAdded file license header and updated comments.
lateralusX [Thu, 14 Sep 2017 07:27:48 +0000 (09:27 +0200)]
Added file license header and updated comments.

6 years agoFixed typo in call to SignalObjectAndWait.
lateralusX [Wed, 13 Sep 2017 12:50:38 +0000 (14:50 +0200)]
Fixed typo in call to SignalObjectAndWait.

6 years agoFix sporadic hang in Mono.Debugger.Soft test suite on Windows.
lateralusX [Wed, 23 Aug 2017 08:38:56 +0000 (10:38 +0200)]
Fix sporadic hang in Mono.Debugger.Soft test suite on Windows.

Mono.Debugger.Soft has low frequency hangs in InspectThreadSuspenedOnWaitOne test.
This method launch the debuggee (dtest-app.exe), sets a breakpoint on a method just
doing an infinite OS wait, validate that the breakpoint gets hit and resumes debuggee.
After resume from breakpoint debuggee will hit the infinite OS wait and the debugger test
will suspend and shutdown the process.

In order for mono debugger to handle the shutdown request it will suspend all managed threads
using mono_thread_suspend_all_other_threads. This method uses a pooling schema until all threads
have reported that they are suspended. Since one of the threads are doing an infinite OS wait we
entered the land of APC (Asynchron Procedure Calls) used on Windows to alert waitable threads.

The reason for the hang is the fact that the OS won’t return from the wait until all queued APC’s
have been executed. Since the loop sending async suspend requests to the
threads mono_thread_suspend_all_other_threads can run faster (including suspending/resuming the
thread that need to consume APC’s in the process) then the dequeue and execute of the queued APC’s, the
wait won’t break, meaning that the thread won’t be able to set the mono suspend state causing the
mono_thread_suspend_all_other_threads to run forever. This is highly timing dependent and will only reproduce
sporadic, but I was able to isolate and do a solid repro locally while working on the fix.

The fix makes sure we don’t post a new suspend APC if there is already one in flight with a pending unhandled
interruption. This will make sure we won’t flood the APC queue on Windows preventing the thread from suspending.

6 years ago[jit] Fix constrained calls from gsharedvt methods using an interface type to vtype...
Zoltan Varga [Fri, 22 Sep 2017 22:44:10 +0000 (00:44 +0200)]
[jit] Fix constrained calls from gsharedvt methods using an interface type to vtype methods, the receiver is boxed, needs to be unboxed. Fixes #58507. (#5628)

6 years agoMerge pull request #5594 from BrzVlad/fix-domain-abort-hang
Vlad Brezae [Fri, 22 Sep 2017 22:04:03 +0000 (01:04 +0300)]
Merge pull request #5594 from BrzVlad/fix-domain-abort-hang

[runtime] AppDomain fixes

6 years ago[tests] Add tests for AppDomainUnloadedException handling
Vlad Brezae [Tue, 19 Sep 2017 22:39:38 +0000 (01:39 +0300)]
[tests] Add tests for AppDomainUnloadedException handling

As described on https://msdn.microsoft.com/en-us/library/system.appdomainunloadedexception(v=vs.110).aspx#Anchor_6

6 years ago[acceptance-tests] ms-test-suite: move systemruntimebringup tests to NUnit and add...
Alexander Köplinger [Fri, 22 Sep 2017 10:13:15 +0000 (12:13 +0200)]
[acceptance-tests] ms-test-suite: move systemruntimebringup tests to NUnit and add System.Linq.Expressions tests (#5624)

This gets rid of compiling ~300 executables which significantly cuts down build time.

Also added the System.Linq.Expressions which were not run before.

Changes: https://github.com/xamarin/ms-test-suite/compare/73c155f76b55839f26ba707d6d40091060e4f5d8...25f495326e141163d59e52ef499227a2f38fe036 (private repo)

6 years ago[linker-analyzer] added documentation
Radek Doulik [Thu, 21 Sep 2017 14:14:42 +0000 (16:14 +0200)]
[linker-analyzer] added documentation

6 years ago[tests] Add test for appdomain
Vlad Brezae [Fri, 15 Sep 2017 09:34:28 +0000 (12:34 +0300)]
[tests] Add test for appdomain

Tests that we can unload domain where the threads reset the abort exception and that this exception is converted to AppDomainUnloadedException in the caller domain.

6 years ago[runtime] Don't terminate application on unhandled AppDomainUnloadedException
Vlad Brezae [Thu, 14 Sep 2017 23:34:26 +0000 (02:34 +0300)]
[runtime] Don't terminate application on unhandled AppDomainUnloadedException

Except for threads started by unmanaged code (like the main thread).

6 years ago[runtime] Throw DomainUnloadedException exception when aborting appdomain thread
Vlad Brezae [Thu, 14 Sep 2017 21:58:16 +0000 (00:58 +0300)]
[runtime] Throw DomainUnloadedException exception when aborting appdomain thread

Before we were propagating the abort exception down in the calling domain.

6 years ago[remoting] Refactor xdispatch wrapper to use icall for exception conversion
Vlad Brezae [Thu, 14 Sep 2017 20:18:50 +0000 (23:18 +0300)]
[remoting] Refactor xdispatch wrapper to use icall for exception conversion

6 years ago[runtime] Ignore ResetAbort when the current appdomain is unloading
Vlad Brezae [Mon, 11 Sep 2017 19:26:28 +0000 (22:26 +0300)]
[runtime] Ignore ResetAbort when the current appdomain is unloading

Fixes #5804

6 years agoMerge pull request #5620 from mono/bump-bockbuild
Alexis Christoforides [Thu, 21 Sep 2017 20:18:01 +0000 (16:18 -0400)]
Merge pull request #5620 from mono/bump-bockbuild

Bump bockbuild to get gtk Japanese IME fixes

6 years agoBump bockbuild to get gtk Japanese IME fixes
Cody Russell [Thu, 21 Sep 2017 15:56:53 +0000 (10:56 -0500)]
Bump bockbuild to get gtk Japanese IME fixes

6 years agoMerge pull request #5608 from mono/xcode9_bockbuild_fix
Alexis Christoforides [Thu, 21 Sep 2017 15:30:29 +0000 (11:30 -0400)]
Merge pull request #5608 from mono/xcode9_bockbuild_fix

Update bockbuild for XCode 9 build fix

6 years ago[threads] Keep the tid after the thread has finished (#5615)
Ludovic Henry [Thu, 21 Sep 2017 13:03:18 +0000 (09:03 -0400)]
[threads] Keep the tid after the thread has finished (#5615)

6 years agoMerge pull request #5614 from alexrp/master
Alex Rønne Petersen [Thu, 21 Sep 2017 12:21:33 +0000 (14:21 +0200)]
Merge pull request #5614 from alexrp/master

[runtime] Fix shared-only build.

6 years agoUnlock `mini-trampolines.c`: (#5597)
Armin Hasitzka [Thu, 21 Sep 2017 12:04:33 +0000 (14:04 +0200)]
Unlock `mini-trampolines.c`: (#5597)

- have all counters in a global place and initialise them in `mono_trampolines_init ()`
- use `Unlocked* ()` and `mono_trampolines_lock ()` to mark / synchronise all racy counters

6 years ago[corlib] Fix 44255: Inconsistent results in the serialization of TimeZoneInfo. ...
Egor Bogatov [Thu, 21 Sep 2017 05:57:35 +0000 (08:57 +0300)]
[corlib] Fix 44255: Inconsistent results in the serialization of TimeZoneInfo.  (#5576)

6 years ago[mono-api-html] Print ref/out modifiers on parameters. Fixes #59430.
Rolf Bjarne Kvinge [Mon, 18 Sep 2017 12:34:55 +0000 (14:34 +0200)]
[mono-api-html] Print ref/out modifiers on parameters. Fixes #59430.

Print ref/out modifiers on parameters, so that any changes in ref/out are detected.

https://bugzilla.xamarin.com/show_bug.cgi?id=59430

6 years ago[runtime] Fix shared-only build.
Alex Rønne Petersen [Wed, 20 Sep 2017 20:13:28 +0000 (22:13 +0200)]
[runtime] Fix shared-only build.

6 years agoMark `mono_g_hash_table_max_chain_length` as known and accepted data race (#5520)
Armin Hasitzka [Wed, 20 Sep 2017 20:01:03 +0000 (22:01 +0200)]
Mark `mono_g_hash_table_max_chain_length` as known and accepted data race (#5520)

[TSan] Unlock mono_g_hash_table_max_chain_length

I would suggest using `Unlocked* ()` here. `mono_g_hash_table_find_slot ()` is called relatively often and, unlike increment or add operations, read and write operations (without a global surrounding lock) do not gain much (if anything) by being interlocked as long as they can be read and written by one instruction. That should be true for 32-bit integers and Mono's supported platforms.

6 years ago[TSan] Unlock fastpath when checking domains_to_finalize (#5598)
Armin Hasitzka [Wed, 20 Sep 2017 19:51:18 +0000 (21:51 +0200)]
[TSan] Unlock fastpath when checking domains_to_finalize (#5598)

[TSan] Unlock fastpath when checking domains_to_finalize

I understand that the affected line is a fastpath which seems absolutely fine to me as it is properly checked later. It is, however, rightfully, detected as a data race by Clang's ThreadSanitizer. I would, therefore, suggest using `UnlockedReadPointer ()` to mark this race as known + accepted.

6 years agoMerge pull request #5610 from alexrp/master
Alex Rønne Petersen [Wed, 20 Sep 2017 16:57:16 +0000 (18:57 +0200)]
Merge pull request #5610 from alexrp/master

[Mono.Profiler.Log] Some performance improvements.

6 years agofix for DSA
EgorBo [Tue, 19 Sep 2017 14:29:34 +0000 (17:29 +0300)]
fix for DSA

6 years agofix-38054
Egor Bogatov [Thu, 14 Sep 2017 17:36:59 +0000 (19:36 +0200)]
fix-38054

6 years ago[Mono.Profiler.Log] Use null references to indicate the absence of names.
Alex Rønne Petersen [Wed, 20 Sep 2017 12:33:46 +0000 (14:33 +0200)]
[Mono.Profiler.Log] Use null references to indicate the absence of names.

6 years ago[Mono.Profiler.Log] Load entire buffers before processing them.
Alex Rønne Petersen [Wed, 20 Sep 2017 12:32:07 +0000 (14:32 +0200)]
[Mono.Profiler.Log] Load entire buffers before processing them.

This should reduce the amount of I/O system calls we do, and should be fine
in terms of memory usage since the profiler tries to keep buffers small (64k),
and latency since the profiler flushes buffers every second.

This changes the API somewhat so that users no longer have to construct a
LogReader; this is now done internally, and the type is no longer public. Also,
the LogProcessor now leaves the given stream open, so it's up to the user to
close it.

6 years ago[Mono.Profiler.Log] Fix excessive byte array allocations.
Alex Rønne Petersen [Tue, 19 Sep 2017 18:32:26 +0000 (20:32 +0200)]
[Mono.Profiler.Log] Fix excessive byte array allocations.

The problem was that the base Stream.ReadByte () method allocates a temporary
byte array and then calls Read (..., 1) on it. To solve this, we override
ReadByte () in LogStream and use a private buffer to hold the result.

It's a bit of a mystery to me why Stream.ReadByte () does it this way. The
documentation for Stream explicitly says that instance methods aren't thread
safe, so it would be perfectly fine for Stream.ReadByte () to do what we do
here...

6 years agoMerge pull request #5528 from rodrmoya/fix-mono-profiler-lib
Alex Rønne Petersen [Tue, 19 Sep 2017 22:06:16 +0000 (00:06 +0200)]
Merge pull request #5528 from rodrmoya/fix-mono-profiler-lib

[Mono.Profiler.Log] Support MLPD version 13

6 years ago[Mono.Profiler.Log] Styling fixes
Rodrigo Moya [Tue, 19 Sep 2017 18:13:33 +0000 (20:13 +0200)]
[Mono.Profiler.Log] Styling fixes

6 years agoUpdate bockbuild for XCode 9 build fix
Alexis Christoforides [Tue, 19 Sep 2017 17:15:07 +0000 (13:15 -0400)]
Update bockbuild for XCode 9 build fix

6 years ago[verifier] Allow byref in PropertySig blobs. Fixes #59180
Rodrigo Kumpera [Tue, 12 Sep 2017 17:30:13 +0000 (10:30 -0700)]
[verifier] Allow byref in PropertySig blobs. Fixes #59180

6 years ago[WindowsBase] Fix exception type in *ValueSerializer.ConvertFromString with null...
Alexander Köplinger [Mon, 18 Sep 2017 19:14:22 +0000 (21:14 +0200)]
[WindowsBase] Fix exception type in *ValueSerializer.ConvertFromString with null parameter

ArgumentNullException was introduced by https://github.com/mono/mono/pull/5593
but it should be NotSupportedException instead to match with Windows .NET.

Similar change to what was noticed during review of https://github.com/mono/mono/pull/5343#discussion_r132166426.

6 years ago[WindowsBase] Use InvariantCulture for ConvertTo/ToString tests
Alexander Köplinger [Mon, 18 Sep 2017 18:58:44 +0000 (20:58 +0200)]
[WindowsBase] Use InvariantCulture for ConvertTo/ToString tests

They'd fail on locales such as de-DE before which uses ';' as separator.

6 years agoMerge pull request #5573 from lateralusX/lateralusX/windows-invalid-socket-error
Johan Lorensson [Tue, 19 Sep 2017 06:40:04 +0000 (08:40 +0200)]
Merge pull request #5573 from lateralusX/lateralusX/windows-invalid-socket-error

Fix sporadic failures in MonoTests.System.Net.HttpRequestStreamTest on x64 Windows.

6 years agoMerge pull request #5589 from marek-safar/tests
Marek Safar [Tue, 19 Sep 2017 06:25:45 +0000 (08:25 +0200)]
Merge pull request #5589 from marek-safar/tests

Update tests network helper to be reliable in multi-threaded tests

6 years ago[w32error] Add ENXIO -> ERROR_DEV_NOT_EXIST error translation
Bernhard Urban [Fri, 15 Sep 2017 16:19:27 +0000 (09:19 -0700)]
[w32error] Add ENXIO -> ERROR_DEV_NOT_EXIST error translation

Context: https://bugzilla.xamarin.com/show_bug.cgi?id=58738

6 years ago[System.Runtime.Remoting] Adds System.Core reference for tests
Marek Safar [Mon, 18 Sep 2017 17:28:07 +0000 (19:28 +0200)]
[System.Runtime.Remoting] Adds System.Core reference for tests

6 years agoUpdate tests network helper to be reliable in multi-threaded tests
Marek Safar [Fri, 15 Sep 2017 09:10:31 +0000 (11:10 +0200)]
Update tests network helper to be reliable in multi-threaded tests

6 years ago[msvc] Update csproj files (#5602)
monojenkins [Mon, 18 Sep 2017 15:39:55 +0000 (17:39 +0200)]
[msvc] Update csproj files (#5602)

6 years agoMulti-culture implementation ValueSerializers, Parse and ToString for types from...
Mikhail Filippov [Mon, 18 Sep 2017 14:56:44 +0000 (17:56 +0300)]
Multi-culture implementation ValueSerializers, Parse and ToString for types from WindowsBase. (#5593)

6 years ago[CI] Update Clang's ThreadSanitizer blacklist (#5558)
Armin Hasitzka [Mon, 18 Sep 2017 13:31:09 +0000 (15:31 +0200)]
[CI] Update Clang's ThreadSanitizer blacklist (#5558)

* Update clang-thread-sanitizer-blacklist based on races that can occur with commit 20bbf3208687b3f12582a35103bd6a6c9bb8a32e

* Add functions that came up in:
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/23/
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/24/
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/25/
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/26/

6 years agoInstall Microsoft.FSharp.NetSdk.props and targets (#5581)
Jason Imison [Mon, 18 Sep 2017 13:30:37 +0000 (15:30 +0200)]
Install Microsoft.FSharp.NetSdk.props and targets (#5581)

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57771

6 years ago[mono-api-html] Add solution.
Rolf Bjarne Kvinge [Mon, 18 Sep 2017 12:34:25 +0000 (14:34 +0200)]
[mono-api-html] Add solution.

It makes running mono-api-html from an IDE easier.

6 years ago[llvm] Map byref types to the same type as the this argument so they are called using...
Zoltan Varga [Sat, 16 Sep 2017 07:44:05 +0000 (03:44 -0400)]
[llvm] Map byref types to the same type as the this argument so they are called using the same signature if the this argument is passed explicitly. Fixes #59436. (#5572)

6 years ago[loader] Init MonoClass:sizes.element_size lazily (Fixes #43563) (#5559)
Aleksey Kliger (λgeek) [Fri, 15 Sep 2017 22:32:04 +0000 (18:32 -0400)]
[loader] Init MonoClass:sizes.element_size lazily (Fixes #43563) (#5559)

* [loader] If signaling recursive type initialize, don't double free

If we detect that a recursive type initialization is happening, we should leave
without removing the class from the init_pending_tld_id list.  Otherwise we get
a double-free when the outer recursive call finally finishes and tries to
remove the same element.

Also re-load the init_list from TLS since a recursive call to mono_class_init could
have modified it between the time the current mono_class_init call started and
when it is finishing.

* [loader] Improve error message when a field's type is a failed class

Add the class failure to the field failure error message.

* [tests] Check that runtime can represent recursive structs

Regression tests for https://bugzilla.xamarin.com/show_bug.cgi?id=43563

* [loader] Init MonoClass:sizes.element_size lazily (Fixes #43563)

Originally mono_bounded_array_class_get () would populate
MonoClass:sizes.element_size as soon as the MonoClass for the array was needed.
This is a problem because we cannot call mono_class_array_element_size () on
the element class on a valuetype until mono_class_layout_fields () finishes
initializing it.

That means that structs which contain an array of themselves would hit the
recursive initialization check in mono_class_setup_fields and the MonoClass for
the element class would be marked as failed to load.

Instead we rely on the MonoClass:size_inited bit to tell us whether the array
class has been initialized and if not, we set the array element size in
mono_class_layout_fields.

This is possible because MonoClass:sizes.element_size is only really needed to
know how to allocate space for an array.  When laying out a class that contains
an array we don't need the element size - they array is just a reference type.

Example:
```csharp
struct S {
    static S[][] foo;
}
```

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=43563

6 years ago[interp] disable assemblyresolve_event6.exe
Bernhard Urban [Fri, 15 Sep 2017 06:47:18 +0000 (08:47 +0200)]
[interp] disable assemblyresolve_event6.exe

needs working appdomains in the interpreter.

6 years ago[msbuild] Bump to get workaround for bxc #55697 . (#5591)
Ankit Jain [Fri, 15 Sep 2017 14:06:48 +0000 (10:06 -0400)]
[msbuild] Bump to get workaround for bxc #55697 . (#5591)

https://github.com/mono/msbuild/commit/8b76a1d2b9ffc493349a861962e44540ea14eaac

6 years ago[SWF] Allow to compile without X11 installed (Xamarin-59496)
Eberhard Beilharz [Thu, 14 Sep 2017 15:52:52 +0000 (17:52 +0200)]
[SWF] Allow to compile without X11 installed (Xamarin-59496)

This change fixes a crash we get in resgen when building without
X11 installed. The bug got introduced when fixing Xamarin-395.

Change-Id: If81a4a3ca4db7a1b0156480ad49bd61610ecebf0

6 years agoUpdate filters for new files added to Visual Studio projects.
lateralusX [Thu, 14 Sep 2017 09:22:25 +0000 (11:22 +0200)]
Update filters for new files added to Visual Studio projects.

6 years agoBump API snapshot submodule
monojenkins [Thu, 14 Sep 2017 19:54:19 +0000 (19:54 +0000)]
Bump API snapshot submodule

6 years ago[System]: SslStream.Flush() now flushes the underlying stream. Bug #57528. (#5569)
Martin Baulig [Thu, 14 Sep 2017 17:17:19 +0000 (13:17 -0400)]
[System]: SslStream.Flush() now flushes the underlying stream.  Bug #57528. (#5569)

* Mono.Security.Interface.IMonoSslStream: removed Flush().

* Mono.Net.Security.MobileAuthenticatedStream: Flush() now calls `InnerStream.Flush ()'.

* System.Net.Security.SslStream: Flush() now calls `InnerStream.Flush ()'.

* System.Net.Security.SslStream: fix `CanRead`, `CanWrite` and `CanTimeout` logic.

6 years ago[Mono.Security]: Add internal 'MonoTlsProviderFactory.InternalVersion' constant....
Martin Baulig [Thu, 14 Sep 2017 17:16:13 +0000 (13:16 -0400)]
[Mono.Security]: Add internal 'MonoTlsProviderFactory.InternalVersion' constant. (#5568)

Internal version number (not in any way related to the TLS Version).

Used by the web-tests to check whether the current Mono contains certain
features or bug fixes.

Negative version numbers are reserved for martin work branches.

6 years ago[Mono.Profiler.Log] Check MLPD version when reading header
Rodrigo Moya [Fri, 8 Sep 2017 17:36:20 +0000 (19:36 +0200)]
[Mono.Profiler.Log] Check MLPD version when reading header

Right now, when reading a MLPD of an old version, it just silently fails, so
throw an exception when the version is unsuported.

6 years ago[Mono.Profiler.Log] Reverse managed backtrace in SampleHitEvent's
Rodrigo Moya [Fri, 8 Sep 2017 10:36:58 +0000 (12:36 +0200)]
[Mono.Profiler.Log] Reverse managed backtrace in SampleHitEvent's

This comes in reverse order, compared to other backtraces in the MLPD, so
reverse it before sending it to visitors, so that it comes in the same
format as the rest of backtraces.

6 years agoInvalid handle exception during WSACleanup on shutdown.
lateralusX [Thu, 14 Sep 2017 09:20:27 +0000 (11:20 +0200)]
Invalid handle exception during WSACleanup on shutdown.

Running the MonoTests.System.Net.HttpRequestStreamTest under debugger reveals this
problem. WSACleanup is freeing an invalid handle as part of network shutdown.

This happens since mono_w32socket_close calls incorrect win32 API when closing sockets.
It currently calls CloseHandle, while it should call closesocket. This probably cause
problems in winsock book keeping of active sockets, and when closing the network layer,
winsock will try to close handles that it still open, but since the handles have already been closed
by incorrect call to CloseHandle, it will close an “invalid handle” either causing the exception
or even worse, close a different handle currently in use, causing undefined behavior
during the rest of mono shutdown.

Fix is to switch to correct API when closing sockets on Windows, closesocket instread of CloseHandle.

6 years agoFix sporadic failures in MonoTests.System.Net.HttpRequestStreamTest on x64 Windows.
lateralusX [Thu, 14 Sep 2017 09:06:38 +0000 (11:06 +0200)]
Fix sporadic failures in MonoTests.System.Net.HttpRequestStreamTest on x64 Windows.

MonoTests.System.Net.HttpRequestStreamTest suite has sporadic failures on Windows x64
with following exception:

System.Net.Sockets.SocketException : An operation was attempted on something that is not a socket.

This happens due to a data type and constant size mismatch. w32socket.h defines
INVALID_SOCKET and SOCKET_ERROR for all platforms. On Windows x64, SOCKET is defined
by winsock2.h as 64-bit type as well as INVALID_SOCKET constant, but above code will
define INVALID_SOCKET as a 32-bit constant value. This will in turn cause code to sporadically
fail to detect invalid sockets as returned by win32 API's. This will in turn cause the socket
exception when code continues to use socket as argument to win32 socket API’s.

Current “invalid” x64 codegen for expression:

if (sock == INVALID_SOCKET)

mov         eax,0FFFFFFFFh
cmp         rsi,rax

and with fixed defines, correct 64-bit cmp instruction:

cmp         rsi,0FFFFFFFFFFFFFFFFh

Fix makes sure we get the defines of INVALID_SOCKET and SOCKET_ERROR from winsock2.h
on Windows platforms to be consistent with define of SOCKET type.

6 years agoFix bug 4786 test.
Jon Purdy [Thu, 14 Sep 2017 00:09:19 +0000 (17:09 -0700)]
Fix bug 4786 test.

The fix in #5501 had a scoping error causing `make check` to fail.

6 years ago[Mono.Profiler.Log] Support MLPD version 13
Rodrigo Moya [Thu, 7 Sep 2017 20:16:13 +0000 (22:16 +0200)]
[Mono.Profiler.Log] Support MLPD version 13

The differences from v14 are small, and given it is the current "stable"
MLPD version, it's worth supporting it. The differences are:

* ImagePointer field not present in v13 Assembly*Event's
* In MonitorEvent, LogMonitorEvent is not in a separate field, but included
  as a flag in the extType field.
* SampleHitEvent's have a type field in v13, which was removed in v14, because
  only cycles samples are emitted.
* MONO_GC_EVENT_{MARK,RECLAIM}_{START,END} were removed in v14
* SampleUnmanagedBinary's SegmentPointer is not based on ptr_base in v13
* In v13, HeapRootsEvent's Attributes is (wrongly) a byte, in v14 this was
  fixed and changed back to a uleb128

6 years agoMerge pull request #5562 from alexrp/master
Alex Rønne Petersen [Wed, 13 Sep 2017 19:49:08 +0000 (21:49 +0200)]
Merge pull request #5562 from alexrp/master

[profiler] Revert the root_type field back to uleb128.

6 years agoMerge pull request #5550 from Cry-Miron/patch-1
Rodrigo Kumpera [Wed, 13 Sep 2017 17:07:34 +0000 (13:07 -0400)]
Merge pull request #5550 from Cry-Miron/patch-1

Fix issue where loaded global modules aren't freed

6 years agoBump ikdasm
Marek Safar [Wed, 13 Sep 2017 09:11:06 +0000 (11:11 +0200)]
Bump ikdasm

6 years ago[corlib] Update negative symbol for all cultures. Fixes #57496
Marek Safar [Tue, 12 Sep 2017 15:47:31 +0000 (17:47 +0200)]
[corlib] Update negative symbol for all cultures. Fixes #57496

6 years agoChanged indentation to K&R indentation
Cry-Miron [Wed, 13 Sep 2017 08:44:59 +0000 (10:44 +0200)]
Changed indentation to K&R indentation

6 years ago[Mono.Profiler.Log] Read root type field as uleb128.
Alex Rønne Petersen [Wed, 13 Sep 2017 07:17:45 +0000 (09:17 +0200)]
[Mono.Profiler.Log] Read root type field as uleb128.

6 years ago[profiler] Revert the root_type field back to uleb128.
Alex Rønne Petersen [Wed, 13 Sep 2017 07:16:40 +0000 (09:16 +0200)]
[profiler] Revert the root_type field back to uleb128.

It's actually a 32-bit value.

6 years ago[wasm] Disable tests that crashes the runtime for now
Rodrigo Kumpera [Tue, 12 Sep 2017 23:12:58 +0000 (16:12 -0700)]
[wasm] Disable tests that crashes the runtime for now