mono.git
8 years agoMerge pull request #2713 from gregoryyoung/master
Ludovic Henry [Mon, 4 Apr 2016 10:15:08 +0000 (11:15 +0100)]
Merge pull request #2713 from gregoryyoung/master

handles AwaitAsync finishing synchronously

8 years ago[amd64] Add a separate ArgStorage entry for gsharedvt return types instead of using...
Zoltan Varga [Sun, 3 Apr 2016 01:02:50 +0000 (21:02 -0400)]
[amd64] Add a separate ArgStorage entry for gsharedvt return types instead of using a separate flag in CallInfo.

8 years ago[acceptance-tests] Fix test-runner.exe compilation after 136dd0
Alexander Köplinger [Sun, 3 Apr 2016 00:56:29 +0000 (02:56 +0200)]
[acceptance-tests] Fix test-runner.exe compilation after 136dd0

8 years agoMerge pull request #2720 from mono/fix-39325
monojenkins [Sat, 2 Apr 2016 15:50:31 +0000 (16:50 +0100)]
Merge pull request #2720 from mono/fix-39325

[Profiler] Keep a reference to assemblies while coverage is running

In certain circumstances, for example when running under nunit-console, assemblies could be unloaded while the profiler still had a reference to them in order to generate the coverage data. In these cases, the memory referred to by the profiler would be invalid and would crash.

Fix this by incrementing the reference count of the assemblies preventing them from being unloaded while coverage is being collected.

Fixes BXC #39325

8 years ago[runtime] Move the test for shutting down the stat profiler to mini_cleanup ().
Zoltan Varga [Sat, 2 Apr 2016 06:32:04 +0000 (02:32 -0400)]
[runtime] Move the test for shutting down the stat profiler to mini_cleanup ().

8 years ago[arm64] Fix the generation of static rgctx trampolines when using aot on linux.
Zoltan Varga [Sat, 2 Apr 2016 05:38:43 +0000 (01:38 -0400)]
[arm64] Fix the generation of static rgctx trampolines when using aot on linux.

8 years ago[arm64] Implement handler block guard trampolines.
Zoltan Varga [Sat, 2 Apr 2016 05:27:27 +0000 (01:27 -0400)]
[arm64] Implement handler block guard trampolines.

8 years ago[runtime] Fix a crash when shutting down the sampling thread.
Zoltan Varga [Sat, 2 Apr 2016 05:23:35 +0000 (01:23 -0400)]
[runtime] Fix a crash when shutting down the sampling thread.

8 years ago[tests] Increase the timeout in the test runner so running tests with llvm doesn...
Zoltan Varga [Sat, 2 Apr 2016 02:36:15 +0000 (22:36 -0400)]
[tests] Increase the timeout in the test runner so running tests with llvm doesn't time out.

8 years ago[metadata] Remove invalid Win32 entry in object-offsets.h
Alexander Köplinger [Sat, 2 Apr 2016 01:56:01 +0000 (18:56 -0700)]
[metadata] Remove invalid Win32 entry in object-offsets.h

The lmf_addr field in MonoLMF only exists for TARGET_X86.

8 years ago[mini] Remove duplicate stubs from tramp-amd64/x86-gsharedvt.c
Alexander Köplinger [Sat, 2 Apr 2016 01:53:22 +0000 (18:53 -0700)]
[mini] Remove duplicate stubs from tramp-amd64/x86-gsharedvt.c

They already exist in arch-stubs.c and caused conflicts on the MSVC build.

8 years ago[msvc] Add missing files to MSVC project files
Alexander Köplinger [Sat, 2 Apr 2016 01:17:39 +0000 (18:17 -0700)]
[msvc] Add missing files to MSVC project files

8 years ago[mini] Fix build on systems without clock_nanosleep ().
Alex Rønne Petersen [Fri, 1 Apr 2016 20:25:10 +0000 (22:25 +0200)]
[mini] Fix build on systems without clock_nanosleep ().

8 years ago[jit] Handle verification failing with InvalidProgramException. Fixes #40040.
Rodrigo Kumpera [Fri, 1 Apr 2016 20:15:41 +0000 (13:15 -0700)]
[jit] Handle verification failing with  InvalidProgramException. Fixes #40040.

8 years ago[runtime] Make a copy of the types passed to mono_mb_add_local () earlier since they...
Zoltan Varga [Fri, 1 Apr 2016 20:12:23 +0000 (16:12 -0400)]
[runtime] Make a copy of the types passed to mono_mb_add_local () earlier since they could be transient.

8 years ago[arm64] Fix clearing of stack traces when an exception is rethrown. Fix the calculati...
Zoltan Varga [Fri, 1 Apr 2016 20:03:20 +0000 (16:03 -0400)]
[arm64] Fix clearing of stack traces when an exception is rethrown. Fix the calculation of struct sizes in pinvoke calls. Remove some dead code.

8 years agoMerge pull request #2825 from kumpera/loader_error_removal
Rodrigo Kumpera [Fri, 1 Apr 2016 18:19:24 +0000 (11:19 -0700)]
Merge pull request #2825 from kumpera/loader_error_removal

GOOD RIDDANCE LOADER ERROR

8 years agoMerge pull request #2826 from mattleibow/mono.options-update
Alexander Köplinger [Fri, 1 Apr 2016 13:08:50 +0000 (15:08 +0200)]
Merge pull request #2826 from mattleibow/mono.options-update

[Mono.Options] Added support for Enums in the PCL version

8 years ago[System.Web.Extensions] Add test for last fix
Alexander Köplinger [Fri, 1 Apr 2016 12:11:03 +0000 (14:11 +0200)]
[System.Web.Extensions] Add test for last fix

8 years ago[System.Web.Extensions] Use CultureInfo.InvariantCulture for number parsing
Jussi Sainio [Fri, 6 Jun 2014 12:54:21 +0000 (15:54 +0300)]
[System.Web.Extensions] Use CultureInfo.InvariantCulture for number parsing

Fixes #4242, see bug comments. JsonSerializer seems to have been already
fixed in abe9dc62. The JsonDeserializer number conversion is now much
stricter, allowing only integer number style for integers and float number
style for floats.

8 years agoMerge pull request #2805 from alexrp/profiler-sampling-thread2
monojenkins [Fri, 1 Apr 2016 07:00:18 +0000 (08:00 +0100)]
Merge pull request #2805 from alexrp/profiler-sampling-thread2

[profiler] Use a background thread to send out sampling signals.

Previously, when using an interval timer, the initial profiling signal could be
delivered to *any* thread in the process. This is not normally a problem, but
if the signaled thread has not even finished its initialization inside libc, it
can happen that it hasn't even set up thread-local storage yet. We then blow up
spectacularly when trying to back up errno in the SIGPROF signal handler, as
it's a TLS variable. Even the SIGSEGV handler blows up immediately after as it
can't access JIT TLS data.

Since there appears to be no reliable and portable way for a library like Mono
to control which exact thread gets the initial timer signal, instead switch to
using a background thread that uses a high-resolution sleep and attempts to
switch itself to real time scheduling if possible. This way, we have full
control over which threads we send SIGPROF to, letting us avoid any threads
which aren't in a 'good' state for profiling.

This commit also gets rid of the multiplexing that was going on in the SIGPROF
signal handler, since we now send out the signals from a background thread. As
this was the only use of the async job API, that API has been removed. This
indirectly fixes the signal storming issue that sometimes popped up, where for
some reason multiple threads would think that they're the initiating thread,
resulting in way too many signals going out.

A nice side-effect of doing the signaling ourselves is that we can now use
real-time signals on systems that have them (e.g. Linux), resulting in a nearly
100% signal delivery rate in all cases. Previously, we would lose a tremendous
amount of signals when an application was under heavy load.

8 years ago[arm64] Implement interruption checking in the trampoline code.
Zoltan Varga [Fri, 1 Apr 2016 04:27:48 +0000 (00:27 -0400)]
[arm64] Implement interruption checking in the trampoline code.

8 years ago[Mono.Options] Added support for Enums in the PCL version
Matthew Leibowitz [Fri, 1 Apr 2016 03:13:46 +0000 (05:13 +0200)]
[Mono.Options] Added support for Enums in the PCL version
 - Support for String to Enum
 - Support for Number to Enum
 - Support for Flags to Enum
 - Added a UnitTest

8 years ago[profiler] Use a background thread to send out sampling signals.
Alex Rønne Petersen [Sun, 20 Mar 2016 02:08:42 +0000 (03:08 +0100)]
[profiler] Use a background thread to send out sampling signals.

Previously, when using an interval timer, the initial profiling signal could be
delivered to *any* thread in the process. This is not normally a problem, but
if the signaled thread has not even finished its initialization inside libc, it
can happen that it hasn't even set up thread-local storage yet. We then blow up
spectacularly when trying to back up errno in the SIGPROF signal handler, as
it's a TLS variable. Even the SIGSEGV handler blows up immediately after as it
can't access JIT TLS data.

Since there appears to be no reliable and portable way for a library like Mono
to control which exact thread gets the initial timer signal, instead switch to
using a background thread that uses a high-resolution sleep and attempts to
switch itself to real time scheduling if possible. This way, we have full
control over which threads we send SIGPROF to, letting us avoid any threads
which aren't in a 'good' state for profiling.

This commit also gets rid of the multiplexing that was going on in the SIGPROF
signal handler, since we now send out the signals from a background thread. As
this was the only use of the async job API, that API has been removed. This
indirectly fixes the signal storming issue that sometimes popped up, where for
some reason multiple threads would think that they're the initiating thread,
resulting in way too many signals going out.

A nice side-effect of doing the signaling ourselves is that we can now use
real-time signals on systems that have them (e.g. Linux), resulting in a nearly
100% signal delivery rate in all cases. Previously, we would lose a tremendous
amount of signals when an application was under heavy load.

8 years ago[Mono.Security] Remove leftover .sources files
Alexander Köplinger [Fri, 1 Apr 2016 00:34:44 +0000 (02:34 +0200)]
[Mono.Security] Remove leftover .sources files

8 years ago[runtime] Remove mono_loader_clear_error, mono_loader_assert_no_error and set_failure...
Rodrigo Kumpera [Fri, 1 Apr 2016 00:23:26 +0000 (17:23 -0700)]
[runtime] Remove mono_loader_clear_error, mono_loader_assert_no_error and set_failure_from_loader_error. The loader error is no more.

8 years ago[runtime] Remove mono_loader_get_last_error, nothing produces loader errors anymore.
Rodrigo Kumpera [Fri, 1 Apr 2016 00:09:56 +0000 (17:09 -0700)]
[runtime] Remove mono_loader_get_last_error, nothing produces loader errors anymore.

8 years ago[runtime] Remove mono_loader_error_prepare_exception, nothing can produce loader...
Rodrigo Kumpera [Thu, 31 Mar 2016 23:39:00 +0000 (16:39 -0700)]
[runtime] Remove mono_loader_error_prepare_exception, nothing can produce loader errors anymore.

8 years ago[runtime] Remove all functions that set the loader error. It's dead code now.
Rodrigo Kumpera [Thu, 31 Mar 2016 23:10:57 +0000 (16:10 -0700)]
[runtime] Remove all functions that set the loader error. It's dead code now.

8 years ago[mono-error] Remove mono_loader_set_error_from_mono_error, nothing uses it.
Rodrigo Kumpera [Thu, 31 Mar 2016 22:53:33 +0000 (15:53 -0700)]
[mono-error] Remove mono_loader_set_error_from_mono_error, nothing uses it.

8 years ago[mono-error] Since nothing sets the loader error anymore, mono_error_set_from_loader_...
Rodrigo Kumpera [Thu, 31 Mar 2016 22:44:37 +0000 (15:44 -0700)]
[mono-error] Since nothing sets the loader error anymore, mono_error_set_from_loader_error can be removed.

8 years agoFix warnings/remove dead code.
Zoltan Varga [Thu, 31 Mar 2016 22:28:47 +0000 (18:28 -0400)]
Fix warnings/remove dead code.

8 years agoFix a warning.
Zoltan Varga [Thu, 31 Mar 2016 22:21:59 +0000 (18:21 -0400)]
Fix a warning.

8 years ago[runtime] Fix the arm linux build by using the fallback InterlockedCompareExchange64...
Zoltan Varga [Thu, 31 Mar 2016 22:18:48 +0000 (18:18 -0400)]
[runtime] Fix the arm linux build by using the fallback InterlockedCompareExchange64 () implementation for now.

8 years ago[runtime] Fix some warnings/remove dead code.
Zoltan Varga [Thu, 31 Mar 2016 22:12:19 +0000 (18:12 -0400)]
[runtime] Fix some warnings/remove dead code.

8 years ago[corlib] Ensure newline in .sources file
Alexander Köplinger [Thu, 31 Mar 2016 22:08:31 +0000 (00:08 +0200)]
[corlib] Ensure newline in .sources file

It causes build issues on .sources with #include on Linux otherwise.

8 years ago[corlib] Fix monotouch_tv_runtime and monotouch_watch_runtime build
Alexander Köplinger [Thu, 31 Mar 2016 22:02:04 +0000 (00:02 +0200)]
[corlib] Fix monotouch_tv_runtime and monotouch_watch_runtime build

8 years agoUpdate X509CertificateImplApple to reflect latest X509CertificateImpl changes.
Martin Baulig [Thu, 24 Mar 2016 00:53:41 +0000 (20:53 -0400)]
Update X509CertificateImplApple to reflect latest X509CertificateImpl changes.

(cherry picked from commit 2fdfbe3479b0d3d24a5471ed7032eede80e58a2d)

8 years ago[reflection] Fix leak in mono_reflection_get_custom_attrs_{by_type,data_checked}
Aleksey Kliger [Thu, 31 Mar 2016 21:26:19 +0000 (17:26 -0400)]
[reflection] Fix leak in mono_reflection_get_custom_attrs_{by_type,data_checked}

If there's an error, first call mono_custom_attrs_free, then deal with
the error.

8 years ago[security-core-clr] Fixup function signature to match header
Aleksey Kliger [Thu, 31 Mar 2016 21:25:28 +0000 (17:25 -0400)]
[security-core-clr] Fixup function signature to match header

mono_security_core_clr_ensure_reflection_access_method should return a
boolean now.

8 years agoMerge pull request #2816 from xmcclure/profile-clean-0
monojenkins [Thu, 31 Mar 2016 19:05:17 +0000 (20:05 +0100)]
Merge pull request #2816 from xmcclure/profile-clean-0

Various cleanups on profiler

3 commits:

Assist on profiler module loading

- Add a MONO_PROFILER_LIB_DIR from which profiler modules are
  dynamically loading, in case it is not the normal library path
- Add information about profiler loading to mono_trace

Comments and clarity in proflog.c

- Add comments on structures
- Rename 'data' and 'data_end' to 'cursor' and 'buf_end' in LogBuffer/StatsBuffer as the old names were confusing
- Add new assert when processing samples

Improve a safety check when writing data into StatBuffer

- The safety check should occur such that if the new value for
StatBuffer::cursor is beyond the bounds of the StatBuffer, the cursor
is not updated.

8 years agoMerge pull request #2810 from kumpera/fix_hazard_free
monojenkins [Thu, 31 Mar 2016 19:00:19 +0000 (20:00 +0100)]
Merge pull request #2810 from kumpera/fix_hazard_free

Fix hazard free

Replace usage of mono_thread_hazardous_free_or_queue and remove it.

    mono_thread_hazardous_free_or_queue has a fundamentally broken design.

    It allows arbitrary free code to run in the context of its caller.

    The sync/async split on where it's called is not enough to know whether
    we can run free'ing code or not.

    Since in sync context we called free functions that could take locks,
    it happened that those locks conflicted with the ones already taken.

    In particular, mono_jit_info_table_free did take a domain lock and
    quite a few of the sync context calls would hold locks that must
    not be held when taking a domain lock.

    This, is practice, means that we'd need to partition the free calls
    into 3 groups: async context, reentrant context (no runtime locks held)
    and sync context (maybe some locks held).

    There was no case where reentrant context would be usable meaning,
    in practice, that all calls happens in what effectively is async context
    where free functions can't be called.

    The new design is a lot more straightforward:

    - No implicit free queue pumping
    - A pair of free functions with well defined behavior.
     mono_thread_hazardous_try_free - to be used where the caller expects the free function to be called
     mono_thread_hazardous_queue_free - to be used where the caller don't expect the free function to be called [1]
    - Explicit pumping on places that known to be ok
     Thread detach
     Finalizer thread

    [1] This might sound like a weird condition, but a lot of lock-free code
    have compensation logic that trigger free'ing during lookups.

8 years agoFix warnings.
Zoltan Varga [Thu, 31 Mar 2016 18:12:05 +0000 (14:12 -0400)]
Fix warnings.

8 years ago[gsharedvt] Change the --enable-gsharedvt configure option to a no-op, its always...
Zoltan Varga [Thu, 31 Mar 2016 17:42:49 +0000 (13:42 -0400)]
[gsharedvt] Change the --enable-gsharedvt configure option to a no-op, its always enabled by default.

8 years ago[gsharedvt] Integrate mini-generic-sharing-gsharedvt.c into mini-generic-sharing.c.
Zoltan Varga [Thu, 31 Mar 2016 17:37:02 +0000 (13:37 -0400)]
[gsharedvt] Integrate mini-generic-sharing-gsharedvt.c into mini-generic-sharing.c.

8 years ago[runtime] Use mono_object_isinst_checked
Aleksey Kliger [Thu, 31 Mar 2016 17:32:19 +0000 (13:32 -0400)]
[runtime] Use mono_object_isinst_checked

    rather than mono_object_isinst.

8 years ago[arm64] Fix passing of small gsharedvt argument on the stack on ios. Fixes #39528.
Zoltan Varga [Thu, 31 Mar 2016 17:24:48 +0000 (13:24 -0400)]
[arm64] Fix passing of small gsharedvt argument on the stack on ios. Fixes #39528.

8 years agoMerge pull request #2820 from kumpera/license-change-rebased
Zoltan Varga [Thu, 31 Mar 2016 17:18:26 +0000 (13:18 -0400)]
Merge pull request #2820 from kumpera/license-change-rebased

Change license and publish xamarin mono extensions

8 years agoUpdate COPYING.LIB
Rodrigo Kumpera [Thu, 31 Mar 2016 16:18:04 +0000 (09:18 -0700)]
Update COPYING.LIB

8 years ago[utils] Fix the build.
Rodrigo Kumpera [Thu, 31 Mar 2016 16:12:22 +0000 (09:12 -0700)]
[utils] Fix the build.

8 years agoMerge pull request #2394 from Mailaender/patch-1
monojenkins [Thu, 31 Mar 2016 16:05:56 +0000 (17:05 +0100)]
Merge pull request #2394 from Mailaender/patch-1

Fixed runtime dependency on libgdiplus with developer soname

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

8 years agoUpdate trademark
hannakim123 [Wed, 30 Mar 2016 22:15:37 +0000 (15:15 -0700)]
Update trademark

8 years agoMerge pull request #1 from xamarin/hannakim123-patch-1
Miguel de Icaza [Thu, 31 Mar 2016 01:24:09 +0000 (18:24 -0700)]
Merge pull request #1 from xamarin/hannakim123-patch-1

Update for CLA

8 years ago[runtime] Cycle the finalizer thread if there are too many outstanding hazard pointer...
Rodrigo Kumpera [Thu, 31 Mar 2016 00:38:43 +0000 (17:38 -0700)]
[runtime] Cycle the finalizer thread if there are too many outstanding hazard pointers to free.

We add a callback to the HP so the GC can monitor the queue size and act on it.

The queue size was picked to keep the overhead limited even under high load.

8 years ago[Profiler] Use the correct function to increment the refcount
iain holmes [Wed, 30 Mar 2016 23:23:58 +0000 (00:23 +0100)]
[Profiler] Use the correct function to increment the refcount

8 years agoMerge pull request #2807 from akoeplinger/gchandle
Alexander Köplinger [Wed, 30 Mar 2016 22:36:57 +0000 (00:36 +0200)]
Merge pull request #2807 from akoeplinger/gchandle

[corlib] Two small fixes for GCHandle

8 years agoMerge pull request #2786 from alexanderkyte/leaked_type_in_parse_header
monojenkins [Wed, 30 Mar 2016 21:11:01 +0000 (22:11 +0100)]
Merge pull request #2786 from alexanderkyte/leaked_type_in_parse_header

[runtime] Free leaked short-lived MonoType

8 years agoImprove a safety check when writing data into StatBuffer
Andi McClure [Wed, 30 Mar 2016 21:09:08 +0000 (17:09 -0400)]
Improve a safety check when writing data into StatBuffer

The safety check should occur such that if the new value for
StatBuffer::cursor is beyond the bounds of the StatBuffer, the cursor
is not updated.

8 years agoComments and clarity in proflog.c
Andi McClure [Thu, 31 Mar 2016 16:34:08 +0000 (12:34 -0400)]
Comments and clarity in proflog.c

- Add comments on structures
- Rename 'data' and 'data_end' to 'cursor' and 'buf_end' in
  LogBuffer/StatsBuffer as the old names were confusing
- Add new assert when processing samples

8 years agoAssist on profiler module loading
Andi McClure [Thu, 31 Mar 2016 15:02:21 +0000 (11:02 -0400)]
Assist on profiler module loading

- Add a MONO_PROFILER_LIB_DIR from which custom profilers are
  dynamically loaded, in case it is not the normal library path
- Modify mono/profiler make check to use MONO_PROFILER_LIB_DIR
  (this fixes a bug where it would sometimes load the wrong profiler)
- Add information about profiler loading to mono_trace

8 years agoMerge pull request #2799 from BrzVlad/fix-conc-card-clean
Vlad Brezae [Wed, 30 Mar 2016 19:54:57 +0000 (02:54 +0700)]
Merge pull request #2799 from BrzVlad/fix-conc-card-clean

[sgen] Fix concurrent card clean

8 years agoMerge pull request #2808 from lambdageek/dev/monoerror-security-core-clr
monojenkins [Wed, 30 Mar 2016 19:25:17 +0000 (20:25 +0100)]
Merge pull request #2808 from lambdageek/dev/monoerror-security-core-clr

[security-core-clr] Use MonoError outarg instead of mono_raise_exception

8 years agoMerge pull request #2812 from madewokherd/threadpool-ms-rand
Zoltan Varga [Wed, 30 Mar 2016 19:13:02 +0000 (15:13 -0400)]
Merge pull request #2812 from madewokherd/threadpool-ms-rand

[threadpool-ms] Fix incorrect use of mono_rand.

8 years ago[threadpool-ms] Fix incorrect use of mono_rand.
Vincent Povirk [Wed, 30 Mar 2016 16:16:12 +0000 (11:16 -0500)]
[threadpool-ms] Fix incorrect use of mono_rand.

This takes a pointer to an RNG handle, not the handle itself.

8 years agoMerge pull request #2698 from esdrubal/iosxmlarray
Marcos Henrich [Wed, 30 Mar 2016 10:57:56 +0000 (11:57 +0100)]
Merge pull request #2698 from esdrubal/iosxmlarray

[System.Runtime.Serialization] Static writer fix.

8 years agoMerge pull request #2763 from esdrubal/mono-symbolicate-standalone2
Marcos Henrich [Wed, 30 Mar 2016 07:55:15 +0000 (08:55 +0100)]
Merge pull request #2763 from esdrubal/mono-symbolicate-standalone2

Mono-symbolicate standalone

8 years agoMerge pull request #2787 from esdrubal/endpointaddress10
Marcos Henrich [Wed, 30 Mar 2016 07:37:40 +0000 (08:37 +0100)]
Merge pull request #2787 from esdrubal/endpointaddress10

[System.ServiceModel] Fixes reflection call to undefined method

8 years agoMerge pull request #2781 from alexanderkyte/inflated_method_header_leak
Rodrigo Kumpera [Wed, 30 Mar 2016 00:15:24 +0000 (17:15 -0700)]
Merge pull request #2781 from alexanderkyte/inflated_method_header_leak

[runtime] Fix leaking of inflated method headers

8 years agoUpdate CONTRIBUTING.md
hannakim123 [Tue, 29 Mar 2016 23:07:39 +0000 (16:07 -0700)]
Update CONTRIBUTING.md

8 years ago[sgen] Don't pump the hazard free queue from sgen, the finalizer thread does it now.
Rodrigo Kumpera [Tue, 29 Mar 2016 22:25:07 +0000 (15:25 -0700)]
[sgen] Don't pump the hazard free queue from sgen, the finalizer thread does it now.

8 years ago[utils] Replace usage of mono_thread_hazardous_free_or_queue and remove it.
Rodrigo Kumpera [Tue, 29 Mar 2016 22:09:49 +0000 (15:09 -0700)]
[utils] Replace usage of mono_thread_hazardous_free_or_queue and remove it.

mono_thread_hazardous_free_or_queue has a fundamentally broken design.

It allows arbitrary free code to run in the context of its caller.

The sync/async split on where it's called is not enough to know whether
we can run free'ing code or not.

Since in sync context we called free functions that could take locks,
it happened that those locks conflicted with the ones already taken.

In particular, mono_jit_info_table_free did take a domain lock and
quite a few of the sync context calls would hold locks that must
not be held when taking a domain lock.

This, is practice, means that we'd need to partition the free calls
into 3 groups: async context, reentrant context (no runtime locks held)
and sync context (maybe some locks held).

There was no case where reentrant context would be usable meaning,
in practice, that all calls happens in what effectively is async context
where free functions can't be called.

The new design is a lot more straightforward:

- No implicit free queue pumping
- A pair of free functions with well defined behavior.
mono_thread_hazardous_try_free - to be used where the caller expects the free function to be called
mono_thread_hazardous_queue_free - to be used where the caller don't expect the free function to be called [1]
- Explicit pumping on places that known to be ok
Thread detach
Finalizer thread

[1] This might sound like a weird condition, but a lot of lock-free code
have compensation logic that trigger free'ing during lookups.

8 years ago[security-core-clr] Add MonoError arg to
Aleksey Kliger [Tue, 29 Mar 2016 20:23:19 +0000 (16:23 -0400)]
[security-core-clr] Add MonoError arg to
mono_security_core_clr_ensure_delegate_creation

8 years ago[security-core-clr] Add MonoError arg to mono_security_core_clr_ensure_reflection_acc...
Aleksey Kliger [Tue, 29 Mar 2016 19:58:12 +0000 (15:58 -0400)]
[security-core-clr] Add MonoError arg to mono_security_core_clr_ensure_reflection_access_method

8 years ago[security-core-clr] Add MonoError to mono_security_core_clr_ensure_reflection_access_...
Aleksey Kliger [Tue, 29 Mar 2016 19:43:45 +0000 (15:43 -0400)]
[security-core-clr] Add MonoError to mono_security_core_clr_ensure_reflection_access_field

8 years agoMerge pull request #1718 from madewokherd/sgenthreadcleanup
monojenkins [Tue, 29 Mar 2016 20:01:05 +0000 (21:01 +0100)]
Merge pull request #1718 from madewokherd/sgenthreadcleanup

[sgen] Clean up thread pool on shutdown.

Keeping threads around can cause processes to keep running when they shouldn't, particularly on Windows when the entry point returns.

(The reason this is important for me is that Wine provides _CorExeMain, which is an entry point that does return, unlike normal compiled C programs which appear to call exit() after main() returns. A Windows process doesn't exit until ALL threads have exited, so a thread that never exits means a hung process.)

It doesn't seem like we have other GC-specific cleanup code, so I don't know if this is a good approach. Feedback on that question would be appreciated.

8 years ago[util] Add mono_thread_hazardous_try_free and mono_thread_hazardous_queue_free.
Rodrigo Kumpera [Tue, 29 Mar 2016 01:05:47 +0000 (18:05 -0700)]
[util] Add mono_thread_hazardous_try_free and mono_thread_hazardous_queue_free.

Those two functions are intended to replace mono_thread_hazardous_free_or_queue.

The problem with that function is that it doesn't compose well given it forces
the whole call chain leader to a free call to follow its semantics.

Additionally, it's not enough safety to be in sync context to call the free functions
as they introduce reentrancy - they can be called from any other arbitrary free
call that doesn't claim to be in async context.

Given most data structures, in general, can't guarantee how they are used, they
must make the conservative assumption of being in async context, thus not allowing
any form of locking happening.

8 years ago[tests] Force tests to print thread dumps when they time out.
Zoltan Varga [Tue, 29 Mar 2016 18:32:00 +0000 (14:32 -0400)]
[tests] Force tests to print thread dumps when they time out.

8 years agoMerge pull request #2801 from BrzVlad/feature-conc-cementing
Vlad Brezae [Tue, 29 Mar 2016 17:45:10 +0000 (00:45 +0700)]
Merge pull request #2801 from BrzVlad/feature-conc-cementing

[sgen] Cementing for the finishing pause

8 years ago[corlib] Remove local variables inadvertently overriding class variables.
Rolf Bjarne Kvinge [Tue, 29 Mar 2016 17:04:58 +0000 (19:04 +0200)]
[corlib] Remove local variables inadvertently overriding class variables.

8 years ago[corlib] Add Console.[Input|Output]Encoding to the mobile profiles.
Rolf Bjarne Kvinge [Tue, 29 Mar 2016 16:24:19 +0000 (18:24 +0200)]
[corlib] Add Console.[Input|Output]Encoding to the mobile profiles.

8 years agoMerge pull request #2794 from xmcclure/win-aot-basic
monojenkins [Tue, 29 Mar 2016 16:31:13 +0000 (17:31 +0100)]
Merge pull request #2794 from xmcclure/win-aot-basic

Make AOT compilation on 64 bit windows produce executables

This PR contains three commits (see commit descriptions) which:

- Fix 64-bit debug windows builds in MSVC 2015
- Make it possible to use the tool-prefix aot option with mono/mini make fullaotcheck (necessary if you are in cygwin and wish to invoke `x86_64-w64-mingw32-gcc`)
- Change mini so that `--aot=full` successfully emits 64-bit windows executables.

Building 32 bit executables will generally fail because we do not follow cdecl. The 64 bit executables do not run properly when executed.

8 years agoMerge pull request #2767 from lambdageek/dev/monoerror-mono_lookup_dynamic_token
monojenkins [Tue, 29 Mar 2016 15:15:20 +0000 (16:15 +0100)]
Merge pull request #2767 from lambdageek/dev/monoerror-mono_lookup_dynamic_token

[runtime] MonoError-ize mono_loookup_dynamic_token{,_class}

Push `MonoError` through `mono_lookup_dynamic_token_class` and `mono_lookup_dynamic_token`

Also simplify the implementations of those functions so that they call `mono_reflection_lookup_dynamic_token` directly, rather than via a function pointer.  The old implementation was a holdover from when the runtime was implemented as separate libraries.

8 years ago[runtime] Use mono_object_isinst_checked for ppc and ia64
Alexander Köplinger [Tue, 29 Mar 2016 13:02:20 +0000 (15:02 +0200)]
[runtime] Use mono_object_isinst_checked for ppc and ia64

The usages were only partially changed in the move from mono_object_isinst in fbe121079035450251d4169b71b64196c9f5657c and caused build errors.

8 years agoBump referencesource
Marek Safar [Tue, 29 Mar 2016 11:24:32 +0000 (13:24 +0200)]
Bump referencesource

8 years ago[System.Runtime.Serialization] Static writer fix.
Marcos Henrich [Mon, 29 Feb 2016 19:10:55 +0000 (19:10 +0000)]
[System.Runtime.Serialization] Static writer fix.

While serializing any type into a contract member of type object an
exception would be thrown.

To avoid this XmlObjectSerializerWriteContext.InternalSerialize should
in this case be called using the object type instead of the member type,
similar how reference sources does in  type instead of the member type,
 referencesources seems to be doing omething similar [1].

Fixes #37116.

[1]
http://referencesource.microsoft.com/#System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs,619

8 years agoMerge pull request #896 from echampet/webresource
Marek Safar [Tue, 29 Mar 2016 07:33:39 +0000 (09:33 +0200)]
Merge pull request #896 from echampet/webresource

[Fix] ReusableHashAlgorithm doesn't set the Key of the ValidationAlgorit...

8 years ago[sgen] Clear the card table in the finishing pause
Vlad Brezae [Wed, 23 Mar 2016 17:17:03 +0000 (19:17 +0200)]
[sgen] Clear the card table in the finishing pause

It is not used during a major collection. The collector will add the necessary global remsets afterwards, for the nursery collections.

8 years ago[bcl] Avoid printing debug messages to stdout in the default trace listener when...
Zoltan Varga [Tue, 29 Mar 2016 01:46:23 +0000 (21:46 -0400)]
[bcl] Avoid printing debug messages to stdout in the default trace listener when a debugger is connected. Fixes #13538.

8 years ago[amd64] Avoid passing the pc/pc offset to the throw corlib exception trampoline in...
Zoltan Varga [Tue, 29 Mar 2016 00:44:40 +0000 (20:44 -0400)]
[amd64] Avoid passing the pc/pc offset to the throw corlib exception trampoline in llvm mode, instead simply use the return address pushed by the call itself. In JIT mode, this is needed because the throw code is generated out of line so its not inside the try range, but in llvm mode, the try-range encompasses the call.

8 years agoUpdate LICENSE including GPL
Miguel de Icaza [Tue, 29 Mar 2016 00:09:53 +0000 (17:09 -0700)]
Update LICENSE including GPL

8 years agoMove all licenses to a single LICENSE file
Miguel de Icaza [Fri, 25 Mar 2016 19:03:54 +0000 (15:03 -0400)]
Move all licenses to a single LICENSE file

8 years agoNo more LGPL requirements
Miguel de Icaza [Fri, 25 Mar 2016 18:28:47 +0000 (14:28 -0400)]
No more LGPL requirements

8 years agoAdded PATENTS.TXT file and link to it
Miguel de Icaza [Wed, 23 Mar 2016 18:46:38 +0000 (14:46 -0400)]
Added PATENTS.TXT file and link to it

8 years agoUpdate LICENSE
Miguel de Icaza [Wed, 23 Mar 2016 18:25:59 +0000 (14:25 -0400)]
Update LICENSE

8 years agoFirst set of licensing changes
Miguel de Icaza [Wed, 23 Mar 2016 15:12:01 +0000 (11:12 -0400)]
First set of licensing changes

8 years ago[System] Add new 'Mono.Security.Interface.MonoTlsProviderFactory' callback to let...
Rolf Bjarne Kvinge [Tue, 15 Mar 2016 12:41:13 +0000 (13:41 +0100)]
[System] Add new 'Mono.Security.Interface.MonoTlsProviderFactory' callback to let the framework libraries select the provider at runtime.

List of original contributors:

Martin Baulig <martin.baulig@xamarin.com>

8 years agoExtend HttpClient to use infrastructure in Xamarin.Mac (via reflection) to pick right...
Rolf Bjarne Kvinge [Tue, 15 Mar 2016 12:29:33 +0000 (13:29 +0100)]
Extend HttpClient to use infrastructure in Xamarin.Mac (via reflection) to pick right type.

List of original contributors:

Chris Hamons <chris.hamons@xamarin.com>

8 years ago[corlib] Add partial EncodingHelper type to let XI define its own default encoding...
Rolf Bjarne Kvinge [Tue, 15 Mar 2016 12:21:18 +0000 (13:21 +0100)]
[corlib] Add partial EncodingHelper type to let XI define its own default encoding [#29928]

List of original contributors:

Sebastien Pouliot <sebastien@xamarin.com>

8 years ago[corlib] New lazily initialized X509Certificate.
Rolf Bjarne Kvinge [Tue, 15 Mar 2016 11:54:29 +0000 (12:54 +0100)]
[corlib] New lazily initialized X509Certificate.

List of original contributors:

Martin Baulig <martin.baulig@xamarin.com>

8 years ago[corlib] Add a special method for XI so the linker does not always have to generate it.
Rolf Bjarne Kvinge [Tue, 15 Mar 2016 11:47:21 +0000 (12:47 +0100)]
[corlib] Add a special method for XI so the linker does not always have to generate it.

List of original contributors:

Sebastien Pouliot <sebastien@xamarin.com>