mono.git
6 years agoMerge pull request #5668 from kumpera/wasm-work-p4
Rodrigo Kumpera [Mon, 2 Oct 2017 23:36:39 +0000 (16:36 -0700)]
Merge pull request #5668 from kumpera/wasm-work-p4

More WASM fixes.

6 years ago[ci] Small improvements for run-jenkins and collect-coverage. (#5669)
vkargov [Mon, 2 Oct 2017 22:16:39 +0000 (15:16 -0700)]
[ci] Small improvements for run-jenkins and collect-coverage. (#5669)

* [ci] Allow setting custom mono flags for test runs via MONO_TEST_FLAGS.

* [ci] Make the handling of CFLAGS a bit more flexible in run-jenkins.sh.

* [ci] Generalize collect-coverage to handle more targets.

6 years agoMerge pull request #5675 from mono/glib-debug-symbols
Alexis Christoforides [Mon, 2 Oct 2017 17:46:14 +0000 (13:46 -0400)]
Merge pull request #5675 from mono/glib-debug-symbols

Add glib to the list of packages with debugging symbols.

6 years agoBump mono-extensions to fix build break (#5677)
Alexander Köplinger [Mon, 2 Oct 2017 17:45:13 +0000 (19:45 +0200)]
Bump mono-extensions to fix build break (#5677)

The driver.c patch from mono-extensions no longer applied after https://github.com/mono/mono/commit/30cddad5fb4c3d290906a6e6c33ecd8b07d8b48c

6 years agoBump NuGet.BuildTasks to get new updates and switch to `dev` branch (#5566)
Ankit Jain [Mon, 2 Oct 2017 16:18:08 +0000 (12:18 -0400)]
Bump NuGet.BuildTasks to get new updates and switch to `dev` branch (#5566)

6 years agoAdd glib to the list of packages with debugging symbols.
Cody Russell [Thu, 28 Sep 2017 20:11:01 +0000 (15:11 -0500)]
Add glib to the list of packages with debugging symbols.

6 years ago[profiler] log profiler: limit method instrumentation to selected methods (#5517)
Uri Simchoni [Mon, 2 Oct 2017 14:29:49 +0000 (17:29 +0300)]
[profiler] log profiler: limit method instrumentation to selected methods (#5517)

* [trace] remove code that has no effect

* [trace] move program assembly out of MonoTraceSpec

The assembly member represents the program assembly. It's
information the trace spec is matched against, not part of
the trace spec per-se (if two trace specs exist for two purposes
we would still have one program assembly)

* [trace] remove side effects from get_string()

On the way towards supporting multiple trace specs,
remove side effects from get_string() function.

* [trace] remove side effects from get_token()

Remove side effects from get_token() to allow handling
multiple trace specs.

* [trace] fix handling of double exclusion and disabled

When encountering "disabled", do not add an entry to
the trace spec

Fix error handling around double "-" - get_spec()
never returns TOKEN_EXCLUDE and the recursion can
be easily avoided.

* [trace] remove side effects from get_spec()

Another step in making the trace options reusable.

* [trace] rename mono_trace_parse_options() to mono_trace_set_options()

This routine actually sets the tracing options, not just parses an
option string, so set_ is more suitable. This frees up the
mono_trace_parse_options() name for pure parsing, when we later
reuse the parsing code.

* [trace] make tracing options API reusable

Add APIs that parse tracing options and evaluate a method
against the parsed options. The tracing functionality now uses
this API, but other components can use this to apply an operation
to a method based on policy (e.g. profiling)

* [trace] rename MonoTraceSpec to MonoCallSpec

In preparation for reusing call specification beyond the
tracer, rename the data structure - it now only specifies
a set of calls, without indication what should be done with
them.

* [trace] rename mono_trace_set_assembly to mono_callspec_set_assembly

As it becoming a reuse candidate, we remove the "trace" component
from the name.

* [trace-metadata] move callspec code into its own module

Introduce callspec.c/h which encapsulate the call specification
functionality.

* [profiler] add "callspec" option to log profiler

The callspec option define which methods get instrumented
at JIT time with entry/exit calls to the profiler. The
syntax is same as the tracer (--trace=) syntax. To
distinguish between profiler options and callspec, wrap the
callspec with double quotes, as in:
--profile=log:callspec="all-mscorlib",calls

Since this typically runs from a shell, the double quotes have to be
escaped or wrapped in single quotes, as in:
mono '--profile=log:callspec="all-mscorlib",calls' prog.exe

* [metadata] add an error return string to callspec parsing

Instead of printing parsing error messages to standard error,
return an error string. That allows the client to do the right thing
with the error.

6 years ago[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
Zoltan Varga [Mon, 2 Oct 2017 14:26:17 +0000 (16:26 +0200)]
[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to FALSE before it was saved, causing invalid code to be generated in some cases when doing nested inlining. Fixes #59608. (#5654)

6 years ago[mcs] Initial by ref returns and variables support
Marek Safar [Tue, 19 Sep 2017 13:47:31 +0000 (15:47 +0200)]
[mcs] Initial by ref returns and variables support

6 years agoFix ninja BTLS build for verbose builds (#5673)
Marek Habersack [Mon, 2 Oct 2017 14:15:45 +0000 (16:15 +0200)]
Fix ninja BTLS build for verbose builds (#5673)

ninja treats `VERBOSE=1` as a target and, failing to find one, aborts
the build with an error. Pass `-v` in this case instead.

6 years agoFix LinearGradientMode parameter validation to match corefx (#5672)
Hugh Bellamy [Mon, 2 Oct 2017 14:15:28 +0000 (15:15 +0100)]
Fix LinearGradientMode parameter validation to match corefx (#5672)

6 years agoAllow passing null to JsonArray.Add()
Steffen Kieß [Tue, 19 Sep 2017 18:41:16 +0000 (20:41 +0200)]
Allow passing null to JsonArray.Add()

null is a valid value in a JSON array, so there is no reason forbid
adding null to the array. JsonArray.Save() already handles null values in
the array.

6 years agoRemove invalid tests for image palettes in GdiPlusTest (#5671)
Hugh Bellamy [Mon, 2 Oct 2017 00:28:25 +0000 (01:28 +0100)]
Remove invalid tests for image palettes in GdiPlusTest (#5671)

C.r. https://github.com/mono/libgdiplus/pull/112

6 years ago[corlib] Make Marshal.BufferToBSTR(Array, int) non-public again (#5670)
Alexander Köplinger [Sat, 30 Sep 2017 19:51:42 +0000 (21:51 +0200)]
[corlib] Make Marshal.BufferToBSTR(Array, int) non-public again (#5670)

* [corlib] Make Marshal.BufferToBSTR(Array, int) non-public again

It was accidentally made public in https://github.com/mono/mono/commit/c5cdfaec1e0973ced3f97ef589cd0bece56067ad.
Unfortunately this was before we had the API diff check on Mono and the manual checks in XI/XA integration didn't catch it either.

* Bump API snapshot submodule

6 years agoMerge pull request #5659 from kumpera/fix_59824
Rodrigo Kumpera [Fri, 29 Sep 2017 23:17:03 +0000 (16:17 -0700)]
Merge pull request #5659 from kumpera/fix_59824

[runtime] Synthesize IList and IReadOnlyList for the element type of enum errays. Fixes #59824

6 years ago[wasm] We can't free memory in wasm as it uses the malloc mmap backend.
Rodrigo Kumpera [Fri, 29 Sep 2017 23:14:22 +0000 (16:14 -0700)]
[wasm] We can't free memory in wasm as it uses the malloc mmap backend.

6 years ago[wasm] Add new missing signature.
Rodrigo Kumpera [Fri, 29 Sep 2017 22:45:00 +0000 (15:45 -0700)]
[wasm] Add new missing signature.

6 years ago[wasm] Disable test that doesn't work with WASM
Rodrigo Kumpera [Fri, 29 Sep 2017 22:44:41 +0000 (15:44 -0700)]
[wasm] Disable test that doesn't work with WASM

6 years ago[System.Net.Http] HttpClient timeout range checks. Fixes #25755
Marek Safar [Fri, 29 Sep 2017 14:08:49 +0000 (16:08 +0200)]
[System.Net.Http] HttpClient timeout range checks. Fixes #25755

6 years agocodeowners update
Marek Safar [Fri, 29 Sep 2017 09:52:48 +0000 (11:52 +0200)]
codeowners update

6 years ago[w32file] Move MonoIO.Find{First,Next,Close} to managed
Ludovic Henry [Wed, 27 Sep 2017 15:28:16 +0000 (11:28 -0400)]
[w32file] Move MonoIO.Find{First,Next,Close} to managed

6 years ago[w32file] Remove dead code
Ludovic Henry [Wed, 27 Sep 2017 15:35:36 +0000 (11:35 -0400)]
[w32file] Remove dead code

6 years ago[sre] register a canonical MonoReflectionMethod for a methodref token
Aleksey Kliger [Wed, 27 Sep 2017 18:01:47 +0000 (14:01 -0400)]
[sre] register a canonical MonoReflectionMethod for a methodref token

In mono_image_create_token we are passed in a managed reflection object and we
need to create a token for it and optionally register it so that we can resolve
that token back to a runtime structure and managed object later.

For a MonoReflectionMethod object that refers to a method from outside the
current dynamic image, we need to generate a memberref token.  It will be the
same token for the same underlying MonoMethod*.  When we go to register the
token with mono_dynamic_image_register_token we need to pass a managed object.
Unfortunately two MonoReflectionMethod objects could refer to the same
MonoMethod* but differ in their ReflectedType, so just registering the
passed-in MonoReflectionMethod means we could assert in
mono_dynamic_image_register_token because previously we may have registered the
same method via a different ReflectedType.

So what we do is we cal mono_method_get_object_handle with NULL for the
reflected type - which corresponds to just using the DeclaringType of the given
MonoMethod*.

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

6 years ago[sre] Expect a new token for MonoArrayMethod and SignatureHelper
Aleksey Kliger [Wed, 27 Sep 2017 22:30:13 +0000 (18:30 -0400)]
[sre] Expect a new token for MonoArrayMethod and SignatureHelper

6 years ago[sre] Remove MonoDynamicImage:handleref_managed field
Aleksey Kliger [Wed, 27 Sep 2017 21:32:19 +0000 (17:32 -0400)]
[sre] Remove MonoDynamicImage:handleref_managed field

It's now unused.

6 years ago[sre] Map fieldref tokens to MonoClassField*
Aleksey Kliger [Wed, 27 Sep 2017 21:23:54 +0000 (17:23 -0400)]
[sre] Map fieldref tokens to MonoClassField*

Previously, we mapped fieldref tokens to MonoReflectionField managed objects,
But the object is just used as a key for caching the token so we may as well
use the native field instead of a managed object.

6 years ago[sre] Wrap mono_image_create_token with HANDLE_FUNCTION_{ENTER,RETURN}
Aleksey Kliger [Wed, 27 Sep 2017 17:56:56 +0000 (13:56 -0400)]
[sre] Wrap mono_image_create_token with HANDLE_FUNCTION_{ENTER,RETURN}

We will allocate a handle for the object that we will register.  For now it's
just an alias of the object passed in, but it could differ.

6 years ago[test] SRE ILGenerator test for methodref and fieldref token caching
Aleksey Kliger [Thu, 28 Sep 2017 20:24:30 +0000 (16:24 -0400)]
[test] SRE ILGenerator test for methodref and fieldref token caching

Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=59364

We need to cause SRE to generate the same methodref/fieldref token from two
different reflection objects.  That happens if you get the same method or field
via a base and a derived class so that the MemberInfo:DeclaredType is different
but the underlying MonoMethod* or MonoClassField* is the same.

6 years ago[System] HttpListenerRequest: ignore bad cookies and keep request alive (#5657)
Alexander Köplinger [Thu, 28 Sep 2017 23:19:09 +0000 (01:19 +0200)]
[System] HttpListenerRequest: ignore bad cookies and keep request alive (#5657)

HttpRequestListener throws on incorrect cookie name. It throws CookieException ("Name contains invalid characters"). There are many cookies out there that unfortunately do not conform to the guidelines and HttpRequestListener will kill the request in such a case. The .Net framework under windows lets the request through however.

Included is a patch HttpListenerRequest as well as a test with a bad cookie name.

I have tested this under linux(master branch) and .net (4.0), they now both have the same behavior.

6 years ago[msbuild] Bump msbuild to fix test failures on wrench (#5660)
Ankit Jain [Thu, 28 Sep 2017 22:55:07 +0000 (18:55 -0400)]
[msbuild] Bump msbuild to fix test failures on wrench (#5660)

6 years agoMerge pull request #5560 from kumpera/wasm-work-p3
Rodrigo Kumpera [Thu, 28 Sep 2017 22:06:02 +0000 (18:06 -0400)]
Merge pull request #5560 from kumpera/wasm-work-p3

More WASM fixes, with this I can get half of the mini test suite to run without crashing.

6 years agoMerge pull request #5567 from kumpera/fix_59334
Rodrigo Kumpera [Thu, 28 Sep 2017 20:50:07 +0000 (16:50 -0400)]
Merge pull request #5567 from kumpera/fix_59334

[runtime] Handle RuntimeWrappedException and dynamic methods. Fixes #59334

6 years ago[runtime] Synthesize IList and IReadOnlyList for the element type of enum errays...
Rodrigo Kumpera [Thu, 28 Sep 2017 20:45:54 +0000 (13:45 -0700)]
[runtime] Synthesize IList and IReadOnlyList for the element type of enum errays. Fixes #59824

Make sure array of enums can be casted to interfaces of their element types.

6 years ago[mini] Fix test compiling when running !MOBILE
Rodrigo Kumpera [Thu, 28 Sep 2017 17:11:19 +0000 (10:11 -0700)]
[mini] Fix test compiling when running !MOBILE

6 years ago[runtime] Fix icall signature and change comment to fixme.
Rodrigo Kumpera [Thu, 28 Sep 2017 17:01:11 +0000 (10:01 -0700)]
[runtime] Fix icall signature and change comment to fixme.

6 years ago[wasm] Implement GC support. Embedder must provide main loop pumping function request...
Rodrigo Kumpera [Thu, 28 Sep 2017 00:30:49 +0000 (17:30 -0700)]
[wasm] Implement GC support. Embedder must provide main loop pumping function request_gc_cycle.

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[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