mono.git
7 years ago[System] Rewrite Dns tests so that failures don't cause the process to crash.
Rolf Bjarne Kvinge [Wed, 14 Sep 2016 15:33:12 +0000 (17:33 +0200)]
[System] Rewrite Dns tests so that failures don't cause the process to crash.

Previously the tests were written so that some failures might occur on the
threadpool in methods that did not catch exceptions. In that case the process
would terminate due to an unhandled exception. So rewrite the tests to catch
exceptions in any code that doesn't run on the main thread, and forward those
exceptions to the main thread.

Also wait for async operations to complete on the main thread, and remove
asserts that are not supposed to be hit.

7 years ago[mcs] Move type constraints checks after base type definition. Fixes #44212
Marek Safar [Wed, 14 Sep 2016 13:40:11 +0000 (15:40 +0200)]
[mcs] Move type constraints checks after base type definition. Fixes #44212

7 years agoMerge pull request #3536 from henricm/fix-machinename-ignorecase
Niklas Therning [Wed, 14 Sep 2016 12:57:03 +0000 (14:57 +0200)]
Merge pull request #3536 from henricm/fix-machinename-ignorecase

Ignoring case for MachineName in EventLogTest

7 years agoSet DefaultPersistentConnectionLimit to 10 for Xamarin.Android
Marek Habersack [Wed, 14 Sep 2016 09:18:13 +0000 (11:18 +0200)]
Set DefaultPersistentConnectionLimit to 10 for Xamarin.Android

This is to make it the same as the Xamarin.iOS setting and
fixes https://bugzilla.xamarin.com/show_bug.cgi?id=7467

7 years ago[runtime] Rename IMT thunks to 'trampolines'. NFC. (#3555)
Zoltan Varga [Wed, 14 Sep 2016 00:56:20 +0000 (02:56 +0200)]
[runtime] Rename IMT thunks to 'trampolines'. NFC. (#3555)

7 years ago[io-layer] Extract Mutex, Semaphore and Event (#3553)
Ludovic Henry [Tue, 13 Sep 2016 21:40:58 +0000 (23:40 +0200)]
[io-layer] Extract Mutex, Semaphore and Event (#3553)

* [metadata] Move mutex managed support to seperate file

* [mutex] Extract CreateMutex

* [mutex] Extract ReleaseMutex

* [mutex] Extract OpenMutex

* [mutex] Extract wapi_mutex_abandon

* [mutex] Extract MonoW32HandleOps for mutex and named mutex

* [io-layer] Extract wapi_search_handle_namespace

* [metadata] Move semaphore managed support to seperate file

* [semaphore] Move _WapiHandle_sem and _WapiHandle_namedsem to semaphores.h

* [semaphore] Extract CreateSemaphore

* [semaphore] Extract ReleaseSemaphore

* [semaphore] Extract OpenSemaphore

* [semaphore] Extract MonoW32HandleOps

* [metadata] Move event managed support to seperate file

* [event] Extract CreateEvent

* [event] Remove dead code PulseEvent

* [event] Extract SetEvent

* [event] Extract ResetEvent

* [event] Extract OpenHandle

* [event] Extract MonoW32HandleOps

* [w32handle] Extract namespace locking

* [io-layer] Inline only use of wapi_shm_sem_lock/wapi_shm_sem_unlock

7 years ago[hybrid-aot] Add runtime support (#3556)
Ludovic Henry [Tue, 13 Sep 2016 21:40:01 +0000 (23:40 +0200)]
[hybrid-aot] Add runtime support (#3556)

* [aot-compiler] Add generic class and gsharedvt for hybrid AOT mode

* [aot-compiler] Remove dead code

* [hybrid-aot] Add --hybrid-aot for future use

7 years ago[threads] Import mono_thread_info_set_priority (#3543)
Ludovic Henry [Tue, 13 Sep 2016 16:41:29 +0000 (18:41 +0200)]
[threads] Import mono_thread_info_set_priority (#3543)

* [mono-threads] Remove MonoThreadParm.creation_flags

* [mono-threads] Remove MonoThreadParm.priority and set to MONO_THREAD_PRIORITY_NORMAL by default

* [threads] Wrap use of mono_thread_info_(get|set)_priority

* [threads] Store priority on MonoInternalThread

* [threads] Import mono_thread_info_set_priority

* [mono-threads] Remove MonoThreadParm

7 years ago[System] Don't compress custom http headers in httplistener response. Fixes #34715
Marek Safar [Tue, 13 Sep 2016 14:07:40 +0000 (16:07 +0200)]
[System] Don't compress custom http headers in httplistener response. Fixes #34715

7 years ago[runtime] Pass the initial context to mono_walk_stack_with_ctx () in mono_stack_walk_...
Zoltan Varga [Tue, 13 Sep 2016 12:58:17 +0000 (08:58 -0400)]
[runtime] Pass the initial context to mono_walk_stack_with_ctx () in mono_stack_walk_async_safe (). Hopefully fixes #44164.

7 years agoMerge pull request #3534 from BrzVlad/fix-conc-gcstress-mem
Vlad Brezae [Mon, 12 Sep 2016 20:27:39 +0000 (23:27 +0300)]
Merge pull request #3534 from BrzVlad/fix-conc-gcstress-mem

[sgen] Fix conc gcstress mem

7 years agoMerge pull request #3541 from kumpera/add-tas-to-threading
Rodrigo Kumpera [Mon, 12 Sep 2016 20:05:28 +0000 (16:05 -0400)]
Merge pull request #3541 from kumpera/add-tas-to-threading

[abort] Reduce the race window when doing Monitor:Enter.

7 years agoBump version to 4.9.0
Zoltan Varga [Mon, 12 Sep 2016 18:59:46 +0000 (20:59 +0200)]
Bump version to 4.9.0

7 years agoMerge pull request #3549 from lewurm/arm64-icache-big-little-fix
monojenkins [Mon, 12 Sep 2016 17:30:08 +0000 (18:30 +0100)]
Merge pull request #3549 from lewurm/arm64-icache-big-little-fix

[arm64] fixes around icache flushing

This fixes https://bugzilla.xamarin.com/show_bug.cgi?id=39859

The problem in `emit_thunk` and the workarounds for the Cortex A53 errata are unrelated to the bug above, but they don't hurt either.

The basic problem that we see is that the Exynos 8890 SoC (shipped for example in the world edition of the Samsung Galaxy S7) is a big.LITTLE architecture with two different CPUs, four of each. `__clear_cache` of GCC [1], the built-in that we use to flush the instruction cache, correctly reads the cache line sizes for data- and instruction cache from the CPU and then caches that result. However, the two CPUs on the Exynos 8890 have two different cache line sizes for the instruction cache (128 bytes vs. 64 bytes): If we happen to initialize the cache line sizes with the larger one, we only flush every other cache line if the code runs on the second CPU model.

Neither V8 [2] and LLVM [3] do caching of the cache line sizes, but just read it every time from the register.  We have a slightly different solution, where we cache _and_ read the value every time and try to determine a global minimum across CPUs, in case we get scheduled to a different CPU by the kernel during the flushing loop.

[1] https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.9/libgcc/config/aarch64/sync-cache.c#33
[2] https://github.com/v8/v8/commit/fec99c689b8587b863df4a5c4793c601772ef663
[3] https://github.com/llvm-mirror/compiler-rt/blob/ff75f2a0260b1940436a483413091c5770427c04/lib/builtins/clear_cache.c#L146

7 years agoMerge pull request #3535 from henricm/fix-always-use-preamble-length
Marek Safar [Mon, 12 Sep 2016 14:52:30 +0000 (16:52 +0200)]
Merge pull request #3535 from henricm/fix-always-use-preamble-length

Removing hard coded preamble length

7 years ago[sgen] Free major sections in bulk also on 64bit
Vlad Brezae [Thu, 1 Sep 2016 17:58:08 +0000 (17:58 +0000)]
[sgen] Free major sections in bulk also on 64bit

On coreclr-gcstress this reduces the OS vmem maps by more than half.

7 years ago[sgen] Adjust free-ing of empty blocks
Vlad Brezae [Fri, 2 Sep 2016 16:52:20 +0000 (16:52 +0000)]
[sgen] Adjust free-ing of empty blocks

After sweep, depending on the computed allowance, we are freeing empty blocks so that we still keep around enough blocks to fill that allowance (to avoid repeated vmaps).

On both collectors this had the problem that the allowance also accounts for LOS space, which we shouldn't account for in major section heuristics (which means that in LOS intensive benchmarks we only free major sections after the LOS shrinks).

On the concurrent collector, where we have a negative allowance adjustment depending on the duration of the concurrent mark (in order to mimic serial memory usage), we can have very small allowances at the end of a major collection, even 0. This means that we would reserve no empty blocks for later use.

We solve these issues by reserving empty blocks relative to the amount of current alive blocks, which is also the basis of how we compute the allowance in the first place.

7 years ago[runtime] Replace uses of alloc functions with glib variants
Vlad Brezae [Tue, 30 Aug 2016 00:30:51 +0000 (00:30 +0000)]
[runtime] Replace uses of alloc functions with glib variants

7 years ago[utils] Fix internal allocator header size.
Mark Probst [Thu, 9 Jun 2016 20:15:23 +0000 (13:15 -0700)]
[utils] Fix internal allocator header size.

The header is always just a pointer.

7 years ago[runtime] Counters for allocated virtual memory.
Mark Probst [Thu, 9 Jun 2016 20:40:11 +0000 (13:40 -0700)]
[runtime] Counters for allocated virtual memory.

7 years agoMerge pull request #3552 from DavidKarlas/getScopeChanges
David Karlaš [Mon, 12 Sep 2016 12:58:54 +0000 (14:58 +0200)]
Merge pull request #3552 from DavidKarlas/getScopeChanges

[Debugger] GetLocals was throwing NullReferenceException(li.scopes_start) if ran against older runtime

7 years ago[Debugger] GetLocals was throwing NullReferenceException(li.scopes_start) if ran...
David Karlaš [Mon, 12 Sep 2016 11:01:27 +0000 (13:01 +0200)]
[Debugger] GetLocals was throwing NullReferenceException(li.scopes_start) if ran against older runtime
Added logic to make sure user of API handles version checking when calling GetScope
Made properties in LocalScope class public

7 years ago[threads] Correct the spin waiting in 'sleep_interruptable' (#3544)
Emil Sandstø [Mon, 12 Sep 2016 10:19:00 +0000 (12:19 +0200)]
[threads] Correct the spin waiting in 'sleep_interruptable' (#3544)

After https://github.com/mono/mono/commit/089c47f1c07bf250d76c36e04675569fc6f5b4ba#diff-e7e458b6256eaa730c145f14a666652aR1141
the code started to use nanoseconds instead of milliseconds. The problem was that this caused 'sleep_interruptable' to spin wait the last millisecond before the wait was over, https://bugzilla.xamarin.com/show_bug.cgi?id=44132.

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

7 years agoMerge pull request #3550 from alexrp/revert-tp-monitor
Alex Rønne Petersen [Sun, 11 Sep 2016 14:19:41 +0000 (16:19 +0200)]
Merge pull request #3550 from alexrp/revert-tp-monitor

Revert "[threadpool-ms] Switch Monitor thread to a MonoThreadInfo (#3538)"

7 years agoRevert "[threadpool-ms] Switch Monitor thread to a MonoThreadInfo (#3538)"
Alex Rønne Petersen [Sun, 11 Sep 2016 13:44:56 +0000 (15:44 +0200)]
Revert "[threadpool-ms] Switch Monitor thread to a MonoThreadInfo (#3538)"

This reverts commit 2f88b8eb5a6f0108288a878f515c53b72637a88b.

There is a subtle problem with turning the monitor thread into a simple
MonoThreadInfo: It creates worker threads via mono_thread_create_internal (),
which allocates the thread object from the GC. No thread can allocate from
the GC unless it's actually attached, which the worker thread is not when
created with just mono_threads_create ().

7 years ago[runtime] Remove some dead code.
Zoltan Varga [Fri, 9 Sep 2016 22:50:50 +0000 (00:50 +0200)]
[runtime] Remove some dead code.

7 years ago[arm64] use `dc civac` instead of `dc cvau`
Bernhard Urban [Fri, 9 Sep 2016 22:43:40 +0000 (00:43 +0200)]
[arm64] use `dc civac` instead of `dc cvau`

suggested workaround for some Cortex A53 bugs, inspired by V8:
https://github.com/v8/v8/commit/fec99c689b8587b863df4a5c4793c601772ef663

7 years ago[arm64] manually flush icache
Bernhard Urban [Fri, 9 Sep 2016 22:42:58 +0000 (00:42 +0200)]
[arm64] manually flush icache

should fix https://bugzilla.xamarin.com/show_bug.cgi?id=39859

7 years ago[arm64] flush whole emitted thunk
Bernhard Urban [Fri, 9 Sep 2016 06:00:36 +0000 (08:00 +0200)]
[arm64] flush whole emitted thunk

7 years ago[threadpool-ms] Switch Monitor thread to a MonoThreadInfo (#3538)
Ludovic Henry [Fri, 9 Sep 2016 21:41:34 +0000 (23:41 +0200)]
[threadpool-ms] Switch Monitor thread to a MonoThreadInfo (#3538)

7 years agoRemove a debug printf.
Zoltan Varga [Fri, 9 Sep 2016 18:08:06 +0000 (20:08 +0200)]
Remove a debug printf.

7 years agoAdd missing file.
Zoltan Varga [Fri, 9 Sep 2016 17:59:45 +0000 (19:59 +0200)]
Add missing file.

7 years ago[sdb] Add a MethodMirror:GetScopes () method which returns scope information.
Zoltan Varga [Fri, 9 Sep 2016 17:58:59 +0000 (19:58 +0200)]
[sdb] Add a MethodMirror:GetScopes () method which returns scope information.

7 years ago[threads] Add specific field to check size (#3542)
Ludovic Henry [Fri, 9 Sep 2016 14:23:34 +0000 (16:23 +0200)]
[threads] Add specific field to check size (#3542)

7 years ago[threadpool-ms] Replace win32 semaphore by coop semaphore (#3519)
Ludovic Henry [Fri, 9 Sep 2016 10:09:18 +0000 (12:09 +0200)]
[threadpool-ms] Replace win32 semaphore by coop semaphore (#3519)

7 years ago[mono-threads] Fix lifetime of MonoThreadInfo->handle (#3539)
Ludovic Henry [Fri, 9 Sep 2016 09:38:30 +0000 (11:38 +0200)]
[mono-threads] Fix lifetime of MonoThreadInfo->handle (#3539)

This handle should have a total of maximum 3 copies:
 - in MonoThreadInfo->handle
 - in the return value of mono_threads_create_thread
 - in MonoInternalThread->handle (if it's a managed thread)

Before, there would always be 2 references (in MonoThreadInfo->handle and another another for MonoInternalThread->handle), even if it would be referenced at one place only (MonoThreadInfo->handle), which would lead to a handle leak.

We also need to duplicate the returned handle, to avoid having a use-after-free of the handle (in case the thread exits before we access that handle)

7 years ago[llvm] Disable llvm again for methods with large basic blocks in non-llvm-only mode...
Zoltan Varga [Fri, 9 Sep 2016 01:14:12 +0000 (03:14 +0200)]
[llvm] Disable llvm again for methods with large basic blocks in non-llvm-only mode, the workaround doesn't seem to work. Fixes #42395.

7 years agoMerge pull request #3540 from kumpera/abort-on-gerror
monojenkins [Fri, 9 Sep 2016 00:45:04 +0000 (01:45 +0100)]
Merge pull request #3540 from kumpera/abort-on-gerror

[logging] Fix g_error not aborting.

Once we enabled g_log redirection, we stopped aborting as the new handlers didn't behave like eglib.

7 years agoMerge pull request #3528 from BrzVlad/fix-sgen-check-before-collections
Vlad Brezae [Thu, 8 Sep 2016 23:54:48 +0000 (02:54 +0300)]
Merge pull request #3528 from BrzVlad/fix-sgen-check-before-collections

[sgen] Fix sgen debug flags

7 years ago[runtime] Reduce the race window when aborting Monitor:Enter.
Rodrigo Kumpera [Thu, 8 Sep 2016 20:43:07 +0000 (13:43 -0700)]
[runtime] Reduce the race window when aborting Monitor:Enter.

If you abort a thread that is doing a Monitor:Enter, if the syscall abort lands before
the target thread start waiting it will block in a non aletable way.

To address that, we start by waiting in an alertable way and if interrupted we
decide to continue or not based on whether an abort can start.

Additionally, when alertable, we CAS the thread state to catch early Thread:Abort
calls that set the state by did not managed to init it.

This fixes a rare deadlock on tests/monitor-abort.exe.

7 years ago[threads] Add mono_threads_is_ready_to_be_interrupted helper to figure out whether...
Rodrigo Kumpera [Thu, 8 Sep 2016 20:42:56 +0000 (13:42 -0700)]
[threads] Add mono_threads_is_ready_to_be_interrupted helper to figure out whether a thread is ready to be interrupted.

7 years ago[threading] Introduce mono_thread_test_and_set_state to manipulate thread state.
Rodrigo Kumpera [Thu, 1 Sep 2016 23:47:19 +0000 (16:47 -0700)]
[threading] Introduce mono_thread_test_and_set_state to manipulate thread state.

Unconditional state transitions are really bad since they don't allow threads
to coordinate between themselves.

7 years ago[logging] Fix g_error not aborting.
Rodrigo Kumpera [Thu, 8 Sep 2016 22:58:08 +0000 (15:58 -0700)]
[logging] Fix g_error not aborting.

7 years ago[threads] Factor common attach code in mono_thread_attach_internal (#3530)
Ludovic Henry [Thu, 8 Sep 2016 15:17:28 +0000 (17:17 +0200)]
[threads] Factor common attach code in mono_thread_attach_internal (#3530)

* [threads] Allocate StartInfo in create_thread

* [threads] Put start_notify semaphore in StartInfo

* [threads] Factor common attach code in mono_thread_attach_internal

* [threads] Use same registered mechanism as mono-threads

7 years agoMerge pull request #3537 from ntherning/fix-failing-ThreadTest-tests-on-windows
Niklas Therning [Thu, 8 Sep 2016 14:31:59 +0000 (16:31 +0200)]
Merge pull request #3537 from ntherning/fix-failing-ThreadTest-tests-on-windows

Remove Assert.Fail() calls in ThreadTest when running on Windows

7 years agoRemove Assert.Fail() calls in ThreadTest when running on Windows
Niklas Therning [Thu, 8 Sep 2016 13:26:25 +0000 (15:26 +0200)]
Remove Assert.Fail() calls in ThreadTest when running on Windows

The tests that fail like this actually work just fine on Mono on Windows.
Added the NotDotNet category to the CurrentThread_Domains() test since it
fails on .NET.

7 years agoIgnoring case for MachineName in EventLogTest
Henric Müller [Thu, 8 Sep 2016 12:57:44 +0000 (14:57 +0200)]
Ignoring case for MachineName in EventLogTest

7 years agoAvoid race condition between domain unload and threadpool. (#3491)
Jonathan Chambers [Thu, 8 Sep 2016 12:28:59 +0000 (08:28 -0400)]
Avoid race condition between domain unload and threadpool. (#3491)

* Avoid race condition between domain unload and threadpool.

Previous logic only ensured that domain->threadpool_jobs was 0.
There was a race condition as follows:
* worker jobs are queued into ThreadPoolDomain outstanding_request's
* domain unload starts
* domain->threadpool_jobs is 0 so unload proceeds
* queued jobs are processed from the ThreadPoolDomain outstanding_request's
* the domain can be set/entered by worker threads since
  mono_domain_set only fails for domains with state of MONO_APPDOMAIN_UNLOADED,
  while our domain is in the MONO_APPDOMAIN_UNLOADING state
* jobs are now being unexpectedly run in domain that is being shutdown

* Fix a hang when unloading the domain.

This change applies the diff from ludovic-henry to correct the hang.

https://gist.github.com/ludovic-henry/6c8a4bc8951091c0ef36df2e52d5e32e

7 years agoRemoving hard coded preamble length
Henric Müller [Thu, 8 Sep 2016 12:15:32 +0000 (14:15 +0200)]
Removing hard coded preamble length

For some reason preamble length was asumed to be 3 when cp 65001
instead of always looking att the preamble length of the encoding.
This resulted in responses cropped by 3 chars on windows.

7 years agoMerge pull request #3532 from alexrp/profiler-stress-tests
Alexander Köplinger [Thu, 8 Sep 2016 05:23:40 +0000 (07:23 +0200)]
Merge pull request #3532 from alexrp/profiler-stress-tests

[acceptance-tests] Add profiler-stress suite.

7 years ago[acceptance-tests] Add profiler-stress suite.
Alex Rønne Petersen [Wed, 7 Sep 2016 23:57:07 +0000 (01:57 +0200)]
[acceptance-tests] Add profiler-stress suite.

7 years agoMerge pull request #3531 from alexrp/master
Alex Rønne Petersen [Thu, 8 Sep 2016 01:18:40 +0000 (03:18 +0200)]
Merge pull request #3531 from alexrp/master

[profiler} Don't crash if a zero sampling frequency is given.

7 years ago[profiler} Don't crash if a zero sampling frequency is given.
Alex Rønne Petersen [Thu, 8 Sep 2016 00:20:32 +0000 (02:20 +0200)]
[profiler} Don't crash if a zero sampling frequency is given.

7 years agoMoving WSAGetLastError calls closer to socket operation (#3450)
Henric Müller [Wed, 7 Sep 2016 13:30:55 +0000 (15:30 +0200)]
Moving WSAGetLastError calls closer to socket operation (#3450)

* When doing async connect on windows, connect returns `WSAEINPROGRESS`
which needs to be returned to managed code for correct handling. However
on Windows, last error gets reset before `WSAGetLastError` is called.
This fix moves all `WSAGetLastError` calls up closer to the socket
operation to make sure correct error code is returned to the managed code.

* Making sure `TcpNoDelay` is set to false for IPv4 by default and
that `DualMode` is default for IPv6.

* Making sure option value is set to 0 before calling getsockopt
because on Windows, a `BOOL` option value (eg TcpNoDelay) is returned
as a one byte value and the other bytes are left untouched which resulted
in TcpNoDelay always seemed to be true.

* Fixed so `TF_REUSE_SOCKET` is set only if `reuse` parameter is set
when disconnecting a socket.

7 years agoMerge pull request #3511 from henricm/fix-no-socket-reuse
Niklas Therning [Wed, 7 Sep 2016 13:23:54 +0000 (15:23 +0200)]
Merge pull request #3511 from henricm/fix-no-socket-reuse

Not reusing sockets in dual mode tests

7 years ago[threads] Remove CREATE_SUSPENDED (#3529)
Ludovic Henry [Wed, 7 Sep 2016 12:28:46 +0000 (14:28 +0200)]
[threads] Remove CREATE_SUSPENDED (#3529)

* [threads] Remove use of CREATE_SUSPENDED for domain unload thread

* [threads] Remove use of CREATE_SUSPENDED for managed thread

* [threads] Remove CREATE_SUSPENDED

7 years agoMerge pull request #3526 from alexrp/master
Alex Rønne Petersen [Wed, 7 Sep 2016 01:00:48 +0000 (03:00 +0200)]
Merge pull request #3526 from alexrp/master

[sgen] Don't consider managed write barriers to be critical methods.

7 years ago[sgen] Make sure we don't sweep a block if we're not supposed to
Vlad Brezae [Tue, 6 Sep 2016 10:43:05 +0000 (13:43 +0300)]
[sgen] Make sure we don't sweep a block if we're not supposed to

If the sweeping mechanism has been triggered by a major collection, then the iteration will wait for the general sweeping to finish and also for the sweeping of all the blocks. If this isn't the case (we are doing a major collection) we will iterate over the current state of the heap, some objects being bound to die during the collection, and the callback must account for this.

It doesn't make much sense to explicitly attempt to iterate without trying to sweep blocks that can be swept.

7 years agoRename local file into socket_fd (#3524)
Manu [Tue, 6 Sep 2016 22:28:16 +0000 (07:28 +0900)]
Rename local file into socket_fd (#3524)

This is to avoid hiding the static gint `file` and to better understand the code.

7 years agoMerge pull request #3509 from ludovic-henry/iolayer-extract-threading
Ludovic Henry [Tue, 6 Sep 2016 22:18:23 +0000 (00:18 +0200)]
Merge pull request #3509 from ludovic-henry/iolayer-extract-threading

[mono-threads] Keep cleaning up mono-threads after iolayer extraction

7 years ago[sgen] Don't consider managed write barriers to be critical methods.
Alex Rønne Petersen [Tue, 6 Sep 2016 18:51:13 +0000 (20:51 +0200)]
[sgen] Don't consider managed write barriers to be critical methods.

When we emit calls to them, we also emit an OP_DUMMY_USE instruction to keep
the object alive, so it is OK for the GC to interrupt write barriers now.

7 years ago[sgen] Remove unused and potentially wrong case from major object iteration
Vlad Brezae [Tue, 6 Sep 2016 17:01:28 +0000 (20:01 +0300)]
[sgen] Remove unused and potentially wrong case from major object iteration

We never enter this case since we never iterate over the major objects without requiring to sweep, while a sweep is running. Even if we would be in this case, we directly access the mark bits which can be cleared at the same time by another thread sweeping the block, so we could miss live objects.

7 years ago[sgen] Fix mod union consistency check
Vlad Brezae [Tue, 6 Sep 2016 16:57:48 +0000 (19:57 +0300)]
[sgen] Fix mod union consistency check

We don't need a mod union to mark an object with concurrent mark&sweep.

7 years ago[sgen] Don't do remset consistency checks during majors
Vlad Brezae [Tue, 6 Sep 2016 16:30:31 +0000 (19:30 +0300)]
[sgen] Don't do remset consistency checks during majors

It doesn't make sense to check the remset during a major since majors dont use the cardtable and we clear it at the start. So we will obviously have missing remsets. For the debugging concurrent case, we should use the mod union consistency checks instead.

7 years ago[sgen] Don't verify the heap after a major
Vlad Brezae [Tue, 6 Sep 2016 15:20:54 +0000 (18:20 +0300)]
[sgen] Don't verify the heap after a major

We would need to deal with scanning forwarded objects and dead objects which is not worth it. Only verify the heap at the start of a collection, as indicated by the name of the flag.

7 years ago[sgen] Fix missing remsets with verify before collections
Vlad Brezae [Tue, 6 Sep 2016 13:43:54 +0000 (16:43 +0300)]
[sgen] Fix missing remsets with verify before collections

When verifying the heap we need to have the set of pinned objects otherwise we can observe missing remsets if suspended between the store and the write barrier. If we don't have the set of pinned objects, allow missing remsets.

7 years ago[mono-threads] Have error in case we cannot set thread priority
Ludovic Henry [Mon, 5 Sep 2016 13:41:56 +0000 (15:41 +0200)]
[mono-threads] Have error in case we cannot set thread priority

7 years ago[mono-threads] Fix win32 to posix priority conversion
Ludovic Henry [Wed, 10 Aug 2016 14:49:45 +0000 (16:49 +0200)]
[mono-threads] Fix win32 to posix priority conversion

7 years ago[mono-threads] Store handle related data in MonoThreadInfo
Ludovic Henry [Fri, 15 Jul 2016 01:10:37 +0000 (03:10 +0200)]
[mono-threads] Store handle related data in MonoThreadInfo

7 years ago[mono-threads] Assert that we do not try to signal the handle multiple times
Ludovic Henry [Fri, 15 Jul 2016 08:51:14 +0000 (10:51 +0200)]
[mono-threads] Assert that we do not try to signal the handle multiple times

7 years agoMerge pull request #3518 from akoeplinger/fix-fileiopermission
Alexander Köplinger [Tue, 6 Sep 2016 13:17:30 +0000 (15:17 +0200)]
Merge pull request #3518 from akoeplinger/fix-fileiopermission

[corlib] Ensure FileIOPermission ctor is not called on mobile

7 years ago[corlib] Ensure FileIOPermission ctor is not called on mobile
Alexander Köplinger [Sun, 4 Sep 2016 14:42:11 +0000 (16:42 +0200)]
[corlib] Ensure FileIOPermission ctor is not called on mobile

After https://github.com/mono/mono/pull/3452 was merged, the LinkSdkRegressionTest.SecurityDeclaration
test in XI started failing:

```
[FAIL] LinkSdkRegressionTest.SecurityDeclaration :   FileIOPermissionAccess
  Expected: null
  But was:  <System.Security.Permissions.FileIOPermissionAccess>

  at LinkSdk.LinkSdkRegressionTest.SecurityDeclaration () [0x00033] in /Users/builder/data/lanes/1411/2a96404f/source/xamarin-macios/tests/linker-ios/link sdk/LinkSdkRegressionTest.cs:990
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /Users/builder/data/lanes/1411/2a96404f/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
```

Due to the added call in the PR the linker preserved FileIOPermissionAccess enum,
which is apparently something we want to avoid.

Since according to https://github.com/mono/mono/pull/3452#discussion_r76384945 the only point of calling the
FileIOPermission is validating that the path doesn't contain invalid characters (mostly an issue on Windows),
I decided to just copy those checks as it's way cleaner.

7 years agoMerge pull request #3525 from henricm/fix-access-level-get-token
Alexander Köplinger [Tue, 6 Sep 2016 10:24:39 +0000 (12:24 +0200)]
Merge pull request #3525 from henricm/fix-access-level-get-token

Using max level allowed when getting current token

7 years agoUsing max level allowed when getting current token
Henric Müller [Tue, 6 Sep 2016 08:08:50 +0000 (10:08 +0200)]
Using max level allowed when getting current token

Reference source of WindowsIdentity is using `MAXIMUM_ALLOWED`
as desired level by default when getting current token.
Changing to same behaviour to enable duplicate and impersonation
to be made on the token retrieved by GetCurrentToken.

7 years ago[mcs/Makefile] make the 'btest' (bootstrap test) target work again
Miguel de Icaza [Tue, 6 Sep 2016 01:38:47 +0000 (21:38 -0400)]
[mcs/Makefile] make the 'btest' (bootstrap test) target work again

7 years ago[jit] Unify the handling of 'error' and 'exc' in the llvm-only and non llvm-only...
Zoltan Varga [Tue, 6 Sep 2016 00:21:38 +0000 (02:21 +0200)]
[jit] Unify the handling of 'error' and 'exc' in the llvm-only and non llvm-only runtime invoke code. Fixes #41961.

7 years agoBetter handle marshaling of packed types (#3508)
Joshua Peterson [Mon, 5 Sep 2016 21:43:55 +0000 (17:43 -0400)]
Better handle marshaling of packed types (#3508)

* This improves the marshaling for packed classes and class involved in an inheritance hierarchy.
* Similar changes were made in the Unity fork of mono across a number of commits.
* The tests here have been taken from the repo and converted to work as NUnit tests in Mono.

7 years ago[jit] Emit a dummy call after calls to Type.GetType () in llvm-only mode to prevent...
Zoltan Varga [Mon, 5 Sep 2016 21:01:38 +0000 (23:01 +0200)]
[jit] Emit a dummy call after calls to Type.GetType () in llvm-only mode to prevent clang from transforming the call to a tail call which would cause the stack walk done by GetType () to find the wrong frame. Fixes #41956.

7 years agoMerge pull request #3521 from ntherning/fix-failures-in-RegistryKeyTest-on-windows
Alexander Köplinger [Mon, 5 Sep 2016 16:17:22 +0000 (18:17 +0200)]
Merge pull request #3521 from ntherning/fix-failures-in-RegistryKeyTest-on-windows

Fix for failures in RegistryKeyTest on Windows

7 years agoMerge pull request #3520 from ntherning/fix-ModuleTest-too-long-temp-folder-path...
Alexander Köplinger [Mon, 5 Sep 2016 15:39:33 +0000 (17:39 +0200)]
Merge pull request #3520 from ntherning/fix-ModuleTest-too-long-temp-folder-path-on-windows

Prevent ModuleTest failures due to too long temp folder path on Windows

7 years agoFix for failures in RegistryKeyTest on Windows
Niklas Therning [Mon, 5 Sep 2016 13:15:11 +0000 (15:15 +0200)]
Fix for failures in RegistryKeyTest on Windows

Refcatored Win32RegistryApi.SetValue() to accept uint/byte/etc values for
DWord registry values.

Added handling of ERROR_CHILD_MUST_BE_VOLATILE errors to GenerateException().

Centralized MarkedForDeletion error handling to GenerateException().

Fixed tests which create volatile subkeys in RegistryKeyTest which used the
same key names but didn't clean up properly.

7 years agoMerge pull request #3505 from ntherning/fix-resource-lookup-in-ResourceReaderTest...
Alexander Köplinger [Mon, 5 Sep 2016 11:42:57 +0000 (13:42 +0200)]
Merge pull request #3505 from ntherning/fix-resource-lookup-in-ResourceReaderTest-on-mono-on-windows

Lookup of test resource files in ResourceReaderTest fails on Windows

7 years agoPrevent ModuleTest failures due to too long temp folder path on Windows
Niklas Therning [Mon, 5 Sep 2016 11:21:28 +0000 (13:21 +0200)]
Prevent ModuleTest failures due to too long temp folder path on Windows

On Windows the TearDown() cannot delete the temp folder since it contains
loaded assemblies. The next time the test is run it will create a temp folder
inside the previous folder. After a number of runs the temp folder path will
approach the ~260 max path supported on Windows and some of the methods will
start failing.

This patch changes the way the temp folder is created and reduces the depth in
the same way as AssemblyTest was patched to fix a similar issue in
b90617e7b7a9ecd501abc65d171d97163ce4ee3d.

7 years ago[sgen] Remove unused parameter
Vlad Brezae [Mon, 5 Sep 2016 11:12:00 +0000 (14:12 +0300)]
[sgen] Remove unused parameter

We never do nursery collections as part of the concurrent finishing pause

7 years agoLookup of test resource files in ResourceReaderTest fails on Windows
Niklas Therning [Thu, 1 Sep 2016 14:34:49 +0000 (16:34 +0200)]
Lookup of test resource files in ResourceReaderTest fails on Windows

Removed the differing code paths in FixtureSetUp() when running on non-Windows
platforms vs when running Mono on Windows or on .NET. The path previously
taken only on non-Windows platforms has been verified to work as expected on
both Mono on Windows and on .NET.

7 years ago[Dataflow] Bump timeouts in TransformBlockTest.DeferredUsage
Alexander Köplinger [Sun, 4 Sep 2016 18:11:36 +0000 (20:11 +0200)]
[Dataflow] Bump timeouts in TransformBlockTest.DeferredUsage

It failed a couple of times according to the babysitter logs with the following error:

```
MESSAGE:
Expected and actual are both <System.Int32[10]>
  Values differ at index [1]
  Expected: -1
  But was:  0
```

Bump timeouts a little bit to see if this helps.

7 years agoMerge pull request #3514 from ntherning/more-reliable-g_get_home_dir-on-windows
Alexander Köplinger [Sun, 4 Sep 2016 09:12:01 +0000 (11:12 +0200)]
Merge pull request #3514 from ntherning/more-reliable-g_get_home_dir-on-windows

Prefer SHGetKnownFolderPath() in g_get_home_dir() over HOMEDRIVE/HOMEPATH environment variables

7 years agoMerge pull request #3517 from alexrp/master
Alex Rønne Petersen [Sat, 3 Sep 2016 20:14:16 +0000 (22:14 +0200)]
Merge pull request #3517 from alexrp/master

[man] Update mprof-report.1 to cover new profiler options.

7 years agoPrefer SHGetKnownFolderPath() in g_get_home_dir() over HOMEDRIVE/HOMEPATH
Niklas Therning [Fri, 2 Sep 2016 19:52:57 +0000 (21:52 +0200)]
Prefer SHGetKnownFolderPath() in g_get_home_dir() over HOMEDRIVE/HOMEPATH
environment variables

Relying on the HOMEDRIVE/HOMEPATH environment variables is fragile as those
variables don't always have to be set. One such scenario is when running on a
Jenkins slave. When not set g_get_home_dir() in eglib would return NULL which
led to a crash in ves_icall_System_Environment_InternalGetHome().

This patch changes g_get_home_dir() to first try to call
SHGetKnownFolderPath() to get the current user's profile directory (i.e. home
dir). If that fails it falls back to the USERPROFILE environment variable. If
that isn't available the function will fallback to the original behavior and
try with HOMEDRIVE/HOMEPATH.

7 years ago[man] Update mprof-report.1 to cover new profiler options.
Alex Rønne Petersen [Sat, 3 Sep 2016 15:05:52 +0000 (17:05 +0200)]
[man] Update mprof-report.1 to cover new profiler options.

Also reformat some sections a bit.

7 years ago[SRE] Move the resolving of user types to managed code, the runtime was not using...
Zoltan Varga [Sat, 3 Sep 2016 02:08:40 +0000 (04:08 +0200)]
[SRE] Move the resolving of user types to managed code, the runtime was not using write barriers. (#3515)

7 years ago[runtime] Fix a C&P problem introduced by d4052c556399c2ef72c79088c05a8ad6913647a6.
Zoltan Varga [Sat, 3 Sep 2016 00:59:20 +0000 (02:59 +0200)]
[runtime] Fix a C&P problem introduced by d4052c556399c2ef72c79088c05a8ad6913647a6.

7 years ago[SRE] Remove empty TypeBuilder:setup_generic_class () icall.
Zoltan Varga [Sat, 27 Aug 2016 22:27:47 +0000 (00:27 +0200)]
[SRE] Remove empty TypeBuilder:setup_generic_class () icall.

7 years ago[runtime] Remove the stub of ves_icall_TypeBuilder_create_internal_class ().
Zoltan Varga [Sat, 27 Aug 2016 22:24:31 +0000 (00:24 +0200)]
[runtime] Remove the stub of ves_icall_TypeBuilder_create_internal_class ().

7 years ago[corlib] Fix the signature of a few SRE icalls, they already receive a TypeBuilder...
Zoltan Varga [Fri, 2 Sep 2016 19:30:05 +0000 (21:30 +0200)]
[corlib] Fix the signature of a few SRE icalls, they already receive a TypeBuilder as the 'this' argument.

7 years agoMerge pull request #3446 from lambdageek/bug-42584
Aleksey Kliger (λgeek) [Fri, 2 Sep 2016 14:31:42 +0000 (10:31 -0400)]
Merge pull request #3446 from lambdageek/bug-42584

[loader] Check for ReferenceAssemblyAttribute when loading

7 years ago[mcs] Adjust correctly newline counter inside pragma warning
Marek Safar [Fri, 2 Sep 2016 14:21:25 +0000 (16:21 +0200)]
[mcs] Adjust correctly newline counter inside pragma warning

7 years ago[corlib] Add timeout to failing test
Marek Safar [Fri, 2 Sep 2016 13:37:56 +0000 (15:37 +0200)]
[corlib] Add timeout to failing test

7 years agoMerge pull request #3506 from ntherning/make-ZoneTest-succeed-on-mono-on-windows
Marek Safar [Fri, 2 Sep 2016 13:01:32 +0000 (15:01 +0200)]
Merge pull request #3506 from ntherning/make-ZoneTest-succeed-on-mono-on-windows

Make Zone.CreateFromUrl() work with URLs like file://C:\foo\bar

7 years agoMerge pull request #3452 from ntherning/fix-AppDomainSetupTest-on-windows
Marek Safar [Fri, 2 Sep 2016 09:25:15 +0000 (11:25 +0200)]
Merge pull request #3452 from ntherning/fix-AppDomainSetupTest-on-windows

Validate AppDomainSetup.ApplicationBase path more like .NET does