mono.git
6 years ago[runtime] Fix DISABLE_REFLECTION_EMIT build.
Rodrigo Kumpera [Wed, 27 Sep 2017 22:06:23 +0000 (15:06 -0700)]
[runtime] Fix DISABLE_REFLECTION_EMIT build.

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[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 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 agoMerge pull request #5544 from kumpera/verify_byref_return
Rodrigo Kumpera [Tue, 12 Sep 2017 21:13:56 +0000 (17:13 -0400)]
Merge pull request #5544 from kumpera/verify_byref_return

Implement verification of safe byref returns

6 years ago[msbuild] Bump msbuild to pick up SDK updates (#5548)
Ankit Jain [Tue, 12 Sep 2017 20:44:48 +0000 (16:44 -0400)]
[msbuild] Bump msbuild to pick up SDK updates (#5548)

6 years ago[runtime] Use no-op for SufficientExecutionStack on Linux (#5543)
Alexander Kyte [Tue, 12 Sep 2017 19:46:18 +0000 (15:46 -0400)]
[runtime] Use no-op for SufficientExecutionStack on Linux (#5543)

We had previously responded to bad performance on android by stubbing out
ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack
on android. This was necessary because the call to pthread_attr_getstack ()
will read /proc/self/maps. When used inside of a hot function, the performance is terrible.

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

6 years ago[verifier] Add test for structs.
Rodrigo Kumpera [Tue, 12 Sep 2017 17:39:38 +0000 (10:39 -0700)]
[verifier] Add test for structs.

6 years agoFix bug 57918:
Katelyn Gadd [Tue, 12 Sep 2017 00:26:04 +0000 (17:26 -0700)]
Fix bug 57918:
Async Socket reads that need to perform multiple underlying read operations fail to return a correct total # of bytes read

6 years agoMark operations on `shutting_down` as known and accepted data races
cherusker [Thu, 7 Sep 2017 09:25:09 +0000 (11:25 +0200)]
Mark operations on `shutting_down` as known and accepted data races

6 years ago[coop handles] Record backtrace when allocating handles when MONO_HANDLE_TRACK_OWNER...
Aleksey Kliger [Fri, 8 Sep 2017 18:24:05 +0000 (14:24 -0400)]
[coop handles] Record backtrace when allocating handles when MONO_HANDLE_TRACK_OWNER is defined

A backtrace that leads to the allocation site is helpful for debugging.

6 years ago[appdomain] Catch exceptions when invoking AppDomain.DoAssemblyResolve
Aleksey Kliger [Fri, 8 Sep 2017 18:21:53 +0000 (14:21 -0400)]
[appdomain] Catch exceptions when invoking AppDomain.DoAssemblyResolve

Otherwise we may leak a coop handle for the requesting assembly, which may
lead to an assertion when we unload the current domain.

6 years ago[test] Regression test for #58950
Aleksey Kliger [Fri, 8 Sep 2017 19:18:20 +0000 (15:18 -0400)]
[test] Regression test for #58950

If a reflection only assembly resolve event handler throws an exception, catch
the exception in the runtime to ensure that no coop handles leak.

6 years agoFix assert in module cleanup if nothing is cached
Cry-Miron [Tue, 12 Sep 2017 13:28:34 +0000 (15:28 +0200)]
Fix assert in module cleanup if nothing is cached

6 years agoFix issue where loaded global modules aren't freed
Cry-Miron [Tue, 12 Sep 2017 09:45:03 +0000 (11:45 +0200)]
Fix issue where loaded global modules aren't freed

Globally loaded modules would previously call LoadLibrary on Windows, but never FreeLibrary. This would result in said library keeping an internal reference counter of 1 until the application exited its entry-point, resulting in possible shutdown issues.

This commit makes sure that we correctly free modules (and unload them in the platform-specific APIs) whenever Mono itself is shutting down, ensuring the expected result of Mono-loaded libraries being correctly freed.

6 years ago[verifier] Fail to merge stacks with different safe byref'ness.
Rodrigo Kumpera [Mon, 11 Sep 2017 23:33:52 +0000 (16:33 -0700)]
[verifier] Fail to merge stacks with different safe byref'ness.

6 years ago[verifier] Implement verification of byref returns.
Rodrigo Kumpera [Mon, 11 Sep 2017 22:53:14 +0000 (15:53 -0700)]
[verifier] Implement verification of byref returns.

The verification algorithm is inspired on internal specs by the Roslyn team but adapted to what it generates today.
Here's how this patch works:

We introduce a new verification type, SAFE_BYREF, that's used for a byref value that is safe to return from the stack.

It's unverifiable to return a byref value that is not marked SAFE_BYREF.

We mark the following values are SAFE_BYREF:
- byref arguments, unless it's the `this` arg of a valuetype instance method
- return values of method calls when all byref arguments have SAFE_BYREF values - the this arg is ignored.
- the address of a static field (LDSFLDA)
- the address of an array element (LDELEMA)
- the address of a field if the receiver is either a SAFE_BYREF value or a reference

Notoriously from the above is the value of local variables. We took a conservative approach of unsafe tainting.
We do this by associating 3 states to a local: unassigned (initial value of zero), assigned and safe (SAFE_BYREF_LOCAL), assigned and unsafe (UNSAFE_BYREF_LOCAL)
When loading a local, we set its value as SAFE_BYREF if the local is in the SAFE_BYREF_LOCAL state.

When storing to a local, we set it to SAFE_BYREF_LOCAL if, only if, it's not marked as UNSAFE_BYREF_LOCAL and the value is SAFE_BYREF.
If we store a non-safe value to a local, we mark it as UNSAFE_BYREF_LOCAL.
If we store a non-safe value to a SAFE_BYREF_LOCAL local, we mark the method as unverifiable.

This algorithm makes sure we don't mix safe and unsafe byref and side with safety in case of control-flow dependent values.

6 years agoImplement stack overflow handling on Win64. Call _resetstkoflw to restore stack prote...
Jonathan Chambers [Mon, 11 Sep 2017 17:27:00 +0000 (13:27 -0400)]
Implement stack overflow handling on Win64. Call _resetstkoflw to restore stack protection before calling handler, and then jump to handler via a cached MonoContext. (#5472)

6 years ago[TSan] Interlock and unlock MonoJitStats (#5437)
Armin Hasitzka [Mon, 11 Sep 2017 14:35:03 +0000 (16:35 +0200)]
[TSan] Interlock and unlock MonoJitStats (#5437)

[TSan] Interlock and unlock MonoJitStats

This is the first part of telling TSan what to do with `MonoJitStats`; I dealt with all the `gint32` values and partly touched the `gboolean` value (see `FIXME`). However, `MonoJitStats` also contains `gdouble` which can (1) probably be interlocked and (2) will be updated in a later step, together with the `FIXME`, as soon as an updated version of the atomic interface exists.

I did my best to distinguish between perf. critical parts and parts where `Interlocked* ()` seems to work perfectly fine. As before, if I misjudged anything, I would kindly ask to comment the affected operations, and I will update them accordingly.

More (technical) details can be found in the commit messages.

6 years ago[System.Xaml] Fix deadlock on exception in XamlBackgroundReader
Alexander Köplinger [Fri, 8 Sep 2017 14:36:06 +0000 (16:36 +0200)]
[System.Xaml] Fix deadlock on exception in XamlBackgroundReader

The ManualResetEvent wouldn't be signaled when an exception happens
in the reader loop so we'd deadlock in Read().

I'm still investigating where the exception comes from but this
should at least help unblocking CI.

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

6 years agoMerge pull request #5504 from ntherning/wait-for-native-thread-to-die-in-Thread-Join
Niklas Therning [Mon, 11 Sep 2017 09:07:53 +0000 (11:07 +0200)]
Merge pull request #5504 from ntherning/wait-for-native-thread-to-die-in-Thread-Join

Wait for the native thread to die in Thread.Join() on Windows

6 years agoUpdate CONTRIBUTING.md (#5542)
Bernhard Urban [Mon, 11 Sep 2017 08:59:14 +0000 (10:59 +0200)]
Update CONTRIBUTING.md (#5542)

6 years ago[F#] Reinstate _DebugFileExt as it's needed for mobile debugging. (#5534)
Jason Imison [Fri, 8 Sep 2017 22:07:07 +0000 (00:07 +0200)]
[F#] Reinstate _DebugFileExt as it's needed for mobile debugging. (#5534)

Also added a mechanism for users to override DebugType

6 years agoMerge pull request #5428 from kumpera/wasm-support-p2
Rodrigo Kumpera [Fri, 8 Sep 2017 18:55:38 +0000 (14:55 -0400)]
Merge pull request #5428 from kumpera/wasm-support-p2

Mono Wasm support

6 years ago[threads] Fix "[threads] Fix leaking threads: SGen Worker and Finalizer (#5284)"...
Ludovic Henry [Fri, 8 Sep 2017 18:07:00 +0000 (14:07 -0400)]
[threads] Fix "[threads] Fix leaking threads: SGen Worker and Finalizer (#5284)" (#5532)

* Revert "[threads] Fix leaking threads: SGen Worker and Finalizer (#5284)"

The sgen-specific cleanup cannot be run before the sgen-agnostic cleanup

This reverts commit 7db0fb0c886f5157066e26c2e2ae2d39c338cf6b.

* [threads] Make sure we do not leak the finalizer and sgen threadpool threads

6 years agoF# portable debugging (#5531)
Jason Imison [Fri, 8 Sep 2017 12:38:29 +0000 (14:38 +0200)]
F# portable debugging (#5531)

* Switch F# builds over to portable pdb

* Add portable pdb metadata fix from https://github.com/Microsoft/visualfsharp/pull/3553

6 years ago[Tests] Fix Mono.Data.Tds tests on iOS (#5501)
Manuel de la Pena [Fri, 8 Sep 2017 11:05:48 +0000 (13:05 +0200)]
[Tests] Fix Mono.Data.Tds tests on iOS (#5501)

* [Tests] Fix Mono.Data.Tds tests on iOS

The modified tests failed on iOS following PR:
https://github.com/xamarin/xamarin-macios/pull/2580 that adds support
for Xharness to run the Mono.Data.Tds on Xamarin.iOS. With the changes
the tests run a expected.

* Close Listener when done.

6 years ago[TSan] Tackle MonoPerfCounters (#5413)
Armin Hasitzka [Fri, 8 Sep 2017 09:20:28 +0000 (11:20 +0200)]
[TSan] Tackle MonoPerfCounters (#5413)

[TSan] Tackle MonoPerfCounters

With `MonoPerfCounters` taking part in many races, I thought it's finally time to attend to it. If I am not mistaken, most (if not all) load / store operations can be interlocked. If I am wrong, I would kindly ask to quickly comment the respective perf. critial operations and I will change them to `Unlocked* ()`.

Furthermore, a few details:

* updated all fields to signed types as `Interlocked* ()` functions exist for these types already
* upgraded a few values to `64-bit` as other `64-bit` values are assigned to them
* fixed a few `FIXME`s in `predef_writable_update ()` that were connected to `Interlocked* ()` functions

6 years agoUpdate man page
Miguel de Icaza [Thu, 7 Sep 2017 20:40:43 +0000 (16:40 -0400)]
Update man page

6 years agoShorter
Miguel de Icaza [Thu, 7 Sep 2017 19:17:00 +0000 (15:17 -0400)]
Shorter

6 years agoToggle the turbo button
Miguel de Icaza [Thu, 7 Sep 2017 19:13:39 +0000 (15:13 -0400)]
Toggle the turbo button