mono.git
7 years agoMerge pull request #3422 from xmcclure/tarjan-doublefan
monojenkins [Mon, 29 Aug 2016 20:30:06 +0000 (22:30 +0200)]
Merge pull request #3422 from xmcclure/tarjan-doublefan

Make GC bridge perform well in the "double fan" scenario

The GC bridge currently performs VERY poorly when the object graph has a "double fan" shape. If M Java objects point to 1 C# object which points to N Java objects, the graph exported to Monodroid will currently drop the C# object node and replace it with (M\*N) edges. It is easy to write code where (M\*N) grows ludicrously big.

In testing on device, this patch solves that problem while leaving other cases unaffected. In testing on device, I found:
* All performance tests except double fan: No discernible performance difference after patch
* Double fan test with M=N=1000: Before the patch this took between three and seven seconds. After the patch this took between 0.2 and 0.3 seconds.
* Double fan test with M=N=4000: Before the patch this took anywhere from one to two minutes. After the patch, this took about 1.2 seconds.
* Double fan test with M=N=6000: Before the patch, this took so long I was not able to get it to ever complete. After the patch, this took about 1.3 seconds.
* Double fan test with M=N=20000: I did not attempt this test pre-patch. After the patch, it took about 5.6 seconds.

The commit messages describe the changes in some detail but the short version is:
* Add a mechanism for exporting non-bridged SCCs to the bridge client
* Turn that mechanism on whenever the product fanin*fanout grows too large
* Make the merge cache more aggressive

To function, this patch requires a corresponding change to monodroid. See https://github.com/xamarin/xamarin-android/pull/154

7 years ago[Facades] Remove private facade
Marek Safar [Mon, 29 Aug 2016 19:40:50 +0000 (21:40 +0200)]
[Facades] Remove private facade

7 years agoMerge pull request #3463 from david-mitchell/al-platform-switch
Marek Safar [Mon, 29 Aug 2016 19:31:33 +0000 (21:31 +0200)]
Merge pull request #3463 from david-mitchell/al-platform-switch

Add missing switch and functionality to al.

7 years agoGC bridge: Fix non-buildable assert ()s added in previous commits
Andi McClure [Mon, 29 Aug 2016 18:34:22 +0000 (14:34 -0400)]
GC bridge: Fix non-buildable assert ()s added in previous commits

7 years agoMerge pull request #3468 from alexrp/hwcap-improvements
Alex Rønne Petersen [Mon, 29 Aug 2016 18:26:46 +0000 (20:26 +0200)]
Merge pull request #3468 from alexrp/hwcap-improvements

[utils/hwcap] Clean up and improve the hwcap code.

7 years agoGC bridge: Move bridge-require-precise-merge to MONO_GC_PARAMS
Andi McClure [Mon, 29 Aug 2016 17:48:48 +0000 (13:48 -0400)]
GC bridge: Move bridge-require-precise-merge to MONO_GC_PARAMS

This was previously in MONO_GC_DEBUG, but we do not use this for
production-viable flags.

7 years ago[corlib] Improve CanceledContinuationExecuteSynchronouslyTest test
Marek Safar [Mon, 29 Aug 2016 16:39:14 +0000 (18:39 +0200)]
[corlib] Improve CanceledContinuationExecuteSynchronouslyTest test

7 years agoAdd missing switch and functionality to al.
David Mitchell [Fri, 26 Aug 2016 23:24:32 +0000 (16:24 -0700)]
Add missing switch and functionality to al.

When running msbuild on mono against an architecture-specific
project that also defines satellite assemblies, the /platform
switch will be passed to al.exe. Mono's implementation of al.exe
does not support this switch, which results in a failed build.

This commit adds the /platform switch, which also required
changing the implementation from System.Reflection to
IKVM.Reflection because Mono's implementation of AssemblyBuilder
does not support the necessary options.

While testing this change, I also noticed a few attributes that
the MS version of al.exe will copy from "template" assemblies,
so I added support for those, as well.

7 years ago[mcs] Add reference to parent storey when current value type async storey needs fabri...
Marek Safar [Mon, 29 Aug 2016 16:01:39 +0000 (18:01 +0200)]
[mcs] Add reference to parent storey when current value type async storey needs fabricated this access. Fixes #40860

7 years ago[llvm] Fix the arm cross compiler build when using llvm 3.9.
Zoltan Varga [Mon, 29 Aug 2016 14:49:05 +0000 (16:49 +0200)]
[llvm] Fix the arm cross compiler build when using llvm 3.9.

7 years agoMerge pull request #3453 from ntherning/cleanup-AssemblyTest-temp-file-handling
Marek Safar [Mon, 29 Aug 2016 14:46:04 +0000 (16:46 +0200)]
Merge pull request #3453 from ntherning/cleanup-AssemblyTest-temp-file-handling

Cleanup temp file handling in AssemblyTest

7 years agoCleanup temp file handling in AssemblyTest
Niklas Therning [Thu, 25 Aug 2016 15:33:14 +0000 (17:33 +0200)]
Cleanup temp file handling in AssemblyTest

SetUp() already sets up a temp folder for the test methods and TearDown()
handles cleaning up and taking into account that on Windows, loaded assemblies
cannot be deleted. However, some of the tests created temp files outside of
this folder and had their own cleanup code which didn't expect temp files to
be undeletable on Windows.

This patch removes any custom temp file creation/cleanup from individual test
methods. It also slightly changes the way SetUp() created the temp folder for
each test, now the paths will be shallower.

7 years ago[utils/hwcap] Clean up and improve the hwcap code.
Alex Rønne Petersen [Thu, 28 Jul 2016 15:26:49 +0000 (17:26 +0200)]
[utils/hwcap] Clean up and improve the hwcap code.

* Get rid of the arch-specific headers.
* Do verbose printing in one place.
* Simplify the cross compilation case to avoid repetition.
* Define all variables with a macro in a single header.
* Print detected hwcap info via g_print () so it's visible on mobile.
* Expose plain bool variables in the s390x implementation.

7 years ago[runtime] Bundle support, implement missing stream processing (#3423)
Miguel de Icaza [Sun, 28 Aug 2016 01:51:53 +0000 (21:51 -0400)]
[runtime] Bundle support, implement missing stream processing (#3423)

7 years ago[corlib] Fix Marshal test to not rely on Assert.Less
Alexander Köplinger [Sat, 27 Aug 2016 19:24:10 +0000 (21:24 +0200)]
[corlib] Fix Marshal test to not rely on Assert.Less

It doesn't work on nunitlite e.g. on XA:

```
src/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs(268,11): error CS0117: `NUnit.Framework.Assert' does not contain a definition for `Less'
```

7 years ago[runtime] ves_icall_AssemblyBuilder_InternalAddModule is dead code (#3461)
Aleksey Kliger (λgeek) [Fri, 26 Aug 2016 21:46:11 +0000 (17:46 -0400)]
[runtime] ves_icall_AssemblyBuilder_InternalAddModule is dead code (#3461)

There is no System.Refleciton.Emit.AssemblyBuilder::InternalAddModule method

7 years agoMerge pull request #3451 from BrzVlad/fix-armel-emulation
Vlad Brezae [Fri, 26 Aug 2016 20:57:29 +0000 (23:57 +0300)]
Merge pull request #3451 from BrzVlad/fix-armel-emulation

[arm] Fix armel no fp

7 years agoMerge pull request #3460 from akoeplinger/remove-net_4_5-ifdef
Alexander Köplinger [Fri, 26 Aug 2016 19:21:55 +0000 (21:21 +0200)]
Merge pull request #3460 from akoeplinger/remove-net_4_5-ifdef

[mcs] Remove NET_4_5 ifdef from the source files

7 years agoMerge pull request #3459 from akoeplinger/fix-parameter-names
Alexander Köplinger [Fri, 26 Aug 2016 19:18:07 +0000 (21:18 +0200)]
Merge pull request #3459 from akoeplinger/fix-parameter-names

[bcl] Fix method parameter names to match .NET

7 years agoMerge pull request #3457 from akoeplinger/fix-gethrforexception
Alexander Köplinger [Fri, 26 Aug 2016 18:58:59 +0000 (20:58 +0200)]
Merge pull request #3457 from akoeplinger/fix-gethrforexception

[corlib] Return e.HResult instead of PlatformNotSupportedException/-1 for Marshal.GetHRForException

7 years agoPR feedback: Add a runtime switch for the aggressive SCC merging
Andi McClure [Fri, 26 Aug 2016 18:13:44 +0000 (14:13 -0400)]
PR feedback: Add a runtime switch for the aggressive SCC merging

Previously every time we add a new runtime setting for the bridge
processor we have added a new callback for it. Because this is getting
unweildy, and also because some of these settings might have been
broken by recent init order changes, I created a new set_config
callback and merged the existing set_dump_prefix and enable_processing
with it.

7 years agoPR feedback: Corrections to aggressive merge cache
Andi McClure [Fri, 26 Aug 2016 19:00:37 +0000 (15:00 -0400)]
PR feedback: Corrections to aggressive merge cache

hash_perturb was being mixed in in the wrong place. Fix that, also
make the hash function take some input from high bits on 64-bit
systems, also make the types around the hash more reasonable.

7 years ago[sre] Remove TypeBuilder::create_internal_class () icall, it doesn't seem to be neede...
Zoltan Varga [Fri, 26 Aug 2016 17:56:12 +0000 (19:56 +0200)]
[sre] Remove TypeBuilder::create_internal_class () icall, it doesn't seem to be needed. (#3458)

7 years ago[bcl] Fix method parameter names to match .NET
Alexander Köplinger [Fri, 26 Aug 2016 13:33:35 +0000 (15:33 +0200)]
[bcl] Fix method parameter names to match .NET

The names were fixed only for the subset of methods that are included in netstandard,
and in cases where netstandard differs from Desktop .NET we match with .NET.

7 years agoFix tarball build
Alexander Köplinger [Fri, 26 Aug 2016 15:31:12 +0000 (17:31 +0200)]
Fix tarball build

emitnunit.pl was removed in d3129a762419ea579de7e35a36b3471e35e5a75c

7 years ago[corlib] Return e.HResult instead of PlatformNotSupportedException/-1 for Marshal...
Alexander Köplinger [Fri, 26 Aug 2016 10:22:10 +0000 (12:22 +0200)]
[corlib] Return e.HResult instead of PlatformNotSupportedException/-1 for Marshal.GetHRForException

Follow what coreclr/corefx does now: https://github.com/dotnet/coreclr/pull/6929.

7 years ago[runtime] Remove most of the contents of MonoDynamicGenericClass, the… (#3441)
Zoltan Varga [Fri, 26 Aug 2016 10:32:05 +0000 (12:32 +0200)]
[runtime] Remove most of the contents of MonoDynamicGenericClass, the… (#3441)

* [runtime] Remove most of the contents of MonoDynamicGenericClass, the elements of the 'fields' array are not used anywhere, making all the other fields unneccesary too.

* [runtime] Remove the MonoDynamicGenericClass structure, merge it into MonoGenericClass. Add some comments.

7 years ago[jit] Add an assert to the native types code to make sure we are using the matching...
Zoltan Varga [Fri, 26 Aug 2016 10:02:54 +0000 (12:02 +0200)]
[jit] Add an assert to the native types code to make sure we are using the matching managed assembly.

7 years ago[llvmonly] Initialize native-to-managed wrappers when they are loaded instead of...
Zoltan Varga [Thu, 25 Aug 2016 20:18:45 +0000 (22:18 +0200)]
[llvmonly] Initialize native-to-managed wrappers when they are loaded instead of on the first call, since the call might be made on a thread not attached to the runtime. Fixes #43357.

7 years ago[jit] Fix an assertion on amd64 when using fixed size buffers and pinvoke. Fixes...
Zoltan Varga [Thu, 25 Aug 2016 18:35:08 +0000 (20:35 +0200)]
[jit] Fix an assertion on amd64 when using fixed size buffers and pinvoke. Fixes #33571.

7 years ago[corcompare] Show extension argument changes. Make parameter name difference breaking...
Marek Safar [Thu, 25 Aug 2016 16:27:45 +0000 (18:27 +0200)]
[corcompare] Show extension argument changes. Make parameter name difference breaking change.

7 years ago[mcs] Don't crash when as operand cannot be resolved. Fixes #43718
Marek Safar [Thu, 25 Aug 2016 15:55:54 +0000 (17:55 +0200)]
[mcs] Don't crash when as operand cannot be resolved. Fixes #43718

7 years ago[mcs] Correctly detect catch resume point marker in scope of resume points. Fixes...
Marek Safar [Thu, 25 Aug 2016 15:23:27 +0000 (17:23 +0200)]
[mcs] Correctly detect catch resume point marker in scope of resume points. Fixes #43636

7 years agoMerge pull request #3447 from ludovic-henry/iolayer-extract-threading
Ludovic Henry [Thu, 25 Aug 2016 13:55:15 +0000 (15:55 +0200)]
Merge pull request #3447 from ludovic-henry/iolayer-extract-threading

[threads] Get thread handle from MonoThreadInfo when attaching

7 years ago[jit] Don't lower store_r4 and load_r4 on armel with no fp
Vlad Brezae [Thu, 25 Aug 2016 10:45:38 +0000 (10:45 +0000)]
[jit] Don't lower store_r4 and load_r4 on armel with no fp

When having a float variable in memory, we should always access its contents through the fload_r4/fstore_r4 funcs, which do the conversion between float and double and different memsize vs var size. It is common case, to have a temp float, have its address loaded with ldaddr and later do a load_r4_membase on that address to access the contents. If alias analyis lowers this load_r4_membase to an op_fmove directly on the register pair, this would in turn be decomposed into 2 simple int op_moves on soft float, which is wrong if these op_moves are converted to memory accesses.

7 years agoMerge pull request #3449 from lateralusX/jlorenss/win-add-missing-source-file
João Matos [Thu, 25 Aug 2016 10:39:54 +0000 (11:39 +0100)]
Merge pull request #3449 from lateralusX/jlorenss/win-add-missing-source-file

Add missing source file, sgen-os-coop.c, to libmonoruntime Visual Studio project.

7 years ago[arm] Fix opcode emulation on armel with no fp
Vlad Brezae [Thu, 25 Aug 2016 10:15:16 +0000 (10:15 +0000)]
[arm] Fix opcode emulation on armel with no fp

Even though we register emulations for these opcodes, the native function doesn't not map to the opcode logic, being used instead as part of the opcode decomposition along with other instructions. Make sure we don't try to emulate these opcodes through the general emulation pass.

7 years agoAdd missing source file, sgen-os-coop.c, to libmonoruntime Visual Studio project.
lateralusX [Thu, 25 Aug 2016 09:14:33 +0000 (11:14 +0200)]
Add missing source file, sgen-os-coop.c, to libmonoruntime Visual Studio project.

Add missing source file, sgen-os-coop.c to project.

Add source files and headers into correct filters (Header/Source Files).

Eliminated Visual Studio linker warning LNK4221 for libmonoruntime project generated
by empty source files under certain configurations, boehm-gc.c, lock-tracer.c,
null-gc.c and sgen-os-coop.c

7 years agoMerge pull request #3437 from ntherning/fix-DirectoryNotFoundException-thrown-in...
Alexander Köplinger [Wed, 24 Aug 2016 21:38:29 +0000 (23:38 +0200)]
Merge pull request #3437 from ntherning/fix-DirectoryNotFoundException-thrown-in-FileInfoTest.MoveTo_DestFileName_DirectoryDoesNotExist-on-windows

FileInfo.MoveTo() throws DirectoryNotFoundException rather than FileNotFoundException on Windows when target doesn't exist

7 years agoPR feedback: Formatting, comments, asserts
Andi McClure [Wed, 24 Aug 2016 19:33:00 +0000 (15:33 -0400)]
PR feedback: Formatting, comments, asserts

7 years ago[threads] Get thread handle from MonoThreadInfo when attaching
Ludovic Henry [Thu, 14 Jul 2016 16:36:54 +0000 (18:36 +0200)]
[threads] Get thread handle from MonoThreadInfo when attaching

7 years agoMerge pull request #3439 from ludovic-henry/iolayer-extract-threading
Ludovic Henry [Wed, 24 Aug 2016 18:54:04 +0000 (20:54 +0200)]
Merge pull request #3439 from ludovic-henry/iolayer-extract-threading

[mono-threads] Create Win32 handle when attaching the thread

7 years agoMerge pull request #3444 from akoeplinger/fix-netstandard-extensions
Alexander Köplinger [Wed, 24 Aug 2016 18:05:08 +0000 (20:05 +0200)]
Merge pull request #3444 from akoeplinger/fix-netstandard-extensions

[Facades] Implement methods for *Extensions types that are available on the extended type

7 years ago[mini] Wrap error output for NUnit xml in CDATA section
Alexander Köplinger [Wed, 24 Aug 2016 16:35:57 +0000 (18:35 +0200)]
[mini] Wrap error output for NUnit xml in CDATA section

Makes sure that characters like <> (which appear in stack traces) don't confuse the XML parser.

7 years ago[monosymbolicate] Add pdb detection
Marek Safar [Wed, 24 Aug 2016 15:05:04 +0000 (17:05 +0200)]
[monosymbolicate] Add pdb detection

7 years ago[mono-threads-windows] Allocate ThreadStartInfo on the stack
Ludovic Henry [Tue, 23 Aug 2016 17:13:23 +0000 (19:13 +0200)]
[mono-threads-windows] Allocate ThreadStartInfo on the stack

7 years ago[mono-threads] Create Win32 handle when attaching the thread
Ludovic Henry [Wed, 13 Jul 2016 15:19:36 +0000 (17:19 +0200)]
[mono-threads] Create Win32 handle when attaching the thread

This guarantee that a MonoThreadInfo always has a handle.

7 years ago[w32handle] Remove unused assertions
Ludovic Henry [Wed, 24 Aug 2016 13:45:08 +0000 (15:45 +0200)]
[w32handle] Remove unused assertions

7 years ago[w32handle] Initialize them earlier
Ludovic Henry [Wed, 24 Aug 2016 10:09:08 +0000 (12:09 +0200)]
[w32handle] Initialize them earlier

If we happen to have the debugger or the log profiler enabled, we would run into a use before initialization case for the w32handle. The debugger or profiler would call `mono_gc_base_init` which would attach the current thread, and that would crash in `mono_w32handle_new` at w32handle.c:437 with `scan_mutex` being an invalid value (EINVAL).

7 years agoMerge pull request #3445 from rolfbjarne/cecil-update
Marek Safar [Wed, 24 Aug 2016 14:11:50 +0000 (16:11 +0200)]
Merge pull request #3445 from rolfbjarne/cecil-update

[tuner/linker] Update code to fix build errors after cecil update.

7 years agoRevert "[corcompare] Reflects cecil breaking changes"
Marek Safar [Wed, 24 Aug 2016 14:08:25 +0000 (16:08 +0200)]
Revert "[corcompare] Reflects cecil breaking changes"

This reverts commit b0ec389b68300278163dc31949ad747e0e206cca.

7 years ago[tuner/linker] Update code to fix warnings after cecil update.
Rolf Bjarne Kvinge [Wed, 24 Aug 2016 13:56:43 +0000 (15:56 +0200)]
[tuner/linker] Update code to fix warnings after cecil update.

7 years ago[corcompare] Reflects cecil breaking changes
Marek Safar [Wed, 24 Aug 2016 13:16:17 +0000 (15:16 +0200)]
[corcompare] Reflects cecil breaking changes

7 years agoFileInfo.MoveTo() throws DirectoryNotFoundException rather than
Niklas Therning [Tue, 23 Aug 2016 14:19:11 +0000 (16:19 +0200)]
FileInfo.MoveTo() throws DirectoryNotFoundException rather than
FileNotFoundException on Mono on Windows and on .NET when target doesn't exist

FileInfoTest.MoveTo_DestFileName_DirectoryDoesNotExist() expects
FileNotFoundException to be thrown but on Windows a DirectoryNotFoundException
is thrown instead.

This patch changes MoveFile() in mono/io-layer/io.c to set the last error to
ERROR_PATH_NOT_FOUND rather than ERROR_FILE_NOT_FOUND when the destination
path doesn't exist. This results in a DirectoryNotFoundException being thrown
in managed code rather than FileNotFoundException. This is the behaviour
observed in .NET.

Also updated FileInfoTest.MoveTo_DestFileName_DirectoryDoesNotExist() to check
for DirectoryNotFoundException rather than FileNotFoundException.

7 years agoMerge pull request #3443 from ntherning/do-not-pass-FILE_FLAG_OVERLAPPED-to-CreateFile
Niklas Therning [Wed, 24 Aug 2016 13:02:04 +0000 (15:02 +0200)]
Merge pull request #3443 from ntherning/do-not-pass-FILE_FLAG_OVERLAPPED-to-CreateFile

Don't pass FILE_FLAG_OVERLAPPED to CreateFile()

7 years ago[Facades] Add argument null validation for extension methods
Alexander Köplinger [Wed, 24 Aug 2016 12:50:21 +0000 (14:50 +0200)]
[Facades] Add argument null validation for extension methods

7 years ago[Facades] Implement methods for *Extensions types that are available on the extended...
Alexander Köplinger [Wed, 24 Aug 2016 11:51:20 +0000 (13:51 +0200)]
[Facades] Implement methods for *Extensions types that are available on the extended type

The methods are already available in our implementations of those types so we can just forward the calls
to the "real" types instead of throwing NotImplementedException.

I audited all code in mcs/class/Facades and the only places where we still throw NotImplementedException
are ones where we really need to add a custom implementation.

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

7 years ago[Facades] Make sure "this" is added to the type extensions
Alexander Köplinger [Wed, 24 Aug 2016 11:44:55 +0000 (13:44 +0200)]
[Facades] Make sure "this" is added to the type extensions

It was missing on a few methods.

7 years ago[Facades] Throw PlatformNotSupportedException instead of NotImplementedException...
Alexander Köplinger [Wed, 24 Aug 2016 11:43:29 +0000 (13:43 +0200)]
[Facades] Throw PlatformNotSupportedException instead of NotImplementedException for ServiceController on mobile

It's unlikely the ServiceController APIs will be supported on mobile since they don't really make sense there,
they were initially designed for controlling Windows Services.

7 years agoMerge pull request #3436 from ntherning/fix-alt-dir-separator-not-replaced-in-Path...
Marek Safar [Wed, 24 Aug 2016 11:17:24 +0000 (13:17 +0200)]
Merge pull request #3436 from ntherning/fix-alt-dir-separator-not-replaced-in-Path.CleanPath

Path.CleanPath() does not always replace AltDirectorySeparatorChar

7 years ago[linker] Mark declaring types of nested types resolved from xml descriptors. Fixes...
Rolf Bjarne Kvinge [Wed, 24 Aug 2016 10:12:48 +0000 (12:12 +0200)]
[linker] Mark declaring types of nested types resolved from xml descriptors. Fixes #43658. (#3434)

If the declaring type of a nested type marked by an xml descriptor
is not otherwise marked, the members of the nested type will not
be preserved, because the linker will not process the nested type
(since the parent type isn't marked, MarkStep:InitializeAssembly
will skip it, and thus skip akk its nested types as well).

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

7 years agoPath.CleanPath() does not always replace AltDirectorySeparatorChar
Niklas Therning [Tue, 23 Aug 2016 13:54:09 +0000 (15:54 +0200)]
Path.CleanPath() does not always replace AltDirectorySeparatorChar

If sub == 0, i.e. there are no repeated separators, this method just returns
the input string. On Windows, where DirectorySeparatorChar (\) is different
from AltDirectorySeparatorChar (/), this means that the call

    Path.GetDirectoryName ("foo/bar/dingus")

won't return "foo\bar" as .NET would but rather returns "foo/bar".

This patch makes sure the '/' -> '\' conversion is run when
AltDirectorySeparatorChar characters have been seen in the input string, even
if sub == 0.

PathTest.GetDirectoryName() triggered this bug.

7 years agoDon't pass FILE_FLAG_OVERLAPPED to CreateFile()
Niklas Therning [Wed, 24 Aug 2016 08:49:23 +0000 (10:49 +0200)]
Don't pass FILE_FLAG_OVERLAPPED to CreateFile()

When a FileStream is opened with the FileOptions.Asynchronous flag set the
code in file-io.c will pass FILE_FLAG_OVERLAPPED to the CreateFile() function.
On Windows this means the file will be in asynchronous mode and when
ReadFile()/WriteFile() are called an OVERLAPPED struct has to be passed. Mono
doesn't do this which means that when reading/writing asynchronous FileStreams
Windows returns an ERROR_INVALID_PARAMETER and an exception is raised in
managed code.

This patch simply removes the code which passes the FILE_FLAG_OVERLAPPED to
CreateFile(). This will work since asynchronous I/O is handled in managed code
anyway, using threads. On the OS level the I/O is still synchronous. The patch
won't affect other platforms since the implementation of
ReadFile()/WriteFile()/etc in mono/io-layer/, which is used on non-Windows, is
always synchronous and ignores the FILE_FLAG_OVERLAPPED.

This bug was triggered by the
MonoTests.System.IO.BinaryWriterTest.AsynchronousModeWrites test.

7 years ago[bcl] More netstandard api matching
Marek Safar [Tue, 23 Aug 2016 22:26:23 +0000 (00:26 +0200)]
[bcl] More netstandard api matching

7 years agoMerge pull request #3430 from akoeplinger/simplify-mini-nunit
Alexander Köplinger [Tue, 23 Aug 2016 19:02:54 +0000 (21:02 +0200)]
Merge pull request #3430 from akoeplinger/simplify-mini-nunit

[mini] Replace emitnunit.pl with simpler Makefile-based xml generation

7 years agoMerge pull request #3431 from mhutch/fix-targetframeworkattribute
Alexander Köplinger [Tue, 23 Aug 2016 17:20:31 +0000 (19:20 +0200)]
Merge pull request #3431 from mhutch/fix-targetframeworkattribute

[xbuild] Fix incremental build of TargetFrameworkAttribute

7 years agoMerge pull request #3435 from ntherning/fix-DirectoryInfoTest-assumes-current-dir...
Niklas Therning [Tue, 23 Aug 2016 14:46:27 +0000 (16:46 +0200)]
Merge pull request #3435 from ntherning/fix-DirectoryInfoTest-assumes-current-dir-is-c-on-windows

Fix for DirectoryInfoTest assuming current dir is C:\ on Windows

7 years agoFix for DirectoryInfoTest assuming current dir is C:\ on Windows
Niklas Therning [Tue, 23 Aug 2016 13:44:54 +0000 (15:44 +0200)]
Fix for DirectoryInfoTest assuming current dir is C:\ on Windows

This test assumes that `new DirectoryInfo (@"c:").Name == "C:\"` when run on
Windows but the actual value depends on the current directory. If current dir
is C:\temp the Name property will return "temp". Similar problem in the
FullName() and Parent() tests.

This patch sets the current directory to C:\ explicitly before running the
failing tests on Windows. The current dir is reset in TearDown().

7 years ago[mini] Replace emitnunit.pl with simpler Makefile-based xml generation
Alexander Köplinger [Thu, 11 Aug 2016 15:52:20 +0000 (17:52 +0200)]
[mini] Replace emitnunit.pl with simpler Makefile-based xml generation

In an effort to cut down on the number of different scripts we have that try to output NUnit xml.

It also fixes a bug in emitnunit.pl where it would not output anything when one of the tests crashes
the process, because then the final "Overall results: tests: 22425, 100% pass, opt combinations: 25"
line isn't printed and emitnunit.pl just exits. This happens on Alpine.

7 years ago[mcs] Remove NET_4_5 ifdef from the source files
Alexander Köplinger [Tue, 23 Aug 2016 13:15:51 +0000 (15:15 +0200)]
[mcs] Remove NET_4_5 ifdef from the source files

It is always set in all profiles that we support so we can remove it.

7 years ago[jit] Avoid strengh reducing divisions when using llvm, llvm can do it by itself.
Zoltan Varga [Tue, 23 Aug 2016 13:09:21 +0000 (15:09 +0200)]
[jit] Avoid strengh reducing divisions when using llvm, llvm can do it by itself.

7 years agoMerge pull request #3426 from ntherning/fix-handle-leak-in-DirectoryInfo.EnumerateFil...
Niklas Therning [Tue, 23 Aug 2016 11:55:25 +0000 (13:55 +0200)]
Merge pull request #3426 from ntherning/fix-handle-leak-in-DirectoryInfo.EnumerateFileSystemInfos-on-windows

Fixes a handle leak in DirectoryInfo.EnumerateFileSystemInfos()

7 years agoMerge pull request #3433 from ntherning/fix-DoubleTest.Parse-assumes-en-US
Niklas Therning [Tue, 23 Aug 2016 10:22:50 +0000 (12:22 +0200)]
Merge pull request #3433 from ntherning/fix-DoubleTest.Parse-assumes-en-US

Don't assume "3 5" is unparseable in the current culture in DoubleTest.Parse()

7 years agoDon't assume "3 5" is unparseable in the current culture in DoubleTest.Parse()
Niklas Therning [Tue, 23 Aug 2016 09:32:41 +0000 (11:32 +0200)]
Don't assume "3 5" is unparseable in the current culture in DoubleTest.Parse()

DoubleTest.Parse() expects "3 5" to be unparseable in the current culture and
expects an exception to be thrown. In sv-SE however "3 5" parses to 35 and
this test fails.

This patch sets the current culture to en-US when the DoubleTest.Parse() test
is run.

7 years agoFixes a handle leak in DirectoryInfo.EnumerateFileSystemInfos()
Niklas Therning [Mon, 22 Aug 2016 14:54:03 +0000 (16:54 +0200)]
Fixes a handle leak in DirectoryInfo.EnumerateFileSystemInfos()

When running DirectoryInfo.EnumerateFileSystemInfos() on an empty directory
MonoIO.FindFirst() will return null and the method returns without closing the
handle which is opened by FindFirst(). This patch makes sure the finally block
which closes the handle is run even when FindFirst() returns null.

Also added a call to FindClose() and some more cleanup in the native
implementation of MonoIO.FindFirst() when an allocation fails.

This bug caused an exception in DirectyoryInfoTest.TearDown() and several
other TearDown() methods in the MonoTests.System.IO tests on Windows due to
RemoveDirectory() failing on an empty directory which still had an open handle
associated with it.

7 years agoMerge pull request #3103 from marek-safar/rs-Threading
Marek Safar [Tue, 23 Aug 2016 07:17:43 +0000 (09:17 +0200)]
Merge pull request #3103 from marek-safar/rs-Threading

[corlib] EventWaitHandle from referencesource

7 years ago[xbuild] Fix incremental build of TargetFrameworkAttribute
Mikayla Hutchinson [Tue, 23 Aug 2016 02:52:31 +0000 (22:52 -0400)]
[xbuild] Fix incremental build of TargetFrameworkAttribute

The targets depended on a feature that doesn't exist in
xbuild (https://bugzilla.xamarin.com/show_bug.cgi?id=43645)
and as a consequence would fail to add the generated file to
the build when the GenerateTargetFrameworkMonikerAttribute
target was up to date.

7 years agoMerge pull request #3429 from akoeplinger/fix-signaturedescription
Alexander Köplinger [Tue, 23 Aug 2016 00:35:44 +0000 (02:35 +0200)]
Merge pull request #3429 from akoeplinger/fix-signaturedescription

[corlib] Add new values for RSAPKCS1SHA(256/384/512)SignatureDescription to CryptoConfig and fix SignatureDescriptionTest in FullAOT

7 years agoMerge pull request #3381 from krytarowski/netbsd-support-20
Alexander Köplinger [Mon, 22 Aug 2016 23:24:39 +0000 (01:24 +0200)]
Merge pull request #3381 from krytarowski/netbsd-support-20

Resurrect NetBSD support in mono-perfcounters.c

7 years ago[corlib] EventWaitHandle from referencesource
Marek Safar [Fri, 3 Jun 2016 13:18:42 +0000 (15:18 +0200)]
[corlib] EventWaitHandle from referencesource

7 years ago[arm64] Bump instruction sizes for atomic ops to match the emmited code
Vlad Brezae [Mon, 22 Aug 2016 21:06:23 +0000 (14:06 -0700)]
[arm64] Bump instruction sizes for atomic ops to match the emmited code

7 years ago[corlib] Add new values for RSAPKCS1SHA(256/384/512)SignatureDescription to CryptoCon...
Alexander Köplinger [Mon, 22 Aug 2016 18:04:57 +0000 (20:04 +0200)]
[corlib] Add new values for RSAPKCS1SHA(256/384/512)SignatureDescription to CryptoConfig and fix SignatureDescriptionTest in FullAOT

With the .NET 4.6.2 merge in https://github.com/mono/mono/commit/b6a30059db8319348ebb454cc303633dfabd6a29#diff-799d44d25450b5b84906cbe7095708a0L86
the RSAPKCS1SignatureDescription class switched from using SHA1CryptoServiceProvider as the DigestAlgorithm to SHA1Cng.

This uncovered an issue when running SignatureDescriptionTest in FullAOT, as we were missing an entry for SHA1Cng
in CryptoConfig.fullaot.cs and so we didn't find the algorithm.

Additionally, 4.6.2 added new variants of the SignatureDescription class using SHA256, SHA384 and 512 which
had to be added alongside the corresponding digest/signature URLs defined by https://msdn.microsoft.com/en-us/library/windows/desktop/dd979768(v=vs.85).aspx

Note that on mobile/FullAOT we're falling back to the *Managed variants of the SHA algorithms as the *Cng/*CryptoServiceProvider variants
aren't exposed there (except for SHA1CryptoServiceProvider since it was in the framework from the beginning) so we need to special case these in the tests.

7 years ago[s390x] Fix compilation of sre-save.c
Aleksey Kliger [Mon, 22 Aug 2016 18:07:59 +0000 (14:07 -0400)]
[s390x] Fix compilation of sre-save.c

7 years ago[corlib] Simplify monotouch_*_corlib.dll.sources
Alexander Köplinger [Mon, 22 Aug 2016 17:15:50 +0000 (19:15 +0200)]
[corlib] Simplify monotouch_*_corlib.dll.sources

They were all using the same .cs source files so just including the generic monotouch .sources
makes it easier to reason about and reduces the risk of forgetting to update one of the lists.

7 years ago[corlib] Rename CryptoConfig_2_1.cs to CryptoConfig.common.cs
Alexander Köplinger [Mon, 22 Aug 2016 17:02:34 +0000 (19:02 +0200)]
[corlib] Rename CryptoConfig_2_1.cs to CryptoConfig.common.cs

The file is actually used in all profiles so the 2.1 naming was confusing.

7 years ago[sre] Fix s390x build (#3427)
Aleksey Kliger (λgeek) [Mon, 22 Aug 2016 16:28:18 +0000 (12:28 -0400)]
[sre] Fix s390x build (#3427)

Followup for 6be008c409153a82e80394b98c93564e2cdb2309 to fix the s390x build.

7 years ago[mcs] Fix arguments to nunit-lite when FIXTURE or TESTNAME is set
Alexander Köplinger [Mon, 22 Aug 2016 16:20:05 +0000 (18:20 +0200)]
[mcs] Fix arguments to nunit-lite when FIXTURE or TESTNAME is set

nunit used -fixture for running all tests of a fixture and -run for running a single test,
but nunit-lite uses just -test for both.

7 years agoMerge pull request #3428 from ntherning/fix-missing-libc-in-FileStreamTest-on-windows
Alexander Köplinger [Mon, 22 Aug 2016 15:30:04 +0000 (17:30 +0200)]
Merge pull request #3428 from ntherning/fix-missing-libc-in-FileStreamTest-on-windows

Fixes DllNotFoundException in FileStreamTest.SetUp() on Windows

7 years agoFixes DllNotFoundException in FileStreamTest.SetUp() on Windows
Niklas Therning [Mon, 22 Aug 2016 15:21:58 +0000 (17:21 +0200)]
Fixes DllNotFoundException in FileStreamTest.SetUp() on Windows

SetUp() calls uname() in libc to check whether the test is running on OS X. On
Windows this fails since libc isn't available.

This patch removes the call to uname() completely since the result wasn't used
by the test anyway.

7 years ago[mcs] Move more eager references version mismatch checks. Fixes #30821
Marek Safar [Mon, 22 Aug 2016 15:04:11 +0000 (17:04 +0200)]
[mcs] Move more eager references version mismatch checks. Fixes #30821

7 years ago[corlib] Fix exposed public APIs
Marek Safar [Mon, 22 Aug 2016 11:27:53 +0000 (13:27 +0200)]
[corlib] Fix exposed public APIs

7 years agoUpdate ms-test-suite
Marek Safar [Mon, 22 Aug 2016 11:27:04 +0000 (13:27 +0200)]
Update ms-test-suite

7 years agoFix NetBSD build in proclib.c (#3378)
Kamil Rytarowski [Mon, 22 Aug 2016 06:45:17 +0000 (08:45 +0200)]
Fix NetBSD build in proclib.c (#3378)

7 years ago[corlib] More sources from referencesource
Marek Safar [Sat, 20 Aug 2016 21:16:48 +0000 (23:16 +0200)]
[corlib] More sources from referencesource

7 years ago[corlib] Print some info on FailFast
Marek Safar [Sat, 20 Aug 2016 20:34:35 +0000 (22:34 +0200)]
[corlib] Print some info on FailFast

7 years ago[runtime] Use a coop semaphore instead of an io layer one to wait for thread start...
Zoltan Varga [Sat, 20 Aug 2016 09:36:20 +0000 (11:36 +0200)]
[runtime] Use a coop semaphore instead of an io layer one to wait for thread start. (#3383)

7 years ago[corlib] Interning of utc literals in TimeZoneInfo conversion. Fixes #43512
Marek Safar [Sat, 20 Aug 2016 09:02:30 +0000 (11:02 +0200)]
[corlib] Interning of utc literals in TimeZoneInfo conversion. Fixes #43512

7 years agoVisual Studio project updates and enhancements to support static libmono and addition...
Johan Lorensson [Sat, 20 Aug 2016 03:20:38 +0000 (05:20 +0200)]
Visual Studio project updates and enhancements to support static libmono and additional test/debug projects. (#3420)

* Fixing linker warning when building libmono DLL.

After splitting mono runtime into a static library used when building libmono
DLL, we got a linker warning since there were no object files left in the
libmono project. There was also a sematic issue with the current organization
of DllMain since it is located in driver.c that will be compiled into the static
library and then consumed by the linker building the DLL. In cases where the
static library was consumed directly it would still include DllMain entry point.

By splitting the DllMain method implementation into a separate specific windows file
we can both resolve the linker warning and remove the DllMain method implementation from the static
library and only include it when building the libmono DLL.

* Visual Studio projects support to optimally link mono applications using static libmono library.

Added a new property, MONO_USE_STATIC_LIBMONO that can be used to link some
mono applications, for example mono(-sgen).exe, towards static version of libmono.

This gives us the option to build a binary without dependencies on other runtime binaries
minimizing what’s needs to be deployed in order to run mono. This in combination with static linked c-runtime
(another option available through a VS property) will produce a mono runtime binary without
addition dependencies except .NET assemblies deployed by mono runtime users.

The default is still using the dynamic version of libmono as before.

* Visual Studio project to test/debug testdriver tests from within Visual Studio.

Added an additional Visual Studio project preconfigured to run testdriver related tests
directly from within Visual Studio.

Commit also includes an additional configuration script that can be used test projects in order
to setup a mono config file. The testdriver project uses this to create a unique configuration
files pointing to the build libtest.dll for running configuration. The configuration file will then
be used when the tests are executed to make sure the correct libtest.dll for current build configuration
gets used when running test different tests from within the Visual Studio debugger.

The project comes with a number of user macros as well that can be used in order to tailor how the tests are run.
Most of the values are preconfigured and shouldn't need to be changed in order to use
current build. In order to change the test that is executed, use the following user macro
defined in mono-testdriver-test property sheet added to the project:

MONO_TESTDRIVER_RUN_TARGET

and point it to the assembly hosting the tests to execute from within Visual Studio.

* Visual Studio project to test/debug nunit tests from within Visual Studio.

Added an additional Visual Studio project preconfigured to run nunit related tests
directly from within Visual Studio.

The project comes with a number of user macros as well that can be used in order to tailor how the tests are run.
Most of the values are preconfigured and shouldn't need to be changed in order to use
current build. In order to change the test that is executed, use the following user macro
defined in mono-nunit-test property sheet added to the project:

MONO_NUNIT_RUN_TARGET

and point it to the assembly hosting the tests to execute from within Visual Studio.

There is also an additional user macro defined:

MONO_NUNIT_FIXTURE

This can be used to limit the number of nunit test run within a test suite.

7 years agoMerge pull request #3413 from lambdageek/reflection-split
Aleksey Kliger (λgeek) [Fri, 19 Aug 2016 22:40:08 +0000 (18:40 -0400)]
Merge pull request #3413 from lambdageek/reflection-split

[reflection] Divide reflection.c into multiple files. NFC

7 years agoGC Bridge: Make merge_cache more aggressive, less exact, faster
Andi McClure [Fri, 19 Aug 2016 20:22:31 +0000 (16:22 -0400)]
GC Bridge: Make merge_cache more aggressive, less exact, faster

The merge_cache previously, if it encountered an SCC ("color") with
many outgoing links, would not attempt to merge that SCC with existing
SCCs and instead would just create a new color. Because unbridged SCCs
are now reported to the bridge client, the cost of creating extra
colors has increased. To mitigate this the merge cache now attempts to
merge objects of all sizes, and has been changed to be able to do this
performantly.

The biggest change is that in the case of a hash collision, SCCs will
sometimes be merged without fully checking if they are exactly equal.
This is considered okay because false merges will be infrequent and
nothing worse will happen than short-term failure to reclaim memory.

The bridge-pathologies double fan test has been amended to verify
large-object merging works.